HTTP POST and GET for a method with arguments by reference

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • joris.spriet@gmail.com

    HTTP POST and GET for a method with arguments by reference

    Hi all,

    I did implemented the following little web service in .NET 2.0:

    [WebService(Name space = "http://tempuri.org/")]
    [WebServiceBindi ng(ConformsTo = WsiProfiles.Bas icProfile1_1)]
    [ToolboxItem(fal se)]
    public class Service1 : System.Web.Serv ices.WebService
    {

    [WebMethod]
    public string HelloWorld()
    {
    return "Hello World";

    }

    [WebMethod]
    public void HelloWorld2(ref string answer)
    {
    answer = "Hello World";
    }
    }

    When I then use a browser to get details on the web methods,
    apparently I can call HelloWorld using HTTP POST or HTTP GET, but not
    HelloWorld2. In fact, when I do try to do it, I get:

    HTTP/1.1 500 Internal Server Error
    Server: ASP.NET Development Server/8.0.0.0
    Date: Wed, 29 Oct 2008 01:24:03 GMT
    X-AspNet-Version: 2.0.50727
    Cache-Control: private
    Content-Type: text/plain; charset=utf-8
    Content-Length: 461
    Connection: Close
    System.InvalidO perationExcepti on: HelloWorld2 Web Service method name
    is not valid.
    at System.Web.Serv ices.Protocols. HttpServerProto col.Initialize( )
    at System.Web.Serv ices.Protocols. ServerProtocol. SetContext(Type
    type, HttpContext context, HttpRequest request, HttpResponse response)
    at System.Web.Serv ices.Protocols. ServerProtocolF actory.Create(T ype
    type, HttpContext context, HttpRequest request, HttpResponse response,
    Boolean& abortProcessing )

    Is there an explanation for this ?

    Thanks in advance for your answers.

    Joris Spriet
  • joris.spriet@gmail.com

    #2
    Re: HTTP POST and GET for a method with arguments by reference

    Ok, found it in the MSDN documentation.



    HTTP POST and GET are only supported for arguments of so called
    "primitive types", and only if the they are passed by value.

    Something to remember.

    Thx

    Joris Spriet

    Comment

    Working...