Latest News

the latest news from our team

Printing Shipping Labels from a Web Service (DRAFT)

A growing number of shippers let you send SOAP or other types of web service requests to create a shipment. The response from a request can, if the shipper supports it, include the shipping label. This post shows how to get a base-64 encoded shipping label from a web response and put it on a form. You should be familiar with SOAP requests and XML to follow along. This example uses FedEx, but other shippers offer similar services. The example includes the following steps:

  1. Get FedEx credentials for testing on their server.
  2. Create a SSL certificate.
  3. Create an XML file to use as your web request template.
  4. In an eFORMz project file, populate data fields in the template and submit the web request.
  5. In the same project file, receive the data from the web request.

Get FedEx credentials

  1. Apply for a developer ID at http://www.fedex.com/us/developer/web-services/index.html. You do not write any code with eFORMz, so the downloads are unnecessary.
  2. Click the Develop and Test tab in the FedEx Developer site. Click the button Get your test key.
  3. Complete the form and click Continue, read the License Authorization, and click I Accept.
  4. Copy your Developer Test Key and the other data on the page. Additional information is sent to the email address that you provided. Record it all in a secure location.

Create a SSL certificate

This step is covered in http://support.minisoft.com/index.php/ssl-configure/. Use the server name that FedEx sent in the email message. If you use a different web service provider, you use the server name that provides the web services.

Create an XML file as your web request template

You can see an example process shipment request at https://www.fedex.com/us/developer/WebHelp/ws/2015/html/WebServicesHelp/WSDVG/11_Ship_Service.htm. The sample included with the files, which are linked to below, contains a template that is current with FedEx’s specifications as of the publication of this post.

The template includes some values that contain XXXXXXXXXX. Replace this value with your own values for credentials, address, phone number, and other data.

Populate your template’s data

eFORMz replaces strings that begin and end with %% with values that are retrieved from the database. These values, such as %%ShipTimestamp%%, have no special meaning in themselves. The project has variables that search for these values and replace them with values from the database. After these values are replaced, the request is sent to the server.

(Placeholder: How to send the request.)

Receive data from the web request

You make the web service request with a Web Service procedure. The response from the request is stored in the variable that you specify in the procedure as the Response Data. This example uses the variable WebResponse. An XML file is returned, and the entire file is stored in this variable. Complete the following steps to get the shipping label from the file, load it in a component, and show it in a form:

  1. Open the eFORMz project that makes a web service request. Identify the variable that stores the web response and the response results.
  2. Create a Load Variable from XML Node procedure.
  3. In the Procedure Properties window, name the procedure, select the variable that contains the response, and click OK.
  4. In the Load from XML window…(much more coming soon)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

code