We are developing using PHP and nusoap. The wsdl file we are reading
has a line such as <xs:extension base="ac:Request">
So here is the answer we need:
- Generate a request (using nusoap preferrably) that includes the
elements of Request.
We need a request that looks like this:
---- BEGIN GOOD EXAMPLE ---
<feeLookupRequest xmlns="http://www.moneygram.com/AgentConnect40">
<unitProfileID>11111</unitProfileID>
<agentID>1234567</agentID>
<agentSequence>1</agentSequence>
<token>123TOKEN456</token>
<timeStamp>2006-01-30T22:29:20Z</timeStamp>
<apiVersion>1</apiVersion>
<clientSoftwareVersion>1</clientSoftwareVersion>
<productType>SEND</productType>
<receiveAmount>555</receiveAmount>
<receiveCountry>USA</receiveCountry>
<deliveryOption>OTHER</deliveryOption>
</feeLookupRequest>
---- END GOOD EXAMPLE ---
NOT LIKE THIS:
---- BEGIN BAD EXAMPLE ---
<feeLookupRequest xmlns="http://www.moneygram.com/AgentConnect40">
<productType>SEND</productType>
<receiveAmount>555</receiveAmount>
<receiveCountry>USA</receiveCountry>
<deliveryOption>OTHER</deliveryOption>
</feeLookupRequest>
---- END BAD EXAMPLE ---
And
$client = new
soapclient('https://tws.moneygram.com/extws/AgentConnect40.NET.wsdl' , 'wsdl');
-- BEGIN CODE --
<?php
require_once('lib/nusoap.php');
$client = new
soapclient('https://tws.moneygram.com/extws/AgentConnect40.NET.wsdl' ,
'wsdl'); $err = $client->getError(); if ($err) { echo '<h2>Constructor
error</h2><pre>' . $err . '</pre>'; }
$the_gm_date = gmdate("Y-m-d\TH:i:s\Z"); $request = array(
'unitProfileID' => 11111
, 'agentID' => 1234567
, 'agentSequence' => 1
, 'token' => '123TOKEN123'
, 'timeStamp' => $the_gm_date
, 'apiVersion' => 1
, 'clientSoftwareVersion' => 1
);
$param = array(
'productType' => 'SEND'
, 'receiveAmount' => '999'
, 'receiveCountry' => 'USA'
, 'deliveryOption' => 'OTHER'
);
## FILL IN THE_BLANK (not using a scalar (string) see below) $result =
$client->call('feeLookup', THE_BLANK);
echo '<h2>Request</h2>';
echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
/* This hack does work, but is not 'proper'
* $string = '';
* $string .= '<feeLookupRequest
xmlns="http://www.moneygram.com/AgentConnect40">';
* foreach ($param as $key => $value) { $string .= "<$key>$value</$key>\n"; }
* $string .= '</feeLookupRequest>';
* $result = $client->call('feeLookup',$string);
*/
-- END CODE -- |