sponsored links

Collapse

Announcement

Collapse
No announcement yet.

Hermes Routing Web Service

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hermes Routing Web Service

    Hi All,

    We are a small software house in the UK and we have a requirement to interface to Hermes (carrier).

    Has anyone in the UK integrated from the iSeries to Hermes and could provide the code for us? The web site will be sending the information regarding the service and delivery dates etc. We need to pass the information to despatch the goods and produce labels etc.

    I have an attachment from Hermes, but I'm not able to load it.

    Thanks,
    Neil

  • #2
    I haven't done anything with Hermes, but are you trying to consume a web service? Is it XML or JSON?
    Your friends list is empty!

    Comment


    • #3
      Hi,

      It's XML and here is an example: -

      Sample Requests (Soap Detailed but REST version is same without the bold parts)

      Delivery to UK Customer:

      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v4="http://v4.web.domain.routing.hermes.co.uk/">
      <soapenv:Header/>
      <soapenv:Body>
      <v4:routeDeliveryCreatePreadvice>
      <deliveryRoutingRequest>
      <clientId>103</clientId>
      <clientName>Test Client</clientName>
      <batchNumber>1</batchNumber>
      <creationDate>2013-11-29T14:35:00</creationDate>
      <userId>hagdc33</userId>
      <sourceOfRequest>CLIENTWS</sourceOfRequest>
      <deliveryRoutingRequestEntries>
      <deliveryRoutingRequestEntry>
      <addressValidationRequired>?</addressValidationRequired>
      <customer>
      <address>
      <title>Mr</title>
      <firstName>Test</firstName>
      <lastName>Customer</lastName>
      <houseNo>1</houseNo>
      <streetName>Capitol Close</streetName>
      <countryCode>GB</countryCode>
      <postCode>LS27 0WH</postCode>
      <city>Leeds</city>
      <addressLine1>Morley</addressLine1>
      <region>West Yorkshire</region>
      </address>
      <homePhoneNo>123</homePhoneNo>
      <workPhoneNo>456</workPhoneNo>
      <mobilePhoneNo>789</mobilePhoneNo>
      <faxNo>012</faxNo>
      <email>si@si.com</email>
      <customerReference1>Ref1</customerReference1>
      <customerReference2>Ref2</customerReference2>
      <customerAlertType>2</customerAlertType>
      <customerAlertGroup>0001</customerAlertGroup>
      <deliveryMessage>Del Message</deliveryMessage>
      <specialInstruction1>Spec Inst 1</specialInstruction1>
      <specialInstruction2>Spec Inst 2</specialInstruction2>
      </customer>
      <parcel>
      <weight>1098</weight>
      <length>10</length>
      <width>10</width>
      <depth>10</depth>
      <girth>10</girth>
      <combinedDimension>10</combinedDimension>
      <volume>1000</volume>
      <currency>GBP</currency>
      <value>198</value>
      <numberOfParts>1</numberOfParts>
      <numberOfItems>1</numberOfItems>
      <description>Parcel Desc</description>
      <originOfParcel>GB</originOfParcel>
      </parcel>
      <services>
      <nextDay>true</nextDay>
      </services>
      <senderAddress>
      <addressLine1>Hermes UK</addressLine1>
      <addressLine2>Capitol Close</addressLine2>
      <addressLine3>Leeds</addressLine3>
      <addressLine4>LS27 0WH</addressLine4>
      </senderAddress>
      <expectedDespatchDate>2013-11-29T00:00:00</expectedDespatchDate>
      <countryOfOrigin>GB</countryOfOrigin>
      </deliveryRoutingRequestEntry>
      </deliveryRoutingRequestEntries>
      </deliveryRoutingRequest>
      </v4:routeDeliveryCreatePreadvice>
      </soapenv:Body>
      </soapenv:Envelope>

      HTH.

      Thanks,
      Neil

      Comment


      • #4
        You'll probably want to use XML-INTO in one fashion or another. Have you used that yet? You'll need to define data structures to match your XML document. I actually just did something similar. To me, the key is defining your data structure to match your XML. It's tedious, but once you get it right, XML-INTO is magic!

        The XML I get back has some prefixes with c: which I had to code as c_ . I'll have to find the XML-INTO reference I used for a lot of this. It was super helpful.

        Code:
             d soap_Body       ds                  qualified
             d                                     inz
             d   c_replyMessage...
             d                                     likeds(ds_replyMessage)
        
             d   ds_replyMessage...
             d                 ds                  qualified
             d   c_merchantReferenceCode...
             d                               50a   varying
             d   c_requestID...
             d                               50a   varying
             d   c_decision...
             d                               50a   varying
             d   c_reasonCode...
             d                               50a   varying
             d   c_paySubscriptionCreateReply...
             d                                     likeds(ds_paySubscriptionCreateReply)
             d   c_purchaseTotals...
             d                                     likeds(ds_purchaseTotals)
             d   c_ccAuthReply...
             d                                     likeds(ds_authReply)
             d   c_ccAuthReversalReply...
             d                                     likeds(ds_ccAuthReversalReply)
             d   c_missingField...
             d                               50a   dim(99)
        
             d  ds_paySubscriptionCreateReply...
             d                 ds                  qualified
             d   c_reasonCode...
             d                               50a   varying
             d   c_subscriptionId...
             d                               50a   varying
        
             d  ds_purchaseTotals...
             d                 ds                  qualified
             d   c_currency...
             d                               50a   varying
        
             d  ds_authReply...
             d                 ds                  qualified
             d   c_reasonCode...
             d                               50a   varying
             d   c_amount...
             d                               50a   varying
             d   c_authorizationCode...
             d                               50a   varying
             d   c_avsCode...
             d                               50a   varying
             d   c_avsCodeRaw...
             d                               50a   varying
             d   c_authorizedDateTime...
             d                               50a   varying
             d   c_processorResponse...
             d                               50a   varying
             d   c_reconciliationID...
             d                               50a   varying
             d   c_ownerMerchantID...
             d                               50a   varying
        
             d  ds_ccAuthReversalReply...
             d                 ds                  qualified
             d   c_reasonCode...
             d                               50a   varying
             d   c_amount...
             d                               50a   varying
             d   c_processorResponse...
             d                               50a   varying
             d   c_requestDateTime...
             d                               50a   varying

        I build a JSON request and then use systools.httpPostClob() to make the web service call.

        Code:
                   exec sql
                     select systools.httpPostClob(
                       :url,
                       :header,
                       cast(:requestData as clob(20k) ccsid 1208))
                     into :returnData
                     from sysibm.sysdummy1
                   ;

        And the parse the returnData. It looks like your path would be "soapenv:Body". I'm sure someone will yell at me about my options!



        Code:
              //********************************************************************//
               // Parse Response                                                     //
               //********************************************************************//
               begsr parseResponse;
        
                   options = 'doc=string +
                              path=soap_Envelope/soap_Body +
                              ns=merge +
                              case=any +
                              countprefix=num +
                              allowextra=yes +
                              allowmissing=yes'
                   ;
        
                   monitor;
                     xml-into soap_Body %xml( returnData_data : options );
        
                     response.decision = soap_body.c_replyMessage.c_decision;
        
                     response.reasonCode = soap_body.c_replyMessage.c_reasoncode;
        
                     response.authorizationCode = soap_body.c_replyMessage.
                       c_ccAuthReply.c_authorizationCode;
        
                     response.requestId = soap_body.c_replyMessage.c_requestid;
        
                     response.subscriptionId = soap_body.c_replymessage.
                       c_paySubscriptionCreateReply.c_subscriptionid;
        
                     chain ('CSREASON' : %trim(response.reasonCode)) VP172A;
                     if %found(VP172A);
                       response.reasonText += vadesc + vamisc;
                     else;
                       response.reasonText += 'Reason not found';
                     endif;
        
                   on-error;
                     response.decision = 'ERROR';
                     response.reasonText = 'XML data did not translate correctly.';
                   endmon;
        
               endsr;
        Your friends list is empty!

        Comment


        • #5
          Hi,

          Originally posted by mjhaston View Post
          You'll probably want to use XML-INTO in one fashion or another. Have you used that yet? You'll need to define data structures to match your XML document. I actually just did something similar. To me, the key is defining your data structure to match your XML. It's tedious, but once you get it right, XML-INTO is magic!
          Sorry, I should have made it clear that I was looking to find someone to do the coding for us. Unfortunately, we can't afford the time to learn how to do this, at the moment.

          Thanks,
          Neil

          Comment


          • #6
            There is a dedicated subforum for job opportunities, if you are offering one: https://www.code400.com/forum/forum/.../opportunities

            There are also dedicated UK IT recruitment agencies that specifically handle iSeries jobs. proactive.it found me my current job. Maybe they can find someone for you if you have no luck here.

            Comment

            Working...
            X