Hello, I need help constructing a SOAP client in PHP.
I work for a small company that is trying to do EDI (electronic data interchange) with a large company (United Stationers Supply Co. – or USSCO for short). USSCO is using a SOAP server to receive Purchase Orders that we need to send. USSCO is using an XML format for the data that is supposedly a subset of the “OAGIS standard” whatever that is. “The OAGIS XML version used by USSCO for this transaction is v9.1” they say.
Here is an example soap request that works when I send it to USSCO using SOAPUI. (I get a valid response back.):
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pur="http://wsdl.ussco.com/PurchaseOrderInterface" xmlns:us="http://www.ussco.com/oagis/0" xmlns:oa="http://www.openapplications.org/oagis/9">
<soapenv:Body>
<pur:processPurchaseOrder>
<ProcessPurchaseOrder releaseID="1.0">
<us:ApplicationArea>
<oa:Sender>
<oa:LogicalID>AOSWare</oa:LogicalID>
</oa:Sender>
<us:ReceiverId>007981038</us:ReceiverId>
<oa:CreationDateTime>2010-08-24T12:02:01</oa:CreationDateTime>
<oa:BODID>00153</oa:BODID>
</us:ApplicationArea>
<us:DataArea>
<oa:Process>
<oa:ActionCriteria>
<oa:ChangeStatus>
<oa:Code>R</oa:Code>
</oa:ChangeStatus>
</oa:ActionCriteria>
</oa:Process>
<us:PurchaseOrder>
<us:PurchaseOrderHeader>
<oa:DocumentID>
<oa:ID>TEST151</oa:ID>
</oa:DocumentID>
<oa:AlternateDocumentID>
<oa:ID>1</oa:ID>
</oa:AlternateDocumentID>
<oa:DocumentDateTime>2010-08-24T12:01:01</oa:DocumentDateTime>
<oa:ShipToParty>
<oa:PartyIDs>
<oa:ID>000006</oa:ID>
</oa:PartyIDs>
<oa:Name>QBF</oa:Name>
<oa:Location>
<oa:Address type="D">
<oa:LineOne>710 Lakeway Dr</oa:LineOne>
<oa:LineTwo>Attn: Terrence James</oa:LineTwo>
<oa:CityName>Sunnyvale</oa:CityName>
<oa:CountrySubDivisionCode>CA</oa:CountrySubDivisionCode>
<oa:PostalCode>94085</oa:PostalCode>
</oa:Address>
<oa:Address type="ZipCodeOverride">
<oa:PostalCode>94085</oa:PostalCode>
</oa:Address>
</oa:Location>
</oa:ShipToParty>
<us:ShippingLabel>
<us:SpecialInstructions sequence="1">Special Instructions Line 1</us:SpecialInstructions>
<us:SpecialInstructions sequence="2">Special Instructions Line 2</us:SpecialInstructions>
<us:ShippingInstructions sequence="1">Shipping Instructions Line 1</us:ShippingInstructions>
<us:ShippingInstructions sequence="2">Shipping Instructions Line 2</us:ShippingInstructions>
<us:ShippingInstructions sequence="3">Shipping Instructions Line 3</us:ShippingInstructions>
<us:ShippingInstructions sequence="4">Shipping Instructions Line 4</us:ShippingInstructions>
<us:ShippingInstructions sequence="5">Shipping Instructions Line 5</us:ShippingInstructions>
<us:ShippingInstructions sequence="6">Shipping Instructions Line 6</us:ShippingInstructions>
<us:CustomerInstructions sequence="1">Dealer Instructions Line 1</us:CustomerInstructions>
<us:CustomerInstructions sequence="2">Dealer Instructions Line 2</us:CustomerInstructions>
<us:CustomerInstructions sequence="3">Dealer Instructions Line 3</us:CustomerInstructions>
<us:CustomerInstructions sequence="4">Dealer Instructions Line 4</us:CustomerInstructions>
<us:CustomerInstructions sequence="5">Dealer Instructions Line 5</us:CustomerInstructions>
<us:CustomerInstructions sequence="6">Dealer Instructions Line 6</us:CustomerInstructions>
</us:ShippingLabel>
<us:ShippingIndicator>true</us:ShippingIndicator>
<us:DealerRouteCode>UPSGRND</us:DealerRouteCode>
<us:RejectDuplicateIndicator>true</us:RejectDuplicateIndicator>
</us:PurchaseOrderHeader>
<us:PurchaseOrderLine>
<us:Item>
<oa:ItemID>
<oa:ID>HEWC4847A</oa:ID>
</oa:ItemID>
</us:Item>
<oa:Quantity unitCode="ea">1</oa:Quantity>
<oa:UnitPrice>
<oa:Amount currencyID="USD">112.75</oa:Amount>
<oa:PerQuantity>1</oa:PerQuantity>
</oa:UnitPrice>
<us:ADOTCode>Y</us:ADOTCode>
<us:ItemList>
<us:ListAmount currencyID="USD">170.89</us:ListAmount>
</us:ItemList>
<us:PackingSlip>
<us:LineText sequence="1">Line Text</us:LineText>
<us:LineText sequence="2">Line Text</us:LineText>
<us:LineText sequence="3">Line Text</us:LineText>
<us:LineText sequence="4">Line Text</us:LineText>
</us:PackingSlip>
</us:PurchaseOrderLine>
</us:PurchaseOrder>
</us:DataArea>
</ProcessPurchaseOrder>
</pur:processPurchaseOrder>
</soapenv:Body>
</soapenv:Envelope>
I have written the following PHP, which works up to the point it is written to:
[php]
$opt = array();
$opt[‘login’] = ‘’;
$opt[‘password’] = '’;
$test_system_wsdl_url = “http://ppd2-wsdl.ussco.com/xmlo/001/PurchaseOrderWebService.wsdl”;
$client = new SoapClient($test_system_wsdl_url, $opt);
[/php]
This code successfully connects to USSCO. But I have no Idea how to construct the data structure that should be used as the parameter when calling the SOAP Action ProcessPurchaseOrder:
[php]
$client->ProcessPurchaseOrder(…)
[/php]
Any help would be greatly appreciated.
Also, if anyone is willing to write out the entire code, please leave a price quote and contact info, and I’ll pass it along to my boss. (flat-fee quotes highly preferable to per-hour quotes). I can provide the full documentation file that USSCO provided to me, and a folder full of .xsd files they provided me, which I don’t know what, if anything, to do with.