This section describes a tutorial example on how to use PHP SOAP Extension client functions without WSDL.
I think we had enough fun with the WSDL mode. Let's try the non-WSDL mode now.
Here is the third version of my getTemp SOAP client program, GetTempNonWsdl.php:
<?php # GetTempNonWsdl.php
# Copyright (c) 2005 by Dr. Herong Yang
#
$zip = "123456";
$client = new SoapClient(null, array(
'location' =>
"http://services.xmethods.net:80/soap/servlet/rpcrouter",
'uri' => "urn:xmethods-Temperature-Demo",
'trace' => 1 ));
echo("\nDumping client object:\n");
var_dump($client);
$return = $client->__soapCall("getTemp",array($zip));
echo("\nReturning value of __soapCall() call: ".$return);
echo("\nDumping request headers:\n"
.$client->__getLastRequestHeaders());
echo("\nDumping request:\n".$client->__getLastRequest());
echo("\nDumping response headers:\n"
.$client->__getLastResponseHeaders());
echo("\nDumping response:\n".$client->__getLastResponse());
?>
My GetTempNonWsdl.php works the same as the WSDL mode version.
If you compare this output with the WSDL output, SOAP Extension generates
the request headers with one difference: SOAPAction is not blank any more.
It has the value of "urn:xmethods-Temperature-Demo#getTemp".
SOAP Extension also generates the request message differently in non-WSDL mode.
The input parameter is provided with an element named as "param0". In the WSDL
version, that element is named as "zipcode".