Webservice Client Stage - Data 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
Naren12345babu
Premium Member
Premium Member
Posts: 76
Joined: Wed Jan 06, 2016 9:40 am
Location: Bangalore

Webservice Client Stage - Data issue

Post by Naren12345babu »

Hi ,

I am sending messages to Webservices through Webservices client Stage.
Output is XML message.

Input records :

ID , Code

1 , 123
2 , 345

Output to Webservices - two records are creating two seperate XML Objects as show below,

Code: Select all

	<Header>
          <IntegrationObjectID>ListedValues</IntegrationObjectID>
        </Header>
        <Body>
          <ListedValue>
            <ID>1</ID>
            <Code>123</Code>        
          </ListedValue>
        </Body>
      </ns1:PresentationLayerObject_ListedValues_Body>
    </ns1:PresentationLayerObject_ListedValues>
  </s:Body>
</s:Envelope>

*********
	<Header>
          <IntegrationObjectID>ListedValues</IntegrationObjectID>
        </Header>
        <Body>
          <ListedValue>
            <ID>2</ID>
            <Code>345</Code>        
          </ListedValue>
        </Body>
      </ns1:PresentationLayerObject_ListedValues_Body>
    </ns1:PresentationLayerObject_ListedValues>
  </s:Body>
</s:Envelope>
But I need to send both records of the same Toggle in a single XML Object. example is below,

Code: Select all

<Header>
          <IntegrationObjectID>ListedValues</IntegrationObjectID>
        </Header>
        <Body>
           <ListedValue>
            <ID>1</ID>
            <Code>123</Code>        
          </ListedValue>
          <ListedValue>
            <ID>2</ID>
            <Code>345</Code>        
          </ListedValue>
        </Body>
      </ns1:PresentationLayerObject_ListedValues_Body>
    </ns1:PresentationLayerObject_ListedValues>
  </s:Body>
</s:Envelope>
How can I get this using webservices client stage.
Thanks
Naren Babu Ch
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

You will have to learn how to use the xmlOutput Stage to build that xml, or for a small one like this, you could even just use a Transformer.....building the entire soap "body" and then using the "User Defined Message" option in the input link of the WSTransformer Stage to let DataStage know that YOU crafted the entire SOAP body yourself.....and it won't "re-cast" the xml but just wrap it with the remainder of the envelope and send it along.

Do some searching here in the forum...this has been discussed before...but first make sure you are able to create that body and just send it to a flat file for review before trying to send it into the WS Stage.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Naren12345babu
Premium Member
Premium Member
Posts: 76
Joined: Wed Jan 06, 2016 9:40 am
Location: Bangalore

Post by Naren12345babu »

Hi Ernie,

Thank you, I will try the method you explained.
Thanks
Naren Babu Ch
Naren12345babu
Premium Member
Premium Member
Posts: 76
Joined: Wed Jan 06, 2016 9:40 am
Location: Bangalore

Post by Naren12345babu »

Ernie,

Can I use WS transformer for complex XMLs? I have a complex one. I just created a sample one for illustrating example.

Also, the purpose is to avoid file storage on any disk before sending these files to Webservice.

I believe you are asking me to work using XML Output stage for testing purpose.
Thanks
Naren Babu Ch
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Yes...you can use web services that have complex inputs/outputs.... and then the WSStage will only do the "communication".

But you have to build (and/or decipher) the request and the response.....generally it is the "body" that you are crafting (or parsing) and/or the header.

That is why goal #1 is to find out exactly what a valid body request and response look like......(a sample...use a tool like SOAP ui), and then work with the xmlOutput Stage (or Hierarchical Stage) to build exactly that Body (sending first to a flat file)....and then do the same with the xmlInput Stage, to parse the response (reading from a flat file)......and then put things together.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Naren12345babu
Premium Member
Premium Member
Posts: 76
Joined: Wed Jan 06, 2016 9:40 am
Location: Bangalore

Post by Naren12345babu »

Hi,

I used Hierarchiel transformer to do regrouping. And I got an XML file with desired output.

Currently my Job design is as below :

Oracle DB --> Transformer --> Hierarchical Data --> WS Client

Now I am getting te below error :

