I am attempting to create a UPS Freight Rating Web Service using PHP and SOAP. UPS provides a WSDL for the SOAP Client (the important part of which I've pasted below).
My question is, how do I construct the XML document to send using the SOAP Client? I have seen conflicting reports on whether or not to format my request as a PHP Array or a giant string. Once this document is constructed, how should the request be made through the SOAP Client I've created in PHP?
Portion of the WSDL:
<wsdl:binding name="FreightRateBinding" type="tns:FreightRatePortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="ProcessFreightRate">
<soap:operation soapAction="http://onlinetools.ups.com/webservices/FreightRateBinding/v1.0" style="document"/>
<wsdl:input name="RateRequest">
<soap:body parts="Body" use="literal"/>
<soap:header message="tns:RateRequestMessage" part="UPSSecurity" use="literal">
<soap:headerfault message="tns:RateErrorMessage" part="RateError" use="literal"/>
</soap:header>
</wsdl:input>
<wsdl:output name="RateResponse">
<soap:body parts="Body" use="literal"/>
</wsdl:output>
<wsdl:fault name="RateError">
<soap:fault name="RateError" use="literal"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
Portion of my XML Document, so far:
<?xml version="1.0" ?>
<FreightRateRequest>
<Request>
<RequestOption>1</RequestOption>
</Request>
<ShipFrom>
<Address>
<Name>Test</Name>
<AddressLine1>17 MacDade Blvd</AddressLine1>
<City>Collingdale</City>
<PostalCode>19023</PostalCode>
<CountryCode>US</CountryCode>
<Phone>
<Number>1-800-249-0011</Number>
</Phone>
</Address>
</ShipFrom>
<ShipperNumber>21W17V</ShipperNumber>
<ShipTo>
<Name>Test</Name>
<AddressLine1>14908 Sandy Lane</AddressLine1>
<City>San Jose</City>
<PostalCode>95124</PostalCode>
<CountryCode>US</CountryCode>
</ShipTo>
PHP, so far:
$mySOAP = new SoapClient("FreightRate.wsdl", $myOptionsArray);
Any help would be greatly appreciated. I will also reply with any additional information, if needed.