ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Fedex web service

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

  • Fedex web service

    I'm writing a consumer for Fedex's SOAP web service. I'm building the XML request body using a template in CGIDEV2, and executing the request with the SQL HTTPPOSTCLOB function. I don't get anything for a response, just this in the job log:

    Java stored procedure or user-defined function SYSTOOLS.HTTPPOSTCLOB, specific name HTTPP00013 aborted with an exception "Server returned HTTP response code: 400 for URL: https://wsbeta.fedex.com:443/web-services/ship".
    No specifics about how my HTTP request is invalid.
    I'm pretty sure this error is a response from the service; if I change the URL to something invalid, I get a 404 instead of a 400.

    I've also tried to duplicate the request in SoapUI, and it won't connect at all as far as I can tell. Just logs an org.apache.http.client.ClientProtocolException.
    My googling indicates that error tends to be related to authentication, so I enabled Authenticate Preemptively and set up NTLM authorization with the key and password on my Fedex developer account. Made no difference.

    I spoke to several people at Fedex web services tech support, and they are completely clueless about communications. They can only talk about the contents of responses once communication is working.

    Has anyone ever used this web service? Thanks!

  • #2
    I haven't used this particular web service.

    A 400 error basically just means "bad request". In other words, there's something wrong in the format of the request to the server. It may be a mistake in the format of the data you're sending to them, a parameter, or it might indicate that it is missing a required header or has a mis-formatted header.

    Its hard to say what you may be doing wrong since you have provided very little detail. I would suggest checking, double checking, etc all of the details against their documentation to make sure you're doing everything right. Reproducing with SoapUI or Postman is a good idea, since HTTPPOSTCLOB basically discards all diagnostics about why it is failing.

    The org.apache.http.client.ClientProtocolException essentially means the same thing as the 400. Something is wrong in the way the client is sending the protocol. Its unspecific, so I wouldn't jump to the conclusion that it is related to authorization -- unless you've been told that you need NTLM authentication and you're not providing it?

    Since HTTPPOSTCLOB does not support NTLM authentication, if its required, you'll need to use another tool. (For example, HTTPAPI)

    Comment


    • #3
      Thanks as always, Scott! I switched from SoapUI to Postman and immediately started getting meaningful responses. I'm up to HTTP 500 errors, so now working on fixing the data. Since, as you pointed out, HTTPPOSTCLOB discards the response if it doesn't get HTTP 200, and the Fedex web service apparently uses HTTP 500 responses as a catch-all for anything wrong, I will
      1. Do my initial format, etc. testing with Postman
      2. Probably replace HTTPPOSTCLOB with HTTPAPI. Looking forward to trying it out.

      Comment


      • #4
        A few misc notes:
        • There is a VERBOSE version of HTTPPOSTCLOB that might add a little more detail.
        • When I get HTTPP00013 errors it's usually my data or structure screwed up.
        • There are some really helpful SQL XML functions to build XML documents. Depends on how much fun you want to have!
        • I've had to switch from using HTTPPOST or HTTPGET and stay with HTTPAPI due to running some Java jobs on the IBMi. If the same job runs our Java functions and HTTPPOST/GET the job fails. jtaylor___ ran into that issue initially and helped me with it.
        Last edited by mjhaston; February 26, 2021, 06:45 PM.
        Your friends list is empty!

        Comment


      • #5
        Thanks! If I had thought to use HTTPPOSTCLOBVERBOSE in the first place, I wouldn't have had to move out to Postman to get the headers for the 400 and 500 responses. Now I'm getting 200 responses and working through the data, but I will definitely keep that in mind to avoid headaches later on.

        Comment

        Working...
        X