passing parameters to webservice in ASP.NET

  • Steven in Montreal,Canada

    Fix the problem that nuSOAP in PHP can not pass parameters to Webservices in ASP.NET 

    I have been fighting this problem for a couple
    of hours, and finally we found out what the
    problem was.

    We have a WEB service built on a ASP.NET
    platform and when I called a helloworld
    example (no arguments) the other side would
    reply as it should.
    But when I tried to access getTime( year,
    month., day ), i.e. with arguments, then it

    The reason I am not sure of but the solution
    was to put the methods with arguments in RPC
    format (encoding).

    Hope this will help someone.

    ***********How exactly did you do that?

    I was also facing the same problem. Finally
    figured out the work around which works.

    $s = new soapclient
    WSDL', 'wsdl');
    $s->setDefaultRpcParams(true);  // This fixed
    the problem
    $parameters['id'] = 100;
    $soap_proxy = $s->getProxy();

    $result = $soap_proxy->GetCustomer
    if (!$err = $soap_proxy->getError()){
        echo 'Result: ' . $result . "\n";
        echo 'Error: ' . $err . "\n";

    Hope this helps.

    • Cenk Uysal

      Cenk Uysal - 2006-01-25

      The problem occurs because .Net constructs a WSDL where all parameters are ComplexType.

      So you have to use Proxy for method calls:

      $wsdl_url = 'http://localhost/TIM/authUser.asmx?WSDL';
      $parameters = array('user' => 'myuser',
                              'pass' => 'mypass');

      $soap_client = new soapclient($wsdl_url,"wsdl");

      $proxy = $soap_client->getProxy();

      $results = $proxy->getUserData($parameters);       


      • Emin Kuscu

        Emin Kuscu - 2008-08-14

        Thanks Cenk,
        Your post helped me , at least gave me some idea.
        as a result it should be this way. i mean it worked for me.

        my php code is in apache server,
        my server is in server,
        the project was provided by

        $wsdl_url = '';
        $soap_client = new nusoap_client($wsdl_url, 'wsdl');
        $req = array( 'SearchRequest' => array(
            'UserParam' => null,
            'HitsFrom' => 0,
            'HitsTo' => 0,
            'HitElems' => "All",
            'SearchFields' => null,
            'Text' => "your search keys"
        $results = $soap_client->call('Search', $req, '', '', false);
        //the name space and soapaction should not be my domain or any other sub, it should be the domain whoever provides namespace and so

    • Neelesh

      Neelesh - 2006-05-09

      Hi all,

      I have a similar problem accessing .NET webservices using nusoap, but the solution above also does not work.
      It displays an error when executed:

      <br />
      <b>Parse error</b>:  parse error, unexpected T_STRING in <b>/var/www/html/phpProjects/test/includes/nusoap.php(6983) : eval()'d code</b> on line <b>1</b><br />
      <br />
      <b>Fatal error</b>:  Cannot instantiate non-existent class:  soap_proxy_1720798404 in <b>/var/www/html/phpProjects/test/includes/nusoap.php(6985) : eval()'d code</b> on line <b>1</b><br />


      • Neelesh

        Neelesh - 2006-05-09

        -- to add above

        can any one help me where i am going wrong?


        The error more clear here is:
        Parse error: parse error, unexpected T_STRING in /var/www/html/phpProjects/test/includes/nusoap.php(6983) : eval()'d code on line 1

        Fatal error: Cannot instantiate non-existent class: soap_proxy_1720798404 in /var/www/html/phpProjects/test/includes/nusoap.php(6985) : eval()'d code on line 1

        • ctrlaltdl

          ctrlaltdl - 2006-06-22

          I'm having the same exact error as you.

          If I put "echo $evalStr;" in line 6981 in the getProxy() function it tells me:
          "A proxy can only be created for a WSDL client"

          I haven't figured out a solution to this problem, but I'll be sure to share it if I do.

          Anyone else have this problem or know a solution to it???

          • ctrlaltdl

            ctrlaltdl - 2006-06-26

            Ok, I figured it out.  I had to add some parameters to the soapclient->call:

            $objSoapClient->call('HelloWorld', array('myName' => 'Joe'), '', '', true, null, 'rpc', 'literal');


Log in to post a comment.

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

Sign up for the SourceForge newsletter:

No, thanks