C# service reference doesn't recognize the query parameter from url - c#

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.

Related

C# - Visual Studio, how to debug SoapHttpClientProtocol

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.

Error in deserializing body of request message for operation

I'm writing a service Adapter to use web services hosted by an another vendor (Pega). Changing this service is not an option for me.
When I'm calling a method I get the error :
"Error in deserializing body of request message for operation"
I tried increasing maxStringContentLength and all. Nothing worked.
When examining the response XML I see empty values for few long and int variables I believe this is the reason.
Is there is any fix for this?
This got resolved after removing empty tags from the service end.
No solution found from .Net client end.
I solved this issue by changing format of one of request parameters. Date was passed as a text and service was unable to parse provided date format.
Not sure why service expected date as a string though, but this was out of scope that time.

How to hit Web Service Based on WSDL

Here is the WSDL
http://cc93161263da499cb8f0e0e0b2bcc5a9.cloudapp.net/Service1.svc?wsdl
How can I get to the GetHello service
I tried
http://cc93161263da499cb8f0e0e0b2bcc5a9.cloudapp.net/Service1.svc/GetHello
But I receive a bad request error....
Any thoughts...
Easiest would be to use VS to generate a client proxy based on the WSDL (Add a Service Reference to your project).
Regarding the error: it could be because you're not passing in an input parameter... looks like there is a blank sequence. Or that your browser is sending in accepts parameters that don't match what the server expects (soap).
See this for command line generation without VS:
http://cc93161263da499cb8f0e0e0b2bcc5a9.cloudapp.net/Service1.svc?help

Server returned an invalid soap fault when calling operation from class library

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

Wcf service operation contract change

I recently added a parameter to one of the method of a wcf. It was a string parameter.
The thing is that I didn't update the service reference on the client side but I was still able to call the wcf service .....
Wasn't it suppose to break?
The client side had no idea that you updated the reference, so it won't throw a compile time error.
The service defaulted the string to null when it wasn't passed since it wasn't there which is perfectly valid.

Categories