Oak Harbor Web Services

Image Request Information documentation and example
Explanation
The getImages() web service provides you with the ability to request and receive images pertaining to a specified Pro Number, by document type.
You can use the WSDL located at HTTP://www.oakh.com/services/soap?wsdl as the basis for programming or configuring your own SOAP client.

Below is a PHP example of a SOAP client configuration that can access this web service.  This is provided as an example only and only intended to guide you on how you may want to go about creating your own client to get data from our web service.
$soapClient = new SoapClient("http://www.oakh.com/services/soap?wsdl"); $ImagesRequest = array( 'account' => 'The account email associated with your key', 'key' => 'The key provided to you by Oak Harbor Freight', 'ProNumber' =>'12345678', 'DocumentType' => 'DR', 'ImageFormat' => 'TIFF' ); $result = $soapClient->getImages($ImagesRequest);
As the code example shows, you will call the getImages(ImagesRequest) method with the input parameter being a structure conforming to the ImagesRequest definition from the WSDL and containing all of the pertinent information regarding your request. If an invalid ProNumber or DocumentType is requested or if any other error exists, a standard Soap Fault will be returned. The response data is as follows: type (2 character) date (mm/dd/yy) imageFormat (3-4 character) fileName (15-16 characters) base64 (variable length string) The type value will be one of the following values: RW = ReWeigh Certificate DR = Delivery Receipt ( same as POD/Proof-Of-Delivery) BL = Bill Of Lading The imageFormat value will be one of the following values: TIFF PDF JPEG PNG *** The 'base64' value of the response data will contain the base64-encoded image data. To save this image data on your own system as a file, you will need to base64-decode the value and save the resulting value as a file with the appropriate extension matching the imageFormat. An example of how to do this in PHP is as follows:
$fileData = base64_decode($result['base64']); $filename = /myImages/{$result[fileName]}; file_put_contents($filename, $fileData);
Below is an example of a well-formed image request with a successful result.

Request Header
POST /services/soap HTTP/1.1
Host: www.oakh.com
Connection: Keep-Alive
User-Agent: PHP-SOAP/5.3.8-ZS5.5.0
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://www.oakh.com/services/soap#getImages"
Content-Length: 577

Request Data
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.oakh.com/services/soap?wsdl">
	<SOAP-ENV:Body>
		<ns1:getImages>
			<ImagesRequest>
				<account>##YOUR ACCOUNT EMAIL##</account>
				<key>##YOUR ACCOUNT KEY##</key>
				<ProNumber>12345678</ProNumber>
				<DocumentType>DR</DocumentType>
				<ImageFormat>TIFF</ImageFormat>
			</ImagesRequest>
		</ns1:getImages>
	</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Response Header
HTTP/1.1 200 OK
Date: Sat, 15 Jun 2013 05:13:25 GMT
Server: Apache
Content-Length: 662163
Connection: close
Content-Type: text/xml

Response Data
<<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.oakh.com/services/soap?wsdl">
	<SOAP-ENV:Body>
		<ns1:getImagesResponse>
			<getImagesResponse>
				<type>RW</type>
				<date>5/02/13</date>
				<imageFormat>TIFF</imageFormat>
				<fileName>12345678_RW.TIFF</fileName>
				<base64>## BASE64 ENCODED IMAGE DATA ##</base64>
			</getImagesResponse>
		</ns1:getImagesResponse>
	</SOAP-ENV:Body>
</SOAP-ENV:Envelope>