473,326 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

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

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
2 3500
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Chris Leffer | last post by:
Hi. I created a web service with two overloaded methods, and used the MessageName attribute to differentiate them: <WebMethod(MessageName:="GetItemString")> _ Public Function GetItem(ByVal...
2
by: Doug | last post by:
Hello, For a long time we've been told that you can't overload web service calls but recently we found a way to do it using the WebMethod attribute as in the example below. This will allow us as...
10
by: john bailo | last post by:
Can a web method be overloaded? To support varying numbers of input parameters?
12
by: Noel | last post by:
Hello, I'm currently developing a web service that retrieves data from an employee table. I would like to send and retrieve a custom employee class to/from the webservice. I have currently coded...
1
by: Simon Hart | last post by:
Hi, I thought I'd just open a thread in an attempt to get peoples feelers with regards to multithreading vs Async Web Service processing. Of course Web Services makes it easy to do Async...
0
by: goteti | last post by:
Hello, I have a method with these attributes: public GetCardsResponse GetCards(GetCardsRequest getCardsRequest) {
0
by: urban011 | last post by:
I need to use XmlInclude to generate a description in the wsdl for a subtype for a given web method. I alos need to include the SoapRpcMethod directive and the use=literal attribute in order to...
1
by: Glenn | last post by:
I am writing a Web Service in C# ASP.NET 2.0 that takes two optional parameters. One is an int and the other is a string. Below is the definition of the Web Method: public...
4
by: bwrobo | last post by:
I've had a good run of help on this site when I get to an issue I struggle to think through. I have set-up a database through ASP that allows the site's owner to login into an Admin section and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.