I am trying to call an external web-service via some proxy code generated by Visual Studio (based on the WSDL from the service). The result object I get back is null, even though I can see that the service does actually return a SOAP message (I can see that in Fiddler).
It appears that the SOAP message is not able to be deserialized by the code generated by Visual Studio. I have read that this can be due to a mismatch between what the service's WSDL tells us what to expect, and what the service actually returns.
Is it possible to get the deserialization code to report what the problem is, throw an exception, or something, instead of just silently returning null?
Thanks.
I'm not sure about the debugging, but one approach you can try is to create a simple web service which returns the structure you're expecting. Then you can compare the output from this service with the actual service to see if you see any problems.
Related
I need to invoke soap call. I add web link and enter wsdl and Visual studio generates a class derived from System.Web.Services.Protocols.SoapHttpClientProtocol.
But when i call method (f.i. CreateOrder) it throws FormatException. But call from SoapUI passes succesfully. What I need is to get raw xml request to analyse what's wrong. Can I get it?
I've added in the service reference an url like this: "https://example.com/cars?wsdl"
Everything works fine, I can access the methods from that soap and compile the project without errors.
When I call a method the endpoint address is https://example.com/cars (I've notice this with the debugger) on this page is only a fault error and every method I call it returns the fault error.
Why the service reference doesn't see the parameter "?wsdl" ?
Thanks!
Your fault message is probably coming from the service itself. The ?wsdl at the end just has information about your service. Put a try catch in the method that you're calling on the service layer.
The problem was solved by using xml request.
http://www.terminally-incoherent.com/blog/2008/05/05/send-a-https-post-request-with-c/
The error seems to be from the service itself.
I have a very simple program meant to use the Google Discovery API. However, when I try to use the getRest call, it fails as below. Any ideas? I'm using the most recent version of the Discovery API from NuGet, VS 2012 Pro.
DiscoveryService service = new DiscoveryService(new Google.Apis.Services.BaseClientService.Initializer());
//this works no problem
service.Apis.List().Execute();
//this works on the API reference page's Try It! area, but fails here
service.Apis.GetRest("admin", "directory_v1").Execute();
This is the resulting error that is thrown in the Google.Apis.Requests.ClientServiceRequest class, on the Execute() method - line 96:
JsonSerializationException was unhandled
Additional content found in JSON reference object. A JSON reference object should only have a $ref property. Path 'schemas.User.properties.name.description', line 1251, position 20.
This is a documented error. Get the generated discovery to discovery its own discovery document #79
The only work around I have currently found is to use the Client lib to log in and then manually make my requests from the Discovery API. Its messy and doesn't work very well because you can use the class structure that the Discovery API class library would have given you.
I have created one webservice call in php, it is a RESET webservice.
Now I want to call this webservice in excel 2007. So I am using Visual stdio 2010.
When I give the url in add service refrence dialog box and press go. it's give me this error.
-------error------------------------------------
There was an error downloading 'http://careernet.localhost/rep-details/report_details/retrieves'.
The request failed with HTTP status 404: Not found: Could not find the controller..
Metadata contains a reference that cannot be resolved: 'http://careernet.localhost/rep-details/report_details/retrieves'.
The remote server returned an unexpected response: (406) Not Acceptable: Unsupported request content type application/soap+xml.
The remote server returned an error: (406) Not Acceptable.
If the service is defined in the current solution, try building the solution and adding the service reference again.
I would like to tell that url is correct. my webservice call is returning data in xml format.
I tried to convert this into json but it is not working at all.
Service References don't work against REST webservices, they work against SOAP services or other services that provide a WSDL that describes the protocol in a way that Visual Studio understands.
You'll need to write your own proxy for it using the Web API/HttpClient, or you can make use of existing libraries to communicate:
RestSharp: https://stackoverflow.com/a/4970558/736079
I am using Visual Studio 2012. I have a ASP.NET MVC 4 web app that references a class library. This class library has a service reference. The service reference I added by inserting the URL to the .wsdl file.
I have set up everything correctly. When I do a call to one of the operations then I get an error:
Server returned an invalid SOAP Fault. Please see InnerException for more details.
Then when I view the inner exception:
The data at the root level is invalid. Line 16, position 17.
I am doing everything right, I just don't know why I get this error when I do a call to one of the operations. Where do I see what is returned? I have no control over this service, I am just consuming it.
Run fiddler while making the request. http://fiddler2.com/
This will allow you to see what is actually being sent and what is actually being returned