PHP5 consume web service without wsdl

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I need to consume a web service written in Perl but there is no wsdl
file for this service.
The perl soap client that can call and consume this web service looks
like this (if it helps)

#!perl -w

use SOAP::Lite +trace => "debug";

print SOAP::Lite
 ->proxy(" ")
 ->SomeMethodName('param1', 'param2')

How can this be translated in to something that is easily used in PHP5?

There is no wsdl file describing the web service above.

Re: PHP5 consume web service without wsdl

frustratedcoder wrote:
Quoted text here. Click to load it

I'm going to assume that you are using the built-in SOAP library (as  
opposed to PEAR or nuSOAP). I'm also going to assume PHP5 and an  
object-oriented approach.

To instantiate a new SOAP client:

$client = new SoapClient(null, $args);

The null indicates that there is no WSDL for this client.

The args will be something like:
$args = array(
    'soap_version' => SOAP_1_1,
    'location' => ' ',
    'uri' => ' /'

Then you can call the methods as:

$client->SomeMethodName(array('param1', 'param2'));

Don't forget to set try-catch blocks to handle exceptions.


Re: PHP5 consume web service without wsdl

This was exactly the example I was looking for, thanks.

Re: PHP5 consume web service without wsdl

Now I have the access to the web service, but all Im getting is
"PCFET0NUWVBFIFN0ZXBTdG9uZUVhc3lDcnVpdENh"? when I run the client
written in Perl I get a string of xml in return.

Site Timeline