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="wwwcie.ups.com"
  Set AuthToken.Timeout=10
  Do AuthToken.SetHeader("UPSSecurity","http://www.ups.com/XMLSchema/XOLTWS/UPSS/v1.0")
  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,!
  Quit

Thanks,

Answers

with 

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

you miss some content to POST and get

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header/>
    <soapenv:Body>
        <soapenv:Fault>
            <faultcode>Client</faultcode>
            <faultstring>An exception has been raised as a result of client data.</faultstring>
            <detail>
                <err:Errors xmlns:err="http://www.ups.com/schema/xpci/1.0/error">
                    <err:ErrorDetail>
                        <err:Severity>Hard</err:Severity>
                        <err:PrimaryErrorCode>
                            <err:Code>10001</err:Code>
                            <err:Description>The XML document is not well formed</err:Description>
                            <err:Digest>Unexpected element: CDATA</err:Digest>
                        </err:PrimaryErrorCode>
                        <err:Location/>
                    </err:ErrorDetail>
                </err:Errors>
            </detail>
        </soapenv:Fault>
    </soapenv:Body>
</soapenv:Envelope>

use instead

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

and receive

<HTML>
<HEAD><TITLE>UPS Online Tools VoidWS</TITLE></HEAD>
<BODY><H2>
Service Name: VoidWS<br>
Remote User: null<br>
Server Port: 443<br>
Server Name: wwwcie.ups.com<br>
Servlet Path: /Void<br>
</H2>
</BODY></HTML>

 

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 "https://wwwcie.ups.com/webservice/Void".

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.

 

Thanks,

 

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.

Curious as to whether you are trying to implement their REST api or their XML (SOAP) api?

The mechanisms to interface with each are quite different.

Kenneth

With this reply I'd bet om SOAP

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> ......

But without details it's a guesswork. At least some schema for the content of PUT is required.

What I've seen at UPS there are many interfaces. So which one is it ?