· Jan 4, 2018

UPS - Webservice Integration

Hi All,

I am new to webservice and UPS. I have tried the sample URL's that UPS have given for testing in PHP codes and it works just perfect for me.

But when i try to hit the same URL's in Ensemble. it gives some errors from UPS.

If anyone of you guys here has any knowledge about UPS integration or the webservice please help me. it will be much appreciated and helpful.

The ensemble code that i am trying with is,

  set AuthToken=##class(%Net.HttpRequest).%New()
  set AuthToken.SSLConfiguration="UPS"
  set AuthToken.Https=1
  set AuthToken.Server=""
  Set AuthToken.Timeout=10
  Do AuthToken.SetHeader("UPSSecurity","")
  Do AuthToken.InsertFormData("AccessLicenseNumber","***************")
  Do AuthToken.InsertFormData("Username","XXXXXXXXXXXX")
  Do AuthToken.InsertFormData("Password","YYYYYYYYYYYYY")
  Do AuthToken.SetParam("soap_method","ProcessVoid")
  Do AuthToken.SetParam("CustomerContext","Add your description here")
  Do AuthToken.SetParam("ShipmentIdentificationNumber","1ZISDE016691676846")
  set tSc = AuthToken.Post("/webservices/Void")
  Set AuthTokenValue=AuthToken.HttpResponse.Data.Read()
  Write AuthTokenValue,!


Discussion (5)0
Log in or sign up to continue


set tSc AuthToken.Post("/webservices/Void")

you miss some content to POST and get

<soapenv:Envelope xmlns:soapenv="">
            <faultstring>An exception has been raised as a result of client data.</faultstring>
                <err:Errors xmlns:err="">
                            <err:Description>The XML document is not well formed</err:Description>
                            <err:Digest>Unexpected element: CDATA</err:Digest>

use instead

set tSc AuthToken.Get("/webservices/Void")

and receive

Service Name: VoidWS<br>
Remote User: null<br>
Server Port: 443<br>
Server Name:<br>
Servlet Path: /Void<br>

Hi Robert,

 Thank you very much for your time and response.

 I get it, i have been used the same functionality in PHP it returns me a XML file just like the one with POST. 

 If i hit the URL it will show me "Success" and creates the XML file with the output data. But if i hit using the GET method it just gives the output if i simply paste the URL "".

I also checked with their documentation the webserice works using HTTPS POST

If you have any idea about this and from what i am trying to say, please do respond back.



It seems to me you try to call a SOAP service.
That service requires some special XML structured content. That is missing. It is typically  placed in  Authtoken.Entity
you can test your request by

 set tSc = AuthToken.Post("/webservices/Void",1) to see what you send.with is empty in your case.

It may work with pure %Net.HttpReqquest but if you have a valid WSDL definition you better use
the WebService Client Generator in Caché Studio that does it all for you. 

It would be useful to have sour WSDL to try it. Pls. attach it.
As I don't have a personal account on UPS I'n unable to identify what you a re trying to achieve.

I worked also with PHP WS. It does a lot under cover (without your control) that you have to do in Caché by your own code.
eg. at any request the related WDSL is downloaded for actual mapping.