tXMLRPCInput Failed to parse servers response

Highlighted
Four Stars

tXMLRPCInput Failed to parse servers response

Hi all,

 

I got the error below when I execute the tXMLRPCInput component:

[FATAL]: comores.testxmlrpc_0_1.testXMLRPC - tXMLRPCInput_1 Failed to parse servers response: Expected methodResponse element, got html
Exception in component tXMLRPCInput_1
org.apache.xmlrpc.client.XmlRpcClientException: Failed to parse servers response: Expected methodResponse element, got html
at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:177)
at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:145)
at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:94)
at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:53)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:166)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:136)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:125)
at comores.testxmlrpc_0_1.testXMLRPC.tXMLRPCInput_1Process(testXMLRPC.java:704)
at comores.testxmlrpc_0_1.testXMLRPC.tJava_1Process(testXMLRPC.java:379)
at comores.testxmlrpc_0_1.testXMLRPC.runJobInTOS(testXMLRPC.java:1111)
at comores.testxmlrpc_0_1.testXMLRPC.main(testXMLRPC.java:969)
Caused by:
org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 7; Expected methodResponse element, got html
at org.apache.xmlrpc.parser.XmlRpcResponseParser.startElement(XmlRpcResponseParser.java:79)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:380)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:619)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3129)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:880)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:118)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:504)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:175)
at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:145)
at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:94)
at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:53)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:166)

 

Could you help me resolve it?

 

Thanks

Nine Stars

Re: tXMLRPCInput Failed to parse servers response

It sounds like the RPC server is returning a web page in HTML rather than XML.  You are probably hitting the wrong URL or the server is configured incorrectly such that it is behaving as a web server instead of an RPC server.  Have you tested the connection outside of Talend to see if it works?  Can you log the response and post it here?

--
Please give Kudos and mark topics as solved where appropriate.
Four Stars

Re: tXMLRPCInput Failed to parse servers response

Hi,

 

Thanks for your response.

See attached the response from the server.

 

Four Stars

Re: tXMLRPCInput Failed to parse servers response

Hi,

 

I know why I got html, the request is malformed.

 

This is the request sent by the txmlrpcInput structure:

<?xml version="1.0" encoding="UTF-8"?><methodCall xmlns:ex="http://ws.apache.org/xmlrpc/namespaces/extensions"><methodName>GetAccountDetails</methodName><params><param><value>EXT</value></param><param><value>TEST</value></param><param><value>20190711154600</value></param><param><value>20190711T15:47:00+0300</value></param><param><value>00057</value></param></params></methodCall>

 

This was expected by the server:

<?xml version="1.0"?><methodCall><methodName>GetAccountDetails</methodName><params><param><value><struct><member><name>originNodeType</name><value><string>EXT</string></value></member><member><name>originHostName</name><value><string>Test</string></value></member><member><name>originTransactionID</name><value><string>20180130090600</string></value></member><member><name>originTimeStamp</name><value><dateTime.iso8601>20190304T17:33:00+0300</dateTime.iso8601></value></member><member><name>subscriberNumber</name><value><string>00057</string></value></member></struct></value></param></params></methodCall>

 

 

I don't know how to configure the tXMLRCPInput to set those "member" and "struct" tag...

 

 

Thanks and regards

Nine Stars

Re: tXMLRPCInput Failed to parse servers response

Something to try:

In a tJavaRow or tJava before your rpc call, create a map to hold your parameters and put it in the global map like this:

java.util.Map<String,Object> params = new java.util.HashMap<String,Object>();
params.put(“originNodeType”,”EXT”);
params.put(“originTimestamp”,new java.util.Date());
// ... etc. for all your params

globalMap.put(“params”,params);

In your tXmlRpcInput component add one parameter called anything with a value of

(java.util.Map)globalMap.get(“params”)

Set the type of that one parameter to java.util.Map.class

 

Try it out!

 

see here for more info

https://github.com/moses-smt/mosesdecoder/blob/master/contrib/server/SampleClient.java

--
Please give Kudos and mark topics as solved where appropriate.
Four Stars

Re: tXMLRPCInput Failed to parse servers response

Hi talend team,

 

I've tried your advice but the problem still appears because some tags in the request are not handled.

Capture.PNG

Could you help us please.

 

Best regards.

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Why Companies Move to the Cloud: 7 Success Stories

Learn how and why companies are moving to the Cloud

Read Now

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch