Using UPS shipping API from withing OpenEdge 11.x ?

Posted by cverbiest on 11-Aug-2015 11:25

Hi,

I'm posting this on behalf of a colleague.

We need to call UPS service (https://wwwcie.ups.com/webservices/Ship) that uses status code 200 + soap faults to return application errors when the call was successful.


Following https://progress.my.salesforce.com/articles/Article/P125009?popup=true  we contacted UPS and they state that their API is working correct with current standards. They have no intention to change this.

Is anyone using that webservice from within OpenEdge ?

Posted by TheMadDBA on 12-Aug-2015 09:32

Standards are wonderful aren't they :-)

I personally feel that the UPS way is better, but I can understand both sides. The reality is that so many places are using non 500 HTTP status codes so at some point changing the OE side to just look at the SOAP fault seems to make a lot of sense.

All Replies

Posted by Peter Judge on 11-Aug-2015 11:53

If OE and UPS both state they're working to spec (and it sounds like UPS should, sorry MUST, be returning a 500) then it may be worth looking at something else (like your own SOAP client).

What version of OE are you working with?

Posted by cverbiest on 12-Aug-2015 01:52

Using oe11.3 but I don't mind going tot 11.5.1.

I'll try to get the exact error and reply from UPS, as far as I understand it they refer to a more recent standard where it is allowed to return a 200 if the service is working and still return a SOAP fault to return an application error.

Posted by cverbiest on 12-Aug-2015 02:27

This is the response we got from UPS

According to our corporate support, our API is properly working. 

The API is working as intended. You will receive a 500 error if the envelope is a Fault. 
In the example provided by the customer, the envelope is not at fault, the information passed in it is.
The following link the customer provided also states: http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383529 A 2xx status code indicates that the client's request including the SOAP component
was successfully received, understood, and accepted etc. The SOAP envelope is successfully received, understood and accepted.
However, the information in the envelope is not correct. Could you please share this information to the Progress Developer. Best Regards Juan Manuel Saiz Ortiz | EDI SME UPS Customer Solutions SSTI Deployment Group

Posted by Donicello Lampe on 12-Aug-2015 07:48

This can be interpreted in several ways. The SOAP 1.1 standard (which I believe the UPS Web Service is based on) as partially quoted by you states the following (http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383529):

-------------------------

6.2 SOAP HTTP Response

SOAP HTTP follows the semantics of the HTTP Status codes for communicating status information in HTTP. For example, a 2xx status code indicates that the client's request including the SOAP component was successfully received, understood, and accepted etc.

In case of a SOAP error while processing the request, the SOAP HTTP server MUST issue an HTTP 500 "Internal Server Error" response and include a SOAP message in the response containing a SOAP Fault element (see section 4.4) indicating the SOAP processing error.

-------------------------

The last part states that when a "SOAP error" occurs, an HTTP Status 500 should be returned. We can of course discuss all day long what falls under a "SOAP error" since that is also open to interpretation.

To help with such misunderstanding the WS-I was put in place and their latest SOAP 1.1 recommendation (Basic Profile 1.2) states the following (http://ws-i.org/profiles/basicprofile-1.2-2010-11-09.html#HTTP_Server_Error_Status_Codes):

-------------------------

3.5.7 HTTP Server Error Status Codes

HTTP uses the 5xx series of status codes to indicate failure due to a server error.

R1126 An INSTANCE MUST return a "500 Internal Server Error" HTTP status code if the response envelope is a Fault.

-------------------------

I am assuming UPS is sending back a SOAP Fault within the SOAP Envelope, so to me they are not following the standard.

If they are using SOAP 1.2, then they have a point. Those requirements have been removed in the WS-I Basic Profile 2.0 which is based on SOAP 1.2.

Posted by TheMadDBA on 12-Aug-2015 08:29

Quite  a few companies take the approach that a 500 status represents a garbage soap message and not an application error. Including Sonic when it was owned by PSC :-)

knowledgebase.progress.com/.../S11871

Here is a link (and relevant text) from WS-I 1.1 (2006)

www.ws-i.org/.../BasicProfile-1.1.html

3.3.1 Identifying SOAP Faults

Some consumer implementations erroneously use only the HTTP status code to determine the presence of a Fault. Because there are situations where the Web infrastructure changes the HTTP status code, and for general reliability, the Profile requires that they examine the envelope. A Fault is an envelope that has a single child element of the soap:Body element, that element being a soap:Fault element.

R1107 A RECEIVER MUST interpret a SOAP message as a Fault when the soap:Body of the message has a single soap:Fault child.

All that being said you are kind of stuck with the way that OpenEdge currently works. So you need to use CURL or the HTTP classes or some other option to actually use the UPS service reliably.

Short term fix is to have the developer fix the issues with the SOAP content (likely missing or invalid values) and put in validation that matches what UPS expects.

Posted by Donicello Lampe on 12-Aug-2015 08:55

I know all bout it, I logged a bug with Sonic Development back in the days for that, since I believe the OE way to be the correct way. I was overruled by Sonic Development back then :-)

