You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by trilochan237 <ka...@gmail.com> on 2013/12/05 07:48:54 UTC

Passing multiple parameters to CXF endpoint

Hi,
Can anyone help in passing multiple parameters to the CXF endpoint which is
expecting multiple parameters.

 from("direct:test1").process(new Processor() {
					
					@Override
					public void process(Exchange arg0) throws Exception {
						arg0.getOut().setBody("testmessage");
						
					}
			
}).to("cxf://http://localhost:8085/FinEdge-General/xrmServices/2011/Organization.svc?serviceClass=com.hcl.flsl.integration.msdn.crmwcf.IOrganizationService");

Error I am facing is:

et the wrong parameter size to invoke the out service, Expect size 3,
Parameter size 1. Please check if the message body matches the CXFEndpoint
POJO Dataformat request.



--
View this message in context: http://camel.465427.n5.nabble.com/Passing-multiple-parameters-to-CXF-endpoint-tp5744345.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Passing multiple parameters to CXF endpoint

Posted by Willem Jiang <wi...@gmail.com>.
You can use Spring to configure the CXF endpoint like this

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:cxf="http://camel.apache.org/schema/cxf"
       xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
       http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
       http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
    ">
 
   <http-conf:conduit name="*.http-conduit">
		<http-conf:client ContentType="application/soap+xml"/>
   </http-conf:conduit>

   <cxf:cxfEndpoint id="springEndpoint" address="http://localhost:9000/CxfTimeoutTest/SoapContext/SoapPort"
    		serviceClass="org.apache.hello_world_soap_http.Greeter”/>


</beans>

The camel route can be 
from(“dirt:start”).to(“cxf:bean:sprintEndpoint”)

-- 
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 December 7, 2013 at 11:36:36 AM, trilochan237 (kartheektrilochan237@gmail.com) wrote:
>
>Hi Willem,
>
>If i use the client program example from camel cxf examples and set the
>content type in HTTPClientPolicy,
>but could you please tell me how to set the same in Exchange type when
>calling the webservice by creating a CXFendpoint
>
>
>*CLient Program:-*
>
>JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
>.
>.
>.
>Client client = ClientProxy.getClient(port);
>HTTPConduit http = (HTTPConduit) client.getConduit();
>HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
>* httpClientPolicy.setContentType("application/soap+xml");*
>http.setClient(httpClientPolicy);
>....
>...
>..
>client.retrieve(arg1,arg2,arg3);
>
>
>
>*Cxf Endpoint:-*
>
>from("direct:test").process(new Processor(){
>public void processor(Exchange exchange)
>{
>Object[] objectarray=new Object[3];
>.
>.
>.
>exchange.getOut().setBody(objarry);
>}
>}).to("cxf://http://10.103.91.55:5555/FinEdge-General/xrmServices/2011/Organization.svc?serviceClass=com.hcl.flsl.integration.msdn.crmwcf.IOrganizationService&defaultOperationName=Retrieve")
>
>
>
>
>--
>View this message in context: http://camel.465427.n5.nabble.com/Passing-multiple-parameters-to-CXF-endpoint-tp5744345p5744416.html
>Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: Passing multiple parameters to CXF endpoint

Posted by trilochan237 <ka...@gmail.com>.
Hi Willem,

If i use the client program example from camel cxf examples and set the
content type in HTTPClientPolicy,
but could you please tell me how to set the same in Exchange type when
calling the webservice by creating a CXFendpoint


*CLient Program:-*

JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
.
.
.
 Client client = ClientProxy.getClient(port);
       HTTPConduit http = (HTTPConduit) client.getConduit();
        HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
       * httpClientPolicy.setContentType("application/soap+xml");*
        http.setClient(httpClientPolicy);
....
...
..
client.retrieve(arg1,arg2,arg3);



*Cxf Endpoint:-*

from("direct:test").process(new Processor(){
public void processor(Exchange exchange)
{
Object[] objectarray=new Object[3];
.
.
.
exchange.getOut().setBody(objarry);
}
}).to("cxf://http://10.103.91.55:5555/FinEdge-General/xrmServices/2011/Organization.svc?serviceClass=com.hcl.flsl.integration.msdn.crmwcf.IOrganizationService&defaultOperationName=Retrieve")




--
View this message in context: http://camel.465427.n5.nabble.com/Passing-multiple-parameters-to-CXF-endpoint-tp5744345p5744416.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Passing multiple parameters to CXF endpoint

Posted by trilochan237 <ka...@gmail.com>.
Hi Willem,

I am facing with different kind of error as i am passing an object array in
the body.

Please suggest me in solving the below error.

*
org.apache.cxf.transport.http.HTTPException: HTTP response '415: Cannot
process the message because the content type 'text/xml; charset=UTF-8' was
not the expected type 'application/soap+xml; charset=utf-8'.' when
communicating with
http://10.103.91.55:5555/FinEdge-General/xrmServices/2011/Organization.svc*



--
View this message in context: http://camel.465427.n5.nabble.com/Passing-multiple-parameters-to-CXF-endpoint-tp5744345p5744386.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Passing multiple parameters to CXF endpoint

Posted by trilochan237 <ka...@gmail.com>.
Hi,

I tried with that attribute too, but the error is same

to("cxf://http://10.103.91.55:5555/FinEdge-General/xrmServices/2011/Organization.svc?serviceClass=com.hcl.flsl.integration.msdn.crmwcf.IOrganizationService&defaultOperationName=Retrieve")



--
View this message in context: http://camel.465427.n5.nabble.com/Passing-multiple-parameters-to-CXF-endpoint-tp5744345p5744349.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Passing multiple parameters to CXF endpoint

Posted by Willem Jiang <wi...@gmail.com>.
Hi,

You need set up the defaultOperationName option in the url if you don’t set the OperationName header on the message.

-- 
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 December 5, 2013 at 2:49:59 PM, trilochan237 (kartheektrilochan237@gmail.com) wrote:
>
>Hi,
>Can anyone help in passing multiple parameters to the CXF endpoint which is
>expecting multiple parameters.
>
>from("direct:test1").process(new Processor() {
>
>@Override
>public void process(Exchange arg0) throws Exception {
>arg0.getOut().setBody("testmessage");
>
>}
>
>}).to("cxf://http://localhost:8085/FinEdge-General/xrmServices/2011/Organization.svc?serviceClass=com.hcl.flsl.integration.msdn.crmwcf.IOrganizationService");
>
>Error I am facing is:
>
>et the wrong parameter size to invoke the out service, Expect size 3,
>Parameter size 1. Please check if the message body matches the CXFEndpoint
>POJO Dataformat request.
>
>
>
>--
>View this message in context: http://camel.465427.n5.nabble.com/Passing-multiple-parameters-to-CXF-endpoint-tp5744345.html
>Sent from the Camel - Users mailing list archive at Nabble.com.
>