how to consume php web service in c# Desktop application. I am doing this by adding web reference and through code
WebReference.TestWSDL pdl = new testingApp.WebReference.TestWSDL();
string copy = pdl.verify("testing");
but it throws the error
Possible SOAP version mismatch: Envelope namespace http://schemas.xmlsoap.org/wsdl/ was unexpected. Expecting http://schemas.xmlsoap.org/soap/envelope/.
Make sure you are sending the the appropriate soap version request that the service is expecting ie sending a soap 1.2 request to a service expecting a 1.1 request would give a similar error. Maybe run fiddler and post the messages that are sent and recieved for people to have a look at?
Related
I have created simple web service that works fine if I test with tools. Now I would like to write C# client application for this purpose. What is the best way to do that.
I'm trying to add service reference with web service addres. I expect that web service somehow give WSDL information to client side. But this not happens:
There was an error downloading 'http://localhost:11332/$metadata'.
The request failed with HTTP status 404: Not Found.
Metadata contains a reference that cannot be resolved: 'http://localhost:11332/'.
The content type text/html; charset=utf-8 of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 787 bytes of the response were: '<!DOCTYPE html>
<html>
What is the best way to make client application for web service when both is created with C#?
UPD:
Now both - client and service are in the same solution. In case I try to add reference when web service is not running by selecting "Services in solution" it finds nothing.
I am facing an issue while calling SOAP API and getting different responses due to single space between envelope and body i.e:
<s:Envelope><DataRequest> if I request it like this I receive empty SOAP body from server, but if I send it like this:
<s:Envelope> <DataRequest> I receive proper response from server side.
Can anyone suggest what to do in this situation? Should I ask server side dev team to do some changes? If so, what changes should be done?
I am trying to get the response from a web service which i have no control over, i just have the wsdl that is it. its an old wse3 webservice 10+ more years.
I am using vs2012 to consume the wse3 web service. i added it to vs2012 by adding a web reference. so i could use microsoft.web.services3.webservicesclientprotocol
The web service as wsse:security, to make the request i used the UsernameToken class but now the web service response is giving me the error "soap header security was not understood".
I used fiddler to confirme that i has getting an response and i am (note: to see the xml in fidler i had click "Response is encoded and may require decoding before inspection" ), the response also as an wsse:security. header with "soapenv:mustUnderstand =1".
what can i do to get the webservice response?
thank in advance
ps: googling gave a couple of anseres but nothing worked
I'm making a call to a web service. The call works as expected in most cases. However, sometimes it fails and for troubleshooting, there is always a request from the developer to send them the request xml and if possible the response xml. How do I get this? I tried using fiddler but I don't know if it is because it is https, I only see some tunnel entries but not the xml sent or received. Sample of the web service code is below:
var serviceUrl = "http://190.0.0.1/ServiceLIVE/Service.asmx";
var svc = new LiveEntryService.LiveSoapClient(new BasicHttpBinding("LiveSoap"),new EndpointAddress(serviceUrl));
var ret = svc.MakeLiveEntry(0, "001001002", "002002003", 3, "New Site Data", "004", DateTime.UtcNow);
For serious testing of web services download a copy of SOAP UI today. It is relatively simple to get started with it.
You will be able to see and manipulate your requests and responses. It is really worth using this tool for testing.
Disclaimer: I dont work for SOAP UI.
I've been tasked with creating a class wrapper for a SOAP service, the idea is that you'll be able to treat it as a regular class. The main reason for this is that the WDSL for the SOAP service contains only one method and it's got 5 parameters and it's only kind of OO so you'd have to know all the method calls really well and it's a bit hard to remember them all.
OK, so I've tried adding a web reference, now web references can now be added as service references in VS 2010. You click add service reference advanced etc and it puts in a service reference. Great. Unfortunately if I try and access this from a class I can't.
I can build a console app and put code in the main procedure and access the method of the SOAP service fine but when I add a reference to a class library the intellisense won't allow me to select anything. I'd instantiate an instance like so:
SOAPService.webServiceService ws = new SOAPService.webserviceService();
ws.
and then the intellisense refuses to kick in. If I do the same in a web project or a console app then I can access it fine. I've added the namespace I've done all kinds of things. Also, I can add a web reference and get a DISCO file whenever I create a web project.
OK, also while I'm on the subject I also need to pass credentials to the web service in PHP.
The problem is that in the past I'd create some .net system credentials and add these and it would usually pass through if I was connecting to another .net service.
How should I be sending them to a PHP web service? I always get either invalid username/password combo errors or envelope malformatted error types
Thanks
Mr. B
So the intellisense is not working, but if you add the method in and try to use it does it work, or produce an error?
With regard to diagnosing authentication issues try using fiddler to view the SOAP messages that are being sent, and to view the reply. Do you have some other software that connects and authenticates to that service? Use fiddler to look at the SOAP messages and compare them to see if the header is different etc.
I'd normally do it like this,
using (Service service = new Service())
{
service.ClientCredentials.Windows.ClientCredential.Domain = "domain";
service.ClientCredentials.Windows.ClientCredential.Password = "password";
service.ClientCredentials.Windows.ClientCredential.UserName = "username";
}
Also with regard to the service working or not in general use fiddler if you have any problems, you can see the SOAP messages and it often gives you a clearer message.
I know in IIS you can turn on failed request handling that also gives you an insight from what is going on at the server end, perhaps you have some form of logging too for your php service?