Discussion:
How to pass xml payload(we are receiving data from CSV and creating XML file for payload) in to HTTP Client connector in TDI?
(too old to reply)
Rajkiran Paul
2018-06-07 08:09:51 UTC
Permalink
Raw Message
We are reading data from CSV feed. we are creating XML from that CSV feed. Now we want to pass this XML file as a payload to HTTP client connector. we are using HTTP REST API to connect one of our target application. please guide me how to pass the XML payload in to POST method and also how to parse the return value to display.
Franzw
2018-06-07 12:07:27 UTC
Permalink
Raw Message
Post by Rajkiran Paul
We are reading data from CSV feed. we are creating XML from that CSV feed. Now we want to pass this XML file as a payload to HTTP client connector. we are using HTTP REST API to connect one of our target application. please guide me how to pass the XML payload in to POST method and also how to parse the return value to display.
Go through Eddies excellent educational blogs here :

http://www.tdiingoutloud.com/2013/09/json-and-xml-tutorial-part-1.html
http://www.tdiingoutloud.com/2015/02/json-and-xml-tutorial-part-2.html
http://www.tdiingoutloud.com/2016/02/json-and-xml-tutorial-part-2-xml-example.html
http://www.tdiingoutloud.com/2016/11/json-and-xml-tutorial-part-4-json.html
http://www.tdiingoutloud.com/2016/11/json-and-xml-tutorial-part-5.html
http://www.tdiingoutloud.com/2016/11/json-and-xml-tutorial-part-6-making.html

In general it is considered rude just to post a request like yours as it clearly shows that you have not spent time searching for a solution i.e. done your homework. You should spend a little time reading here : http://www.catb.org/esr/faqs/smart-questions.html

HTH
Regards
Franz Wolfhagen
Rajkiran Paul
2018-06-08 18:44:42 UTC
Permalink
Raw Message
below is the error i am getting.

