Posted by David Haynes on 02/14/06 14:08
frustratedcoder wrote:
> 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
> ->uri("urn:WebServices")
> ->proxy("http://example.com")
> ->SomeMethodName('param1', 'param2')
> ->result;
>
> How can this be translated in to something that is easily used in PHP5?
>
> There is no wsdl file describing the web service above.
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' => 'http://example.com/?WebServices',
'uri' => 'http://example.com/'
);
Then you can call the methods as:
$client->SomeMethodName(array('param1', 'param2'));
Don't forget to set try-catch blocks to handle exceptions.
-david-
[Back to original message]
|