all groups > dotnet web services > may 2006 >
You're in the

dotnet web services

group:

Authenticate SOAP Message only no GET OR POST



Authenticate SOAP Message only no GET OR POST bhu
5/25/2006 8:24:08 PM
dotnet web services: Hi
i need to write a webservice which will accept only soap message NO POST or
GET.
i can see this in WSE using RequestSoapContext.Current but we don;t want to
use WSE, is there way ?
Can any one post some link samples for this.


ALSO i see this type of message on some of the services
SOAP RPC Router
Sorry, I don't speak via HTTP GET- you have to use HTTP POST to talk to me.

How to do this?

thanks
bhu

Re: Authenticate SOAP Message only no GET OR POST Gaurav Vaish (EduJini.IN)
5/26/2006 12:00:00 AM
[quoted text, click to view]


Write an IHttpModule that will block all unwanted requests.


--
Happy Hacking,
Gaurav Vaish
http://www.mastergaurav.org
http://www.edujini.in
-------------------

RE: Authenticate SOAP Message only no GET OR POST Fabio
5/26/2006 8:39:02 AM
Hu Bhu,

ASP.NET generates information for HTTP GET and HTTP POST bindings unless it
is told not to. You can remove these bindings by editing the web.config file
and adding the following lines inside the /configuration/system.web element.

<webServices>
<protocols>
<remove name="HttpGet" />
<remove name="HttpPost" />
</protocols>
</webServices>


--
Fabio Scagliola
http://fabioscagliola.com


Re: Authenticate SOAP Message only no GET OR POST Fabio
5/27/2006 7:30:01 AM
[quoted text, click to view]

That will not prevent the web service to receive HTTP POST messages. SOAP
messages are HTTP POST messages indeed, but the content is different. See
samples below.

The following is a sample SOAP 1.1 request.

Message header:

POST /WebSite/AboutMe.asmx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: ...
SOAPAction: "http://fabioscagliola.com/webservices/GetMyFavoriteBook"

Message body:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetMyFavoriteBook xmlns="http://fabioscagliola.com/webservices/" />
</soap:Body>
</soap:Envelope>


The following is a sample HTTP POST request.

Message header:

POST /WebSite/AboutMe.asmx/GetMyFavoriteBook HTTP/1.1
Host: localhost
Content-Type: application/x-www-form-urlencoded
Content-Length: ...

Message body:

EMPTY


--
Fabio Scagliola
http://fabioscagliola.com


Re: Authenticate SOAP Message only no GET OR POST Gaurav Vaish (EduJini.IN)
5/27/2006 7:28:02 PM
Just wondering... if the HTTPPost from the WebService is removed, how will
it receive the SOAP-Requests?

or am I confused with something else?

--
Happy Hacking,
Gaurav Vaish
http://www.mastergaurav.org
http://www.edujini.in
-------------------


[quoted text, click to view]

Re: Authenticate SOAP Message only no GET OR POST Gaurav Vaish (EduJini.IN)
5/27/2006 11:59:52 PM
[quoted text, click to view]

Hmmm.... got it now. Thanks, Fabio.

But I think HttpPostLocalhost should be remove and not HttpPost... not sure.
Actually, I just looked into WebServiceProtocols enum and then back into
WebServicesSection... and found the following protocols:

1. Documentation
2. HttpPostLocation
3. HttpSoap (v1.1)
4. HttpSoap12 (v1.2)

To test, just do
System.Configuration.ConfigurationManager.GetSection("system.web/webServices")
and get the Protocols property of the WebServicesSection that you get.


--
Happy Hacking,
Gaurav Vaish
http://www.mastergaurav.org
http://www.edujini.in
-------------------

AddThis Social Bookmark Button