00:12:45,280 WARN - [HTTPClientConnector] CTGDIS043I Enabled hook script for callreply_ok is empty.
00:12:45,281 INFO - CTGDIS087I Iterating.
00:12:45,281 INFO - CTGDIS086I No iterator in AssemblyLine, will run single pass only.
00:12:45,281 INFO - CTGDIS092I Using runtime provided entry as working entry (first pass only).
00:12:45,282 INFO - <Changes>
<Description>deleting the user</Description>
<Notes>notes</Notes>
<AccountChange>
<Operation>Delete</Operation>
<User>Sharma, Anand</User>
<BusinessSource>ILANTUS Active Directory</BusinessSource>
<Account>anand.sharma</Account>
<AccountCollector>ILANTUS AD Account Collector</AccountCollector>
</AccountChange>
</Changes>
00:12:45,397 INFO - Here is the message:null
00:12:45,399 INFO - Here is the message:null
00:12:45,400 INFO - Here is the response:<html><head><title>Error</title></head><body>Invalid XML content in the request body. XML document structures must start and end within the same entity.
Query String=cmd=createChangeRequest&amp;token=ws31cfd424fd35662137:-3b988e9c:163d8baec6c:-7f5f0.8362145377423087</body></html>
00:12:45,402 INFO - Here is the responseCode:null
00:12:45,404 INFO - Here is the responseMsg:null
00:12:45,405 INFO - Here is the responsebodytostring:<html><head><title>Error</title></head><body>Invalid XML content in the request body. XML document structures must start and end within the same entity.
Query String=cmd=createChangeRequest&amp;token=ws31cfd424fd35662137:-3b988e9c:163d8baec6c:-7f5f0.8362145377423087</body></html>
00:12:45,408 INFO - CTGDIS088I Finished iterating.
00:12:45,410 ERROR - [HTTPClientConnector] CTGDIS810E handleException - cannot handle exception , close
java.lang.IllegalStateException: There is no in-scope element to end.
at com.ibm.xml.xlxp.api.stax.msg.StAXMessageProvider.throwIllegalStateException(StAXMessageProvider.java:46)
at com.ibm.xml.xlxp.api.stax.XMLStreamWriterImpl.handleEndElement(XMLStreamWriterImpl.java:577)
at com.ibm.xml.xlxp.api.stax.XMLStreamWriterBase.writeEndElement(XMLStreamWriterBase.java:527)
at com.ibm.xml.xlxp.api.stax.XMLOutputFactoryImpl$XMLStreamWriterProxy.writeEndElement(XMLOutputFactoryImpl.java:135)
at com.ibm.di.parser.xml.XMLParser2.writeStaticEndTag(XMLParser2.java:1186)
at com.ibm.di.parser.xml.XMLParser2.writeEndTags(XMLParser2.java:1206)
at com.ibm.di.parser.xml.XMLParser2.closeParser(XMLParser2.java:1519)
at com.ibm.di.connector.Connector.terminate(Connector.java:634)
at com.ibm.di.connector.HTTPClientConnector.terminate(HTTPClientConnector.java:123)
at com.ibm.di.server.AssemblyLineComponent.doConnectorTerminate(AssemblyLineComponent.java:1363)
at com.ibm.di.server.AssemblyLineComponent.close(AssemblyLineComponent.java:1065)
at com.ibm.di.server.AssemblyLine.close(AssemblyLine.java:1392)
at com.ibm.di.server.AssemblyLine.msCloseConn(AssemblyLine.java:4107)
at com.ibm.di.server.AssemblyLine.executeMainStep(AssemblyLine.java:3367)
at com.ibm.di.server.AssemblyLine.executeMainLoop(AssemblyLine.java:2960)
at com.ibm.di.server.AssemblyLine.executeMainLoop(AssemblyLine.java:2943)
at com.ibm.di.server.AssemblyLine.executeAL(AssemblyLine.java:2912)
at com.ibm.di.server.AssemblyLine.run(AssemblyLine.java:1311)
00:12:45,412 INFO - CTGDIS100I Printing the Connector statistics.
00:12:45,415 INFO - [EmptyScript] Calls: 1
00:12:45,416 INFO - [HTTPClientConnector] CallReply:1, Errors:1
00:12:45,417 INFO - [ParseReturnXMLPayload] Calls: 1
00:12:45,418 INFO - CTGDIS104I Total: CallReply:1, Errors:1.
00:12:45,419 INFO - CTGDIS101I Finished printing the Connector statistics.
00:12:45,420 ERROR - CTGDIS077I Failed with error: There is no in-scope element to end..
Rajkiran Paul
2018-06-08 18:47:13 UTC
Permalink
Raw Message
\00:12:45,280 WARN - [HTTPClientConnector] CTGDIS043I Enabled hook script for callreply_ok is empty.
00:12:45,281 INFO - CTGDIS087I Iterating.
00:12:45,281 INFO - CTGDIS086I No iterator in AssemblyLine, will run single pass only.
00:12:45,281 INFO - CTGDIS092I Using runtime provided entry as working entry (first pass only).
00:12:45,282 INFO - <Changes>
<Description>deleting the user</Description>
<Notes>notes</Notes>
<AccountChange>
<Operation>Delete</Operation>
<User>abc,efg</User>
<BusinessSource>Active Directory</BusinessSource>
<Account>efg.abc</Account>
<AccountCollector>AD Account Collector</AccountCollector>
</AccountChange>
</Changes>
00:12:45,397 INFO - Here is the message:null
00:12:45,399 INFO - Here is the message:null
00:12:45,400 INFO - Here is the response:<html><head><title>Error</title></head><body>Invalid XML content in the request body. XML document structures must start and end within the same entity.
Query String=cmd=createChangeRequest&amp;token=ws31cfd424fd35662137:-3b988e9c:163d8baec6c:-7f5f0.8362145377423087</body></html>
00:12:45,402 INFO - Here is the responseCode:null
00:12:45,404 INFO - Here is the responseMsg:null
00:12:45,405 INFO - Here is the responsebodytostring:<html><head><title>Error</title></head><body>Invalid XML content in the request body. XML document structures must start and end within the same entity.
Query String=cmd=createChangeRequest&amp;token=ws31cfd424fd35662137:-3b988e9c:163d8baec6c:-7f5f0.8362145377423087</body></html>
00:12:45,408 INFO - CTGDIS088I Finished iterating.
00:12:45,410 ERROR - [HTTPClientConnector] CTGDIS810E handleException - cannot handle exception , close
java.lang.IllegalStateException: There is no in-scope element to end.
at com.ibm.xml.xlxp.api.stax.msg.StAXMessageProvider.throwIllegalStateException(StAXMessageProvider.java:46)
at com.ibm.xml.xlxp.api.stax.XMLStreamWriterImpl.handleEndElement(XMLStreamWriterImpl.java:577)
at com.ibm.xml.xlxp.api.stax.XMLStreamWriterBase.writeEndElement(XMLStreamWriterBase.java:527)
at com.ibm.xml.xlxp.api.stax.XMLOutputFactoryImpl$XMLStreamWriterProxy.writeEndElement(XMLOutputFactoryImpl.java:135)
at com.ibm.di.parser.xml.XMLParser2.writeStaticEndTag(XMLParser2.java:1186)
at com.ibm.di.parser.xml.XMLParser2.writeEndTags(XMLParser2.java:1206)
at com.ibm.di.parser.xml.XMLParser2.closeParser(XMLParser2.java:1519)
at com.ibm.di.connector.Connector.terminate(Connector.java:634)
at com.ibm.di.connector.HTTPClientConnector.terminate(HTTPClientConnector.java:123)
at com.ibm.di.server.AssemblyLineComponent.doConnectorTerminate(AssemblyLineComponent.java:1363)
at com.ibm.di.server.AssemblyLineComponent.close(AssemblyLineComponent.java:1065)
at com.ibm.di.server.AssemblyLine.close(AssemblyLine.java:1392)
at com.ibm.di.server.AssemblyLine.msCloseConn(AssemblyLine.java:4107)
at com.ibm.di.server.AssemblyLine.executeMainStep(AssemblyLine.java:3367)
at com.ibm.di.server.AssemblyLine.executeMainLoop(AssemblyLine.java:2960)
at com.ibm.di.server.AssemblyLine.executeMainLoop(AssemblyLine.java:2943)
at com.ibm.di.server.AssemblyLine.executeAL(AssemblyLine.java:2912)
at com.ibm.di.server.AssemblyLine.run(AssemblyLine.java:1311)
00:12:45,412 INFO - CTGDIS100I Printing the Connector statistics.
00:12:45,415 INFO - [EmptyScript] Calls: 1
00:12:45,416 INFO - [HTTPClientConnector] CallReply:1, Errors:1
00:12:45,417 INFO - [ParseReturnXMLPayload] Calls: 1
00:12:45,418 INFO - CTGDIS104I Total: CallReply:1, Errors:1.
00:12:45,419 INFO - CTGDIS101I Finished printing the Connector statistics.
00:12:45,420 ERROR - CTGDIS077I Failed with error: There is no in-scope element to end..
yn2000
2018-06-09 16:03:47 UTC
Permalink
Raw Message
Oh no... What did you do?
OK, that was a joke, but there are still many variants that could generate this error, such as when you do not map the http.body properly.
Yes, probably you did not make a mistake in data mapping, but hey, I can say you did by just viewing this 'limited' input of information.
Rgds. YN.
yn2000
2018-06-09 16:21:22 UTC
Permalink
Raw Message
Now, let my try using my phychic ability...
Your AL design is: script (EmptyScript) --> connector (HTTPClientConnector) --> script (ParseReturnXMLPayload).
So, probably you construct the XML message in the script, outside of the HTTPClientConnector, but then you put XML parser in the HTTPClientConnector too, which become a double parsing process.
How about running it without any parser in the HTTPClientConnector?
Rgds. YN.
Rajkiran Paul
2018-06-10 05:42:02 UTC
Permalink
Raw Message
Thank you very much.Its working fine now
Franzw
2018-06-11 06:44:09 UTC
Permalink
Raw Message
Post by Rajkiran Paul
Thank you very much.Its working fine now
Now try to read through the chain of messages here...

