Page 1 of 1

Webservice Client Stage - Data issue

Posted: Mon Feb 08, 2016 12:57 pm
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.

Posted: Mon Feb 08, 2016 1:24 pm
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

Posted: Mon Feb 08, 2016 1:48 pm
by Naren12345babu
Hi Ernie,

Thank you, I will try the method you explained.

Posted: Mon Feb 08, 2016 1:51 pm
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.

Posted: Mon Feb 08, 2016 4:33 pm
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

Posted: Wed Feb 10, 2016 7:43 am
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

Posted: Wed Feb 10, 2016 7:57 am
by chulett

Posted: Wed Feb 10, 2016 10:57 am
by Naren12345babu
Any idea, How to resolve this issue.

Posted: Wed Feb 10, 2016 11:26 am
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.

Posted: Wed Feb 10, 2016 12:56 pm
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

Posted: Mon Feb 15, 2016 6:15 am
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>

Posted: Mon Feb 15, 2016 11:21 am
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.

Posted: Mon Feb 15, 2016 4:39 pm
by ray.wurlod
SOAP header (as you seem to have worked out) is empty

Code: Select all

   <soapenv:Header/>