Soap Envelope issue

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
mchaves
Participant
Posts: 50
Joined: Mon Aug 08, 2005 9:59 pm
Location: Sydney
Contact:

Soap Envelope issue

Post by mchaves »

Hello Folks, I'd like to borrow your brains for a moment. I am working with soap web service. I'm constructing my own request message (user message) but DataStage keeps adding its tags (Envelope and body) to it making the request unreadable by the web service. Any ideas on how to stop it?

This is the soap request message:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <Body>
      <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:cred="http://bla.bla.com.au/interfaces/common/credentials" xmlns:head="http://bla.bla.com.au/ii/common/header" xmlns:road="http://bla,bla.au/ii/interfaces">
         <soap:Header />
         <soap:Body>
            <road:GenerateRoadCrashListForPeriod>
               <!--Optional:-->
               <road:request>
                  <!--Optional:-->
                  <road:Header>
                     <!--Optional:-->
                     <road:ExtensionData />
                     <road:TimeStamp>2014-03-12T00:00:00.000+10:00</road:TimeStamp>
                     <!--Optional:-->
                     <!--Optional:-->
                     <road:MessageId>12345</road:MessageId>
                     <!--Optional:-->
                     <road:ApplicationId>TestApplication</road:ApplicationId>
                     <road:Version>
                        <!--Optional:-->
                        <road:ExtensionData />
                        <road:MajorVersion>1</road:MajorVersion>
                        <road:MinorVersion>0</road:MinorVersion>
                     </road:Version>
                  </road:Header>
                  <!--Optional:-->
                  <road:DateRange>
                     <road:StartDate>2014-03-05T00:00:00.000+10:00</road:StartDate>
                     <road:EndDate>2014-03-11T00:00:00.000+10:00</road:EndDate>
                  </road:DateRange>
                  <!--Optional:-->
                  <road:Credentials>
                     <!--Optional:-->
                     <road:ExtensionData />
                     <!--Optional:-->
                     <!--Optional:-->
                     <road:UserIdentifier>xxxxxxxx</road:UserIdentifier>
                     <!--Optional:-->
                     <road:Password>*****</road:Password>
                     <!--Optional:-->
                     <!--Optional:-->
                     <!--Optional:-->
                     <!--Optional:-->
                  </road:Credentials>
               </road:request>
            </road:GenerateRoadCrashListForPeriod>
         </soap:Body>
      </soap:Envelope>
   </Body>
</Envelope>
A bad fishing day is much better than a great day at work
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

please provide some further details......for clarification, are you using Server or EE, Web Services Transformer or Web Services Client.....and on the input message tab, did you explicitly select "user defined message" and choose a specific column?

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
mchaves
Participant
Posts: 50
Joined: Mon Aug 08, 2005 9:59 pm
Location: Sydney
Contact:

Post by mchaves »

Hi Ernie, thanks for your help.

Yeah, I have server job, and I am using the webservice transformer stage.

The job is quite simple:

Text file ------>WBS transformer stage -----> text file

That message I picked up from the logs. My issue is that datastage is adding tags to my message and I want supress that. I am doing this because I was getting errors from the datastage (java null pointer exception) when allowing it to compose the envelope message so I decided to compose my soap requests manually as it seems to be the better way to handle it according some past posts.
A bad fishing day is much better than a great day at work
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

I had to dig up an old project and check out a scenario where I did this for an "array" based Web Service. Sure enough, the xpath in the xmlOutput Stage prior to the WSTransformer handles everything "up to" and including the element that is "inside" of Body.......

So....assuming that you are using xmlOutput, try just removing the /Envelope/Body parts of the xpath in the input link of that Stage.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

...was looking at the Job and realized that it was one that I posted in my blog a long time ago. Go to this url and then download the two files (right click and "Save Link As...") ...then rename them...one is a .dsx and the other is the .wsdl

The service is not public, but the annotations in the Job explain what is going on, and you'll see in the xmlOutput Stage input link how Body and Envelope are not crafted prior to the WSTransformer.

Ernie

http://dsrealtime.wordpress.com/2008/05 ... and-ouput/
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
mchaves
Participant
Posts: 50
Joined: Mon Aug 08, 2005 9:59 pm
Location: Sydney
Contact:

Post by mchaves »

Ernie, the envelope comes from a text file in a column and goes straight into the webservice transformer. As I am using "user defined message", I believe datastage should send the envelope "as is" to the webservice but it's not. It's wrapping up my envelope with additional tags. If you look at the soap envelope I posted, you'll see it has added the "Envelope" and "Body" clauses which I already have in my original envelope.
A bad fishing day is much better than a great day at work
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Exactly. It is going to put on the Envelope and Body tags....so you need to remove them. Use an xmlInput Stage and just parse out the main element that you need....which looks like it is road:GenerateRoadCrashListForPeriod.....

Should be a one liner in the output link of an xmlInput Stage somewhere upstream.....

One large column on the output link called "mybody" and in the xpath, something like /Envelope/Body/GenerateRoadCrashListForPeriod/ ...with the correct namespaces, of course, and namespaces also loaded into the namespace property.

Import your xml via the xml metadata importer, or you could do this easily by hand if you 've done it before.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
mchaves
Participant
Posts: 50
Joined: Mon Aug 08, 2005 9:59 pm
Location: Sydney
Contact:

Post by mchaves »

Hi Ernie, sorry I didn't understand your solution.

My soap envelope comes from a text file,it's right to go and doesnt have those tags.

this is the structure of the job

TEXT FILE ------> wbs transformer ------> TEXT FILE

Could you elaborate more on how to intercept the message before it goes out to the webservice?
A bad fishing day is much better than a great day at work
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Your soap envelope is itself just an "xml document". So it can be parsed just like any other.

Play separately with the xmlInput Stage in another Job. Very likely, you are putting the xml document into a single large column? You'll have to spend some time learning the xmlInput Stage, but here are the basics:

a) use import...table definitions...xml table definitions..... and open up ONE ROW (copy a single row to its own file) of your input envelopes. You will see a tree....
b) expand that entire tree...there will be lots of check boxes...at various levels. You aren't doing any deep parsing here, so you should only need to check the highest level box, under Envelope and under Body, for the "crashes" element that you need. Notice what happens at the bottom of the page when you check it. You will get a single column....
c) At the bottom there, make it a KEY. Also --- make note of the "xpath" syntax on the right hand side... (the slashes and element names...).
d) Save the tabledef and return to DS
e) feed the rows into an xmlInput Stage from your text file.
f) declare that your incoming column is "xml content" (not url).
g) "load" the new tabledef to the output link
h) also "load" the new tabledef to the transformation "namespace" properties box.
i) send the output link to a sequential file. Use "none" for the delimiter and quote character or 000 for both if this is a Server Job.
j) compile and run the job.

You should see the inner "guts" of that SOAP envelope...now you have a "clean" xml chunk to send into the WSTransformer.

ERnie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Post Reply