Problem passing parameters to .net Webservice

  • jakmcsuede

    jakmcsuede - 2004-10-01

    I created an web service and I am trying to consume this web service using nusoap.  I can connect to the web service fine if it does not take parameters and I get the proper return value.  However, the problem is when I try to call a web service that takes, for example, a string parameter. 

    The web service looks like this:

    <WebMethod()> _
    Public Function HelloWorld(ByVal name As String) As String
            Return "Hello " & name
    End Function

    The call looks like:
    $soapclient = new soapclient("http://localhost/WebService1/Service1.asmx?wsdl","wsdl");
    $parameters = array("Jim");

    When I debug the webservice the variable name in the HelloWorld function is "nothing". 

    What am I doing wrong.  Is it on the web service side or am I not calling the function right?  I have also tried:
    $parameters = array("name" => "Jim");

    • <-- R O B-->

      <-- R O B--> - 2004-10-01


      It may be that your server is running in doc/lit mode - where as the nusoap client defaults to rpc/enc (dont I know - see my last couple of posts :()


      try this

      $msg = '<name>Jim</name>';
      $Method = 'Helloworld';

      $client = new soapclient($wsdl_file, true);

      $err = $client->getError();
      if ($err) {
          echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';

      $result = $client->call($Method, $msg, '', '', false, null, 'document', 'literal');

      if ($client->getError() != "") {
          echo "Client Error = " . $client->getError() . "<br>";

      print 'RESULT:<xmp>';
      print '</xmp>';

      hope that works for you!

      Rob C

      • jakmcsuede

        jakmcsuede - 2004-10-13

        That did not work I tried what you said.  Is there any way to set the server to run in rpc/enc?


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks