Thursday, November 1, 2012

SOAP

SOAP

There are two SOAP toolkits in common use on PHP. One is called NuSOAP. This works fairly well, but is no longer in active development (it was written before PHP provided its own built-in SOAP class). If you want to use NuSOAP, here is the official project web site



If you're using PHP5.2 or 5.3 (which you should be, since they're the only currently supported versions), then you'll have a built-in SOAP class. If you want to use the official PHP SOAP class, here's the manual page: http://php.net/manual/en/book.soap.php



If the service you're dealing with has a WSDL, PHP will automatically generate the appropriate methods for you when you create the object. For example:


$client = new SoapClient("http://somedomain/stockquote.wsdl");
print($client->getStockQuote("MSFT"));



$client = new SoapClient(null, array('location' => "http://somedomain/stockquote.asp"));
print($client->__soapCall('getStockQuote',"MSFT"));

No comments:

Post a Comment