Like I said, it's open to interpretation since one could argue in this case that OE is not following recommendation R1107 and that UPS is not following recommendation R1126 of the Basic Profile 1.2.

We (cverbiest + Support) are already working on a workaround by using the new HTTP client, but we have hit some issues there as well unfortunately.

Posted by TheMadDBA on 12-Aug-2015 09:32

Standards are wonderful aren't they :-)

I personally feel that the UPS way is better, but I can understand both sides. The reality is that so many places are using non 500 HTTP status codes so at some point changing the OE side to just look at the SOAP fault seems to make a lot of sense.

Posted by Peter Judge on 12-Aug-2015 09:58

Standards are wonderful aren't they :-)

Tell me about it. I've learned to *love* RFC 2119  :)  and especially people who don't follow it </sarcarsm>
 
Moving along rapidly.
 
We're (for our JSDO / Business Entity stuff in particular) moving to that model:
  - HTTP status 5xx for server errors (like couldn't reach the appserver, or an unhandled exception thrown from the ABL code or similar).
  - HTTP status 2xx for successful execution of ABL – regardless of whether there was a business logic/validation error. The payload that's returned may contain errors or not.
  - Other status codes may be returned in various other scenarios (eg. authentication may return 403)
 
If you're really interested, the payload is likely to take a form similar to http://jsonapi.org/format/ ; this will probably also be spec'ed out more formally via the CCS .
 
Comments on all of the above welcome.
 
 
 
[collapse]
From: TheMadDBA [mailto:bounce-TheMadDBA@community.progress.com]
Sent: Wednesday, 12 August, 2015 10:34
To: TU.OE.General@community.progress.com
Subject: RE: [Technical Users - OE General] Using UPS shipping API from withing OpenEdge 11.x ?
 
Reply by TheMadDBA

Standards are wonderful aren't they :-)

I personally feel that the UPS way is better, but I can understand both sides. The reality is that so many places are using non 500 HTTP status codes so at some point changing the OE side to just look at the SOAP fault seems to make a lot of sense.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

Posted by cverbiest on 12-Aug-2015 10:35

From what I found the debate about returning status code 200 or 500 dates back to 2001 lists.w3.org/.../0015.html .

I don't know if anybody actually won the debate.

From the point of an ABL developer trying to call a webservice this doesn't really help though. If a company like UPS thinks their API is correct,  chances that they'll make changes because an ISV using OpenEdge says they should are extremely slim.

ABL is supposed to take the hard work out of calling webservices. Now we have to either code it ourselves on a low level using httpclient and dealing with the soap messages ourselves or we have to use a different programming language.

Neither of those options are ideal.

Posted by TheMadDBA on 12-Aug-2015 10:44

Two thumbs up for that approach. I think it makes the most sense because it helps to split the issues into the "proper" categories.

When do we get that for the ABL ;-)

Posted by Peter Judge on 12-Aug-2015 12:18

ABL is supposed to take the hard work out of calling webservices. Now we have to either code it ourselves on a low level using httpclient and dealing with the soap messages ourselves or we have to use a different programming language.

Neither of those options are ideal.

Agreed.
 
You may have a case for reopening this issue as a bug.
 
 
[collapse]
From: cverbiest [mailto:bounce-cverbiest@community.progress.com]
Sent: Wednesday, 12 August, 2015 11:36
To: TU.OE.General@community.progress.com
Subject: RE: [Technical Users - OE General] Using UPS shipping API from withing OpenEdge 11.x ?
 
Reply by cverbiest

From what I found the debate about returning status code 200 or 500 dates back to 2001 lists.w3.org/.../0015.html .

I don't know if anybody actually won the debate.

From the point of an ABL developer trying to call a webservice this doesn't really help though. If a company like UPS thinks their API is correct,  chances that they'll make changes because an ISV using OpenEdge says they should are extremely slim.

ABL is supposed to take the hard work out of calling webservices. Now we have to either code it ourselves on a low level using httpclient and dealing with the soap messages ourselves or we have to use a different programming language.

Neither of those options are ideal.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

Posted by cverbiest on 13-Aug-2015 01:59

Thanks Peter, I re-opened case  00320651 "Problem getting errors from UPS webservice"

Posted by Donicello Lampe on 13-Aug-2015 04:54

A defect has been logged and the KBase article has been updated:

knowledgebase.progress.com/.../P125009

Posted by hmariwa on 13-Aug-2015 11:51

Just an update on this issue:  We were able to confirm what the customer is

seeing and it looks like this is the third part library issue, where no

SOAP FAULT information or any error status is being issues if HTTP status

is 200. We have opened a case with the third part library support team.

Also, if this issue is addressed, SOAP engine has to take a

performance hit of having to check for SOAP fault element for EVERY SOAP

responses. This is probably why other vendors are still relaying on HTTP

status code to issue SOAP faults -especially when the application is excepted

to run normal at > 90% of the time.

Posted by Donicello Lampe on 14-Oct-2015 06:44

FYI, the fix will be included in the upcoming 11.6 release.

This thread is closed