1
votes

I create a web services and a ConsoleApplication to consume it. I am using fiddler to see the traffic, i was hoping that the request and response was SOAP but that's don't happend, only the request was SOAP, not the response.
How can i force to my service that respond using soap?

This is the raw http header obtained:
HTTP/1.1 200 OK
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Content-Encoding: gzip
Vary: Accept-Encoding
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Mon, 17 Nov 2014 20:19:22 GMT
Content-Length: 311

The respond is in binary.
My web-service was created adding a Web Services item to ASP.NET Empty Web Application project, and i don't modified, later I published in IIS.
My consumer is very simple too. I just add the service reference and create an instance.

var binding = new BasicHttpBinding();
var endpointAddress = new EndpointAddress("http://172.20.48.59/web-services/MyWebService.asmx");
var serviceRefWithoutConfig = new ServiceReference1.MyWebServiceSoapClient(binding, endpointAddress);
Console.WriteLine(serviceRefWithoutConfig.HelloWorld());
2
What format was the response? - Sjips
but my consumer application show me the correct answer - Alexander Leyva Caro
Is Fiddler not hiding the SOAP? What does, for instance, WireShark show as the response? - Sjips
Did you write the service? Then show us the (basic) code from the service. It's the service that decides how the service responds. - John Saunders
And, how do you know it's not returning SOAP? Are you expecting your Console.WriteLine to output XML? That's not how it works. - John Saunders

2 Answers

1
votes

The HTTP response in question is compressed with GZIP.

What happens after you click the big yellow bar in Fiddler that says Response is encoded and may require decoding before inspection. Click here to transform.?

0
votes

If you are creating something new, I strongly suggest you look at using WebAPI for something like this.

It's much easier to control the output of your methods, and the resulting service will be easier to consume from mobile platforms, should the need arise in future.