[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.webservices

Re: Cannot pass primitive type parameters to ASP.NET web service

nmvg100

8/13/2003 4:00:00 PM

Hi,

I have found the solution to my problem. I simply needed to add the
SOAPRpcMethod attribute to my web method as follows:

<SoapRpcMethod(), _
WebMethod(Description:="say hello!")> _
Public Function say_hello(ByVal a_name As String) As String
Return "Hello " & a_name & "!"
End Function

NAT

nmvg100@yahoo.com (NAT) wrote in message news:<c6e81494.0308110342.49c7ac55@posting.google.com>...
> Hi,
>
> I am trying to consume an ASP.NET web service with a Mac Applescript.
> Here is the very simple SOAP request:
>
> POST /zen_web_service2/service1.asmx HTTP/1.0
> User-Agent: Mac OS X; WebServicesCore.framework (1.0.1)
> Host: [host]
> Content-Type: text/xml
> Soapaction: "http://tempuri.org...
> Content-Length: 497
> Connection: close
>
> <?xml version="1.0" encoding="UTF-8"?>
> <SOAP-ENV:Envelope xmlns:xsd="http://www.w3.org/1999/XMLSc...
> xmlns:xsi="http://www.w3.org/1999/XMLSchema-inst...
> SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encod...
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envel...
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encod...>
>
> <SOAP-ENV:Body>
> <m:add xmlns:m="urn:trident-web-services">
> <a xsi:type="xsd:int">4</a>
> <b xsi:type="xsd:int">2</b>
> </m:add>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
>
> And here is the ASP.NET web method:
>
> <WebMethod()>
> Public Function add(ByVal a As Integer, ByVal b As Integer) As Integer
> Return a + b
> End Function
>
> ASP.NET seems to miss out the parameters all together and returns 0
> instead of 6.
> However (using Telnet to manually build the SOAP request) if I change
> the SOAP request from:
>
> ...
> <m:add xmlns:m="urn:trident-web-services">
> <a xsi:type="xsd:int">4</a>
> <b xsi:type="xsd:int">2</b>
> </m:add>
> ...
>
> to:
>
> ...
> <m:add xmlns:m="urn:trident-web-services">
> <m:a xsi:type="xsd:int">4</a>
> <m:b xsi:type="xsd:int">2</b>
> </m:add>
> ...
>
> OR:
>
> ...
> <add xmlns="urn:trident-web-services">
> <a xsi:type="xsd:int">4</a>
> <b xsi:type="xsd:int">2</b>
> </add>
> ...
>
> then it works fine and returns 6 as expected!
>
> Can anyone tell why on earth ASP.NET does not like this:
> ...
> <m:add xmlns:m="urn:trident-web-services">
> <a xsi:type="xsd:int">4</a>
> <b xsi:type="xsd:int">2</b>
> </m:add>
> ...
>
> which is in accordance with W3C SOAP 1.1 specification?
>
> Many thanks in advance for your precious help.
>
> Nathaniel
>
> PS: I am using the .NET Framework 1.1