Menu

How to get list of WSDL functions?

Help
2009-07-28
2013-06-06
  • cometlinear

    cometlinear - 2009-07-28

    Greetings,

    Is there a method for listing functions, types and parameters which are used by a WSDL service?

    I know the standard PHP SOAP library has getFunctions(). What does nusoap use?

    Thank you!!! Kindest regards,
    -joshua

     
    • Anonymous

      Anonymous - 2009-07-30

      Hey Joshua, I think I can help you.

      There  is a function you'll need to use to get the class variables and the functions dynamically created from a WSDL called getProxyClassCode(), this returns your functions and the code that makes them work.  After you instantiate your class you pass it to a new variable with the getProxy() method and via overloading it makes it into an object with your methods/functions available in the new variable.

      Printing your WSDL methods:
      require_once 'nusoap.php';
      $wsdl  = 'WSDL_FILE_PATH';
      $client = & new soap_client($wsdl,TRUE);
      //this method gets your dynamically created functions
      $proxy = $client->getProxyClassCode();
      print_r($proxy);

      when you want to run the correction function created by the wsdl replace like so

      $proxy = $client->getProxy();
      $retval = $proxy->[METHOD]($input);

      Alternately you can use this method which does not use overloading in case your PHP install doesn't support it:

      $proxy = $client->call('METHOD',$OPERATION);

       
      • paul

        paul - 2009-08-25

        Follow up question to this. Is there a way to instantiate objects from the proxy object? For example, I'm calling a WSDL that has a very detailed object structure that I can't seem to replicate free hand.

        So I'd like to see if I can call the proxy to create a dummy instance that I could review and understand how to manipulate it with the data I need to insert into it.

        I.e.

        $client = & new soap_client($wsdl,TRUE);
        $proxy = $client->getProxyClassCode();

        $local_version_of_insanely_complex_structure = new $proxy->insanely_complex_structure();

        Or something to that effect.

         
  • Anonymous

    Anonymous - 2009-09-14

    That feature isn't available but I feel your pain on that one.  I've had similar issues with recreating deep structured SOAP transactions and it takes a lot of trial and error sometimes to get it all right, the biggest help is learning how to read the WSDL file and create your own data structure to mimic it.  I have a polymorphic SOAP transaction I'm working on now that have that type of issue and it's difficult to debug but that's the nature of SOAP to begin with, however once it' s in place it rarely needs adjustment under most circumstances. I'm just thankful something like NuSOAP exists to assist wtih that.

     

Log in to post a comment.