TGT_WBS_LISTEDVALUES,0: Info: JOB_INT_LISTEDVALUES_JDE_CAS_FinalStep_ToWebservices_2.TGT_WBS_LISTEDVALUES: 0030`:`com.ascentialsoftware.wsclient.ServiceInvocationException: Service invocation exception: Content is not allowed in prolog.
at com.ascentialsoftware.wsclient.ServiceInvocationException.<init>(ServiceInvocationException.java:44)
at com.ascentialsoftware.wsclient.WebService.callService(WebService.java:1602)
at com.ascentialsoftware.wsclient.WebService.callService(WebService.java:1544)
at com.ascentialsoftware.wspack.Transformer.process(Transformer.java:105)
at com.ascentialsoftware.jds.StageFactory.runStage(StageFactory.java:544)
at com.ascentialsoftware.jds.StageFactory.runTarget(StageFactory.java:348)
Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at com.ascentialsoftware.wsclient.xml.TreeBuilder.xmlReaderToDom(TreeBuilder.java:325)
at com.ascentialsoftware.wsclient.InputRequest.buildRequestHeaderDocument(InputRequest.java:840)
at com.ascentialsoftware.wsclient.WebService.callServiceInternal(WebService.java:1624)
at com.ascentialsoftware.wsclient.WebService.callService(WebService.java:1591)


What is the meaning of this issue and how to resolve this. I have gone through old posts on the same error but could not get a solution
Thanks
Naren Babu Ch
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

-craig

"You can never have too many knives" -- Logan Nine Fingers
Naren12345babu
Premium Member
Premium Member
Posts: 76
Joined: Wed Jan 06, 2016 9:40 am
Location: Bangalore

Post by Naren12345babu »

Any idea, How to resolve this issue.
Thanks
Naren Babu Ch
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

As noted by Ernie, build a version of your job that drops your generated XML to a file rather than directly to the web service. Then you can see what, if anything, is wrong with it. The link I posted should give you an idea where to start looking at least.
-craig

"You can never have too many knives" -- Logan Nine Fingers
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Hard to say. It sounds like it isn't liking the xml that you constructed, and isn't even able to make the initial invocation. Did you match the xml body that you see in something like SOAPui?

...did you make sure that your output is just a "chunk" of xml string? It cannot be a whole document --- just the "body" of the SOAP envelope.

It also could be a namespace issue.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Naren12345babu
Premium Member
Premium Member
Posts: 76
Joined: Wed Jan 06, 2016 9:40 am
Location: Bangalore

Post by Naren12345babu »

Hi,
I created Soap Project with wsdl in Soap UI.

I opened method and clicked on Request. I got below information with Soap Envelop. In the below text , which one is Soap Header ?

Code: Select all

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:acc="http://www.accenture.com/">
   <soapenv:Header/>
   <soapenv:Body>
      <acc:PresentationLayerObject_ListedValues>
         <!--Optional:-->
         <acc:PresentationLayerObject_ListedValues_Body>
            <Header>
               <IntegrationObjectID>?</IntegrationObjectID>
               <Timestamp>?</Timestamp>
               <MessageID>?</MessageID>
               <Sender>?</Sender>
               <Function>?</Function>
            </Header>
            <Body>
               <!--Zero or more repetitions:-->
               <ListedValue>
                  <!--Optional:-->
                  <Hostsource>?</Hostsource>
                  <ID>?</ID>
                  <SalesOrgs_LV>
                     <!--Zero or more repetitions:-->
                     <SalesOrg_LV>
                        <SalesOrgID>?</SalesOrgID>
                        <!--Optional:-->
                        <DefaultItemCode>?</DefaultItemCode>
                        <Items_LV>
                           <!--Zero or more repetitions:-->
                           <Item_LV>
                              <!--Optional:-->
                              <Status>?</Status>
                              <Code>?</Code>
                              <!--Optional:-->
                              <Sort>?</Sort>
                              <Descriptions_LV>
                                 <!--Zero or more repetitions:-->
                                 <Description_LV>
                                    <Language>?</Language>
                                    <Text>?</Text>
                                    <!--Optional:-->
                                    <ShortText>?</ShortText>
                                 </Description_LV>
                              </Descriptions_LV>
                           </Item_LV>
                        </Items_LV>
                     </SalesOrg_LV>
                  </SalesOrgs_LV>
               </ListedValue>
            </Body>
         </acc:PresentationLayerObject_ListedValues_Body>
      </acc:PresentationLayerObject_ListedValues>
   </soapenv:Body>
</soapenv:Envelope>
Thanks
Naren Babu Ch
Naren12345babu
Premium Member
Premium Member
Posts: 76
Joined: Wed Jan 06, 2016 9:40 am
Location: Bangalore

Post by Naren12345babu »

Hi, Finally the job finished and I am able to Post the XML file to Webservices.

Thank you eostic , Criag , ray for your valuable suggestions.


Job 1 :-

DB2 --> Transformer --> Hierarchical stage (XML File creation with groups)

Used Hierarchical stage to do grouping.

Job 2 :-

Folder stage --> Transformer --> Webservices client

Here I included Soap Header in Soap Message and all went fine.
Thanks
Naren Babu Ch
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

SOAP header (as you seem to have worked out) is empty

Code: Select all

   <soapenv:Header/>
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply