[Initial Page]

TPN Live - SOAP to get a depot covering a postcode

 The SOAP method to extract this data is as follows. Site URL on request.

This gives a depot code that relates to the input postcode.

GetDepotFromPostcode

SOAP 1.1

The following is a sample SOAP 1.1 request and response. The placeholders shown need to be replaced with actual values.

POST /TPNImportExport/Service.asmx HTTP/1.1
Host: poseidon
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "TPNImportExport/GetDepotFromPostcode"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetDepotFromPostcode xmlns="TPNImportExport">
      <inputPostcode>string</inputPostcode>
    </GetDepotFromPostcode>
  </soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetDepotFromPostcodeResponse xmlns="TPNImportExport">
      <GetDepotFromPostcodeResult>int</GetDepotFromPostcodeResult>
    </GetDepotFromPostcodeResponse>
  </soap:Body>
</soap:Envelope>

SOAP 1.2

The following is a sample SOAP 1.2 request and response. The placeholders shown need to be replaced with actual values.

POST /TPNImportExport/Service.asmx HTTP/1.1
Host: poseidon
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <GetDepotFromPostcode xmlns="TPNImportExport">
      <inputPostcode>string</inputPostcode>
    </GetDepotFromPostcode>
  </soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <GetDepotFromPostcodeResponse xmlns="TPNImportExport">
      <GetDepotFromPostcodeResult>int</GetDepotFromPostcodeResult>
    </GetDepotFromPostcodeResponse>
  </soap12:Body>
</soap12:Envelope>

Example result using LN6 3QN -

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body>
<GetDepotFromPostcodeResponse xmlns="TPNImportExport"><GetDepotFromPostcodeResult>86</GetDepotFromPostcodeResult>
</GetDepotFromPostcodeResponse></soap:Body></soap:Envelope>

Code Example (Windev)

SOAP.Value[1] = postcode
SOAP.Name[1] = "inputPostcode"
SOAP.Type[1] = SOAPStringType
IF SOAPRun(sitetouse, "GetDepotFromPostcode","TPNImportExport","TPNImportExport/GetDepotFromPostcode","utf-8") THEN
mysoapresult = SOAPGetResult(SOAPXMLResult)

A test application to demonstrate this function is HERE - copyright ZiPZAP Computers Limited (c) 2010