Consuming External Web Services

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
danddmrs
Premium Member
Premium Member
Posts: 86
Joined: Fri Apr 20, 2007 12:55 pm

Consuming External Web Services

Post by danddmrs »

I am trying to consume some external web services using DS 7.5.2 and have the WS and XML packs installed. I am struggling with satisfying the cookie requirements of the web service provider. They are similar to many hosted services providers that return a session identifier during the first service call that must be used for subsequent calls. Furthermore, there is also a cookie in the http response header that contains load-balancer information that must be supplied (for server affinity) as part of these subsequent http requests.

Is there a way to retrieve these cookies from the response header of the first service call and supply them to the request header for the ensuing method calls? Are there any suggested work around techniques to satisfy the requirements of these web services?

Thanks in advance.
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

You'll need to do a few things...

First, learn how to capture the entire response from your web service, the one that gives you the bits to hand back on a subsequent invocation. This is done in a simple manner by taking the output link from a succesful call to your sign-on invocation and editing it to just having a single column on that output link.... call it "SOAPresponse" or similar, with a longvarchar and something like 99999 in the length, and put a single '/' in the Description.

Send that to a sequential stage with no formatting (000 in the delimeter and quote char, for Server jobs) and take a look at it. Should be a nicely formatted SOAP body.

Learn how to pull out the bits that you need from that via xmlStage.

Then also work on being able to invoke the desired service with the input SOAP envelope that you want. I like to prototype that by calling the service from a tool like SOAP UI or Actional's Soap Tester......then "capturing" a whole SOAP envelope..... Then putting that into an upstream Transformer Derivation and in a single column sending it to the WSTransformer (use the "user defined message" check box).

When I have all three of those unit tests working, I can "build" my own input envelope to the second WS invocation.......

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

:idea:
In your copious free time (!) it would be grand if you could expand on that with simple examples, possibly in a "how to" blog.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
danddmrs
Premium Member
Premium Member
Posts: 86
Joined: Fri Apr 20, 2007 12:55 pm

Post by danddmrs »

Thank you Ernie!

I have attempted to implement the steps that you described in your response to my post but haven't been able to get information that I need to complete the subsequent calls.

Here is what I see in the http response when I monitor the traffic and what I had hoped to see in my output column based on your advice:
=====
Date: Wed, 14 Dec 2011 21:18:53 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET X-AspNet-Version: 4.0.30319 Set-Cookie: ASP.NET_SessionId=dsq5ipxtmncu2lo1kfdelcxc; path=/; HttpOnly Cache-Control: private, max-age=0 Content-Type: text/xml; charset=utf-8 Content-Length: 386 Set-Cookie: Coyote-2-a0301e1=a03020b:0; path=/
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<PrepareTaskResponse xmlns="WS-SatoriSoftware-US-MOVE">
<PrepareTaskResult>dsq5ipxtmncu2lo1kfdelcxc</PrepareTaskResult>
</PrepareTaskResponse>
</soap:Body>
</soap:Envelope>
=====

The bits of information that I need to get to are the following:
1 - SessionId=dsq5ipxtmncu2lo1kfdelcxc <----- this is the session identifier for session that my call initiated
2 - Set-Cookie: Coyote-2-a0301e1=a03020b:0 <----- this is the server identifier for the load balancer

When I attempt to implement your recommendations it get the following in my sequential file:
1 - If I "capture" the output message (User-Defined Message tab on the stage output tab) to my single column I get:
'<?xml version="1.0" encoding="UTF-8"?>
<PrepareTaskResponse xmlns="WS-SatoriSoftware-US-MOVE"><PrepareTaskResult>4xuqpsyv2radkvkn4ndbpxx1</PrepareTaskResult></PrepareTaskResponse>'

2 - If I "capture" the output header (User-Defined Header tab on the stage output tab) to my single column I get:
'<PrepareTaskResponse xmlns="WS-SatoriSoftware-US-MOVE"><PrepareTaskResult>r5fl0eyoeegu3ejbxrsikosv</PrepareTaskResult></PrepareTaskResponse>'

Clearly, I have access to the session identifier now but the server identifier remains elusive to me.

Any additional thoughts or approaches would be greatly appreciated.
Post Reply