note 110031 deleted from book.soap by danbrown
| From: | danbrown@php.net | Date: | Thu, 13 Sep 2012 15:24:52 +0000 |
| Subject: | note 110031 deleted from book.soap by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-190718@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
I am having a problem figuring out how to encapsulate messages for transmission, I think the issue
is that the server is requiring a nested object inside of the request that gives authentication
details, but I cannot figure out how to adapt the code above to make this nested object go over
using SoapVar... here is my original code.. if someone can show me how to do this using SoapVar or
SoapParam I would be very appreciative:
<?php
// SET PARAMETERS
...
//CREATE OBJECT FOR SOAP TRANSMISSION
$authInfo = array(
'username' => (string)$username,
'password' => (string)$password,
'appKey' => (string)$appkey,
'version' => (string)$version);
$proxRequest = array(
'lat' => (float)$lat,
'lon' => (float)$lon,
'range' => (float)$range,
'unit' => (string)$unit,
'authInfo' => $authInfo);
// PERFORM SOAP REQUEST
$wsdURL = "http://xxxxxxxxxxxx.com/soap?wsdl&v=".$version
$client = new SoapClient($wsdURL, array('trace' => true));
$result = $client->fccGetProxCallsigns($proxRequest);
// DEBUG: display the XML sent from the request, along with the resulting object returned by the
server.
// NOTE: Code never makes it this far, authentication failure when the actual query is made causes
PHP script to crash in the above line... receiving server claims no authentication data was sent.
However there is no error when creating the SoapClient and reading the description file.
echo "REQUEST:\n" . htmlentities($client->__getLastRequest()) . "\n";
var_dump($result);
?>
here is the original xsd description:
<message name="fccGetProxCallsignsRequest">
<part name="lat" type="xsd:decimal"/>
<part name="lon" type="xsd:decimal"/>
<part name="range" type="xsd:decimal"/>
<part name="unit" type="xsd:string"/>
<part name="authInfo" type="tns:authInfo"/>
</message>
<xsd:complexType name="authInfo">
<xsd:all>
<xsd:element name="username" type="xsd:string"/>
<xsd:element name="password" type="xsd:string"/>
<xsd:element name="appKey" type="xsd:string"/>
</xsd:all>
</xsd:complexType>