How does SOAP work with ASP / webservices?

D

Dr. Frankenchurn

I have a question regarding SOAP.

A basic "Hello World" web service was written then requested from an IIS
server via TELNET. When a malformed request was sent, a SOAP exception was
returned, just as I would expect:

What was sent:
POST /helloworld/helloworld.asmx?op=HelloWorld HTTP/1.0

What was received:
HTTP/1.1 500 Internal Server Error.
Server: Microsoft-IIS/5.0
Date: Wed, 25 Feb 2004 19:38:32 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 1.1.4322
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Content-Length: 848

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>System.Web.Services.Protocols.SoapException: Unable to
handle request without a valid action parameter. Please supply a valid soap
action.
at
System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type,
HttpContext context, HttpRequest request, HttpResponse response,
Boolean&amp; abortProcessing)</faultstring>
<detail />
</soap:Fault>
</soap:Body>
</soap:Envelope>

--EOF--

However, when a good request was made, what appears to be XML outside of the
SOAP definition was returned:

What was sent:
POST /helloworld/helloworld.asmx/HelloWorld HTTP/1.0

What was received:
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.0
Date: Wed, 25 Feb 2004 21:00:47 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 1.1.4322
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Content-Length: 116

<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/">Hello World : NO REFERRER FOUND</string>

--EOF--

Am I missing something? It appears that a soap exception is returned on bad
requests, that a soap header could be created for specific purposes, but by
default .NET will not return soap encapsulated responses. I know that SOAP
by definition cannot contain a DTD. Is the XML encoded response then an
assumed SOAP header?

Thanks,
Bri Gipson
(e-mail address removed)
 
S

Scott Mitchell [MVP]

..NET supports different message formatting protocols, one of which (the
preferred one) is SOAP. But you can also use HTTP-POST and HTTP-GET as
message format protocols. If you visit the .asmx page through your
browser - http://localhost/myWebService.asmx - and click on a method name
from the list, you'll see the request/response formats for the different
message formats.

By not passing in a SOAP request, your Web service thinks you are invoking
it using the HTTP-POST message format, so it sends its reponse back in
that format. (That's why you're not getting a SOAP response.) In .NET
1.1, HTTP-POST is disabled by default, except for when you are visiting
through localhost. You can configure what message format protocols are
supported through your Web.config or machine.config files...

hth

--

Scott Mitchell
(e-mail address removed)
http://www.4GuysFromRolla.com
http://www.ASPFAQs.com
http://www.ASPMessageboard.com

* When you think ASP, think 4GuysFromRolla.com!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top