You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by imranrazakhan <im...@gmail.com> on 2014/03/04 11:22:30 UTC

camel-xmlrpc response not showing

Hi,

I have develop a xmlrpc component example but i am unable to get response

Main Class:
 XmlRpcComponent 	xrpc	=	new XmlRpcComponent();
 xrpc.setCamelContext(camelContext);
			 
 camelContext.addRoutes(new XmlRpcRouteBuilder());
 camelContext.addComponent("xrpc",xrpc);
 camelContext.start();

RouteBuilder:

from("timer://foo?delay=0&period=25000")
.process(new MyProcessor())
.to("xmlrpc:http://x.x.x.x:110/Air?synchronous=true&basicEncoding=iso-8859-1&basicUserName=xx"
+ "&basicPassword=xx&encoding=UTF-8&userAgent=xx")
.process(new ResultProcessor())
.end();

MyProcess:

public void process(Exchange exchange) throws Exception {
		
		System.out.println("In my processor");
	
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("user", "xxx");
		
        exchange.getIn().setHeader(XmlRpcConstants.METHOD_NAME,
"GetDetails");
        exchange.getIn().setBody( new Object [] { params } );
		
	}

ResponseProcessor:

public void process(Exchange exchange) throws Exception {
		System.out.println("in result");
		System.out.println("in result="+exchange.getIn().getBody());
		System.out.println("in out result="+exchange.getOut().getBody());
	}

I have enable ethereal trace and this application send and saw successful
request and response from xmlrpc server but i am not able to capture it,
infact ResponseProcessor is not called.

Regards



--
View this message in context: http://camel.465427.n5.nabble.com/camel-xmlrpc-response-not-showing-tp5748275.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-xmlrpc response not showing

Posted by Willem Jiang <wi...@gmail.com>.
Current we just throw the exception out, so you can handle the exception in the camel route yourself. 
BTW, ErrorHandler or onException could help you to do that. 

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On March 5, 2014 at 4:42:26 PM, imranrazakhan (imranrazakhan@gmail.com) wrote:
> Hi Willem,
>  
> I sorted issue, Apache camel is not providing response if it contain any
> exception from server like following, but it suppose to send back response
> to processor, its not HTTP error.
>  
> Or i suppose to handle such errors with some onException????
>  
>  
>  
>  
>  
>  
>  
> faultCode
> 1003
>  
>  
> faultString
> Data out of bounds
>  
>  
>  
>  
>  
>  
> Regards
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-xmlrpc-response-not-showing-tp5748275p5748319.html  
> Sent from the Camel - Users mailing list archive at Nabble.com.
>  


Re: camel-xmlrpc response not showing

Posted by imranrazakhan <im...@gmail.com>.
Hi Willem,

I sorted issue, Apache camel is not providing response if it contain any
exception from server like following, but it suppose to send back response
to processor, its not HTTP error.

Or i suppose to handle such errors with some onException????

<?xml version="1.0" encoding="utf-8"?>
<methodResponse>
<fault>
<value>
<struct>
<member>
<name>faultCode</name>
<value><i4>1003</i4></value>
</member>
<member>
<name>faultString</name>
<value><string>Data out of bounds</string></value>
</member>
</struct>
</value>
</fault>
</methodResponse>

Regards



--
View this message in context: http://camel.465427.n5.nabble.com/camel-xmlrpc-response-not-showing-tp5748275p5748319.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-xmlrpc response not showing

Posted by Willem Jiang <wi...@gmail.com>.
Can you enable the tracer[1] in the camel context? 
It could help you to find more information.

[1]http://camel.apache.org/tracer

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com(http://willemjiang.blogspot.com/) (English)
http://jnn.iteye.com(http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On March 4, 2014 at 6:23:03 PM, imranrazakhan (imranrazakhan@gmail.com) wrote:
>  
> Hi,
>  
> I have develop a xmlrpc component example but i am unable to get  
> response
>  
> Main Class:
> XmlRpcComponent xrpc = new XmlRpcComponent();
> xrpc.setCamelContext(camelContext);
>  
> camelContext.addRoutes(new XmlRpcRouteBuilder());
> camelContext.addComponent("xrpc",xrpc);
> camelContext.start();
>  
> RouteBuilder:
>  
> from("timer://foo?delay=0&period=25000")
> .process(new MyProcessor())
> .to("xmlrpc:http://x.x.x.x:110/Air?synchronous=true&basicEncoding=iso-8859-1&basicUserName=xx"  
> + "&basicPassword=xx&encoding=UTF-8&userAgent=xx")
> .process(new ResultProcessor())
> .end();
>  
> MyProcess:
>  
> public void process(Exchange exchange) throws Exception {  
>  
> System.out.println("In my processor");
>  
> Map params = new HashMap();  
> params.put("user", "xxx");
>  
> exchange.getIn().setHeader(XmlRpcConstants.METHOD_NAME,  
> "GetDetails");
> exchange.getIn().setBody( new Object [] { params } );
>  
> }
>  
> ResponseProcessor:
>  
> public void process(Exchange exchange) throws Exception {  
> System.out.println("in result");
> System.out.println("in result="+exchange.getIn().getBody());  
> System.out.println("in out result="+exchange.getOut().getBody());  
> }
>  
> I have enable ethereal trace and this application send and saw  
> successful
> request and response from xmlrpc server but i am not able to capture  
> it,
> infact ResponseProcessor is not called.
>  
> Regards
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-xmlrpc-response-not-showing-tp5748275.html  
> Sent from the Camel - Users mailing list archive at Nabble.com.  
>