You are here: Re: PHP5 consume web service without wsdl « PHP Programming Language « IT news, forums, messages
Re: PHP5 consume web service without wsdl

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-

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация