By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,987 Members | 1,607 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,987 IT Pros & Developers. It's quick & easy.

using the [WebMethod(MessageName="...")] attribute

P: n/a
Hi,

I have discovered that if I use this syntax:

[WebMethod(MessageName="foo")]
public string bar() {
return "hello, world";
}

then it is not possible to call the web service using the MS soap toolkit.
Trying to invoke the service with either the name foo or bar gives an error.

I'm afraid I'm not much of an expert on SOAP and WSDL (I was rather hoping
that using 2 microsoft implementations of the same standard would give me a
good chance of interoperability without having to delve into the innards of
the standard)

Could someone explain whether this is a deficiency in the SOAP toolkit, or
is this feature (the ability to have the operation name different from the
SOAP action) an unofficial .Net extension of the web services standards?

TIA

Andy
Mar 16 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi Andy,

All that changes is the name of the element that wraps the parameters
(none in your case) and the SOAP Action header.

Without MessageName:

POST /Temp/AspNet20SandPit/Service.asmx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/bar"

<?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>
<bar xmlns="http://tempuri.org/" />
</soap:Body>
</soap:Envelope>

With MessageName="foo":

POST /Temp/AspNet20SandPit/Service.asmx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/foo"

<?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>
<foo xmlns="http://tempuri.org/" />
</soap:Body>
</soap:Envelope>

It's been a while since I've used the Soap Toolkit but from memory this
should be pretty easy to do. Maybe you can post a snippet of how you're
creating the soap toolkit message.

Josh
http://www.thejoyofcode.com/

Mar 16 '06 #2

P: n/a
Josh Twist wrote:
<snip>

It's been a while since I've used the Soap Toolkit but from memory this
should be pretty easy to do. Maybe you can post a snippet of how you're
creating the soap toolkit message.


well, I'm calling it from VB, so my code just looks like this:

Dim Connection As new SoapClient30
Connection.MSSoapInit wsdlFile
Connection.foo
Connection.bar

this works by the MSSOAP dynamically creating a IDispatch interface
when the WSDL file is parsed. I guess what you're saying is that I have
to hook in at a lower level to impact the XML that gets sent?

Mar 16 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.