1.There is no clear vision of the problem
2.There is no clear vision of the solution

I am glad that YN through his psychic skill seems to have helped you - but the information value of this thread is (unless you are as skilled as YN) obvious very low.

It is not of value saying that things works now - you should tell the people here that is trying to help you on their own time what the problem and solution was - then you have not only received help - you have also provided a solution that may help people doing their homework in the future...

Again - read here : http://www.catb.org/esr/faqs/smart-questions.html

Regards
Franz Wolfhagen

Rajkiran Paul
2018-06-08 18:48:13 UTC
Permalink
Raw Message
00:12:45,280 WARN - [HTTPClientConnector] CTGDIS043I Enabled hook script for callreply_ok is empty.
00:12:45,281 INFO - CTGDIS087I Iterating.
00:12:45,281 INFO - CTGDIS086I No iterator in AssemblyLine, will run single pass only.
00:12:45,281 INFO - CTGDIS092I Using runtime provided entry as working entry (first pass only).
00:12:45,282 INFO - <Changes>
<Description>deleting the user</Description>
<Notes>notes</Notes>
<AccountChange>
<Operation>Delete</Operation>
<User>Sharma, Anand</User>
<BusinessSource>Active Directory</BusinessSource>
<Account>anand.sharma</Account>
<AccountCollector>AD Account Collector</AccountCollector>
</AccountChange>
</Changes>
00:12:45,397 INFO - Here is the message:null
00:12:45,399 INFO - Here is the message:null
00:12:45,400 INFO - Here is the response:<html><head><title>Error</title></head><body>Invalid XML content in the request body. XML document structures must start and end within the same entity.
Query String=cmd=createChangeRequest&amp;token=ws31cfd424fd35662137:-3b988e9c:163d8baec6c:-7f5f0.8362145377423087</body></html>
00:12:45,402 INFO - Here is the responseCode:null
00:12:45,404 INFO - Here is the responseMsg:null
00:12:45,405 INFO - Here is the responsebodytostring:<html><head><title>Error</title></head><body>Invalid XML content in the request body. XML document structures must start and end within the same entity.
Query String=cmd=createChangeRequest&amp;token=ws31cfd424fd35662137:-3b988e9c:163d8baec6c:-7f5f0.8362145377423087</body></html>
00:12:45,408 INFO - CTGDIS088I Finished iterating.
00:12:45,410 ERROR - [HTTPClientConnector] CTGDIS810E handleException - cannot handle exception , close
java.lang.IllegalStateException: There is no in-scope element to end.
at com.ibm.xml.xlxp.api.stax.msg.StAXMessageProvider.throwIllegalStateException(StAXMessageProvider.java:46)
at com.ibm.xml.xlxp.api.stax.XMLStreamWriterImpl.handleEndElement(XMLStreamWriterImpl.java:577)
at com.ibm.xml.xlxp.api.stax.XMLStreamWriterBase.writeEndElement(XMLStreamWriterBase.java:527)
at com.ibm.xml.xlxp.api.stax.XMLOutputFactoryImpl$XMLStreamWriterProxy.writeEndElement(XMLOutputFactoryImpl.java:135)
at com.ibm.di.parser.xml.XMLParser2.writeStaticEndTag(XMLParser2.java:1186)
at com.ibm.di.parser.xml.XMLParser2.writeEndTags(XMLParser2.java:1206)
at com.ibm.di.parser.xml.XMLParser2.closeParser(XMLParser2.java:1519)
at com.ibm.di.connector.Connector.terminate(Connector.java:634)
at com.ibm.di.connector.HTTPClientConnector.terminate(HTTPClientConnector.java:123)
at com.ibm.di.server.AssemblyLineComponent.doConnectorTerminate(AssemblyLineComponent.java:1363)
at com.ibm.di.server.AssemblyLineComponent.close(AssemblyLineComponent.java:1065)
at com.ibm.di.server.AssemblyLine.close(AssemblyLine.java:1392)
at com.ibm.di.server.AssemblyLine.msCloseConn(AssemblyLine.java:4107)
at com.ibm.di.server.AssemblyLine.executeMainStep(AssemblyLine.java:3367)
at com.ibm.di.server.AssemblyLine.executeMainLoop(AssemblyLine.java:2960)
at com.ibm.di.server.AssemblyLine.executeMainLoop(AssemblyLine.java:2943)
at com.ibm.di.server.AssemblyLine.executeAL(AssemblyLine.java:2912)
at com.ibm.di.server.AssemblyLine.run(AssemblyLine.java:1311)
00:12:45,412 INFO - CTGDIS100I Printing the Connector statistics.
00:12:45,415 INFO - [EmptyScript] Calls: 1
00:12:45,416 INFO - [HTTPClientConnector] CallReply:1, Errors:1
00:12:45,417 INFO - [ParseReturnXMLPayload] Calls: 1
00:12:45,418 INFO - CTGDIS104I Total: CallReply:1, Errors:1.
00:12:45,419 INFO - CTGDIS101I Finished printing the Connector statistics.
00:12:45,420 ERROR - CTGDIS077I Failed with error: There is no in-scope element to end..
Loading...