You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by skompelly <sk...@gmail.com> on 2011/09/02 13:19:37 UTC

cxf : bean producer consumer

Hi

I am tring to invoke a webserive method from soapui

1) WSDL first approach , generated all the files using maven goal is
wsdl2java 

2) In the route i have below code 

ROUTER_ENDPOINT_URI = "cxf://" + ROUTER_ADDRESS + "?" + SERVICE_CLASS + "&"
+ WSDL_LOCATION + "&" + SERVICE_NAME + "&"
			+ SOAP_OVER_HTTP_ROUTER + "&dataFormat=POJO";

SERVICE_ENDPOINT_URI = "cxf://" + SERVICE_ADDRESS + "?" + SERVICE_CLASS +
"&" + WSDL_LOCATION + "&" + SERVICE_NAME + "&" + SOAP_OVER_HTTP
			+ "&dataFormat=POJO";

	from(ROUTER_ENDPOINT_URI)  // this is listening at 9004
	.processRef("testProcessor")
	.to(SERVICE_ENDPOINT_URI) // this one port is 9000
	.stop()
	.end();

once i run mvn camel:run -> 9004 port is listening, but 9000 port its not
listening

as a result  i can see the wsdl xml in browser for 9004 but not for 9000.

When i sent a message through soapui to invoke a method, i am getting below
error.
         <faultcode>soap:Server</faultcode>
         <faultstring>Could not send Message.</faultstring>

In the logs i am getting the error, attached is log
http://camel.465427.n5.nabble.com/file/n4761986/file.txt file.txt 

Please can anyone let me know i am i doing anything wrong.

Same one i am trying with cxf:bean:endpoint  , i got the same error. 

Thanks,
Santosh



I am using cxf:bean:[endpoint]

--
View this message in context: http://camel.465427.n5.nabble.com/cxf-bean-producer-consumer-tp4761986p4761986.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: cxf : bean producer consumer

Posted by skompelly <sk...@gmail.com>.
Yes, both share the same service class.

Gave serviceclass = interface name generated by the wsdl. Is this correct?

Thanks,
Santosh


On Sun, Sep 4, 2011 at 9:12 AM, Willem.Jiang [via Camel] <
ml-node+4767056-15208910-222006@n5.nabble.com> wrote:

> Do B, A share the same serviceClass ?
> If not, you may need to do some transformation in your route.
>
> On 9/2/11 11:04 PM, skompelly wrote:
>
> > I have started the "cxf:bean:B" in the cxf.xml file as
> >
> >   <jaxws:endpoint id="serviceEndpoint"
> > implementor="...........class name..."/>
> >
> >
> > Is the above is the only way i can start or is there any way?
> >
> > Now i am getting error at cxf:bean:B endpoint unmarshalling error. I have
>
> > correct object in the exchange from the cxf:bean:A. Any idea on this?
> >
> > Thanks,
> > Santosh
> >
> >
> >
> >
> >
> > --
> > View this message in context:
> http://camel.465427.n5.nabble.com/cxf-bean-producer-consumer-tp4761986p4762693.html
>
> > Sent from the Camel Development mailing list archive at Nabble.com.
> >
>
>
> --
> Willem
> ----------------------------------
> FuseSource
> Web: http://www.fusesource.com
> Blog:    http://willemjiang.blogspot.com (English)
>           http://jnn.javaeye.com (Chinese)
> Twitter: willemjiang
> Weibo: willemjiang
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://camel.465427.n5.nabble.com/cxf-bean-producer-consumer-tp4761986p4767056.html
>  To unsubscribe from cxf : bean producer consumer, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4761986&code=c2tvbXBlbGx5QGdtYWlsLmNvbXw0NzYxOTg2fDE3NDA0Mzc2OTM=>.
>
>



-- 
*Thanks & Regards,*
Santosh Kompelli


--
View this message in context: http://camel.465427.n5.nabble.com/cxf-bean-producer-consumer-tp4761986p4767294.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: cxf : bean producer consumer

Posted by skompelly <sk...@gmail.com>.
Hi 

Thanks for all your help. 

i have exposed the soap web service through camel.

Below is my code structure, it is consuming the message sent from soap ui.

<endpoint> - soap endpoint configured in context file

from wsdl all the files are generted.

  from("cxf:bean:<endpoint>) - exposed web service 
         .choice()
            .when(header(CxfConstants.OPERATION_NAME).isEqualTo("sayHello"))
            	.processRef("createProcessor") - 
            	.wireTap("externalactivemq:queue:<queue name>")
            .when(header(CxfConstants.OPERATION_NAME).isEqualTo("sayHi"))
        	.processRef("deleteDeleteProcessor")
        	.wireTap("externalactivemq:queue:<queue name")
         .end()
         .processref("responseprocessor") - created response xml, sent to
the invoker of webservice.
         .stop()
         .end();

I have few issues facning from the above code 

1) if active mq is down , then wireTap is not throwing connect exception.
How to get connect exception?
2) Replacing wireTap with .to its working, but the response is sent to the
client whatever the value is in the body (i.e input message)
2) web service client is getting the reponse xml in the cdata section. How
to get the response xml correctly?

Thanks in advance,

Regards,
Santosh

--
View this message in context: http://camel.465427.n5.nabble.com/cxf-bean-producer-consumer-tp4761986p4778434.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: cxf : bean producer consumer

Posted by skompelly <sk...@gmail.com>.
Hi

Thanks for the help.

Now i am able to invoke webservice method.

Now i want to send the response back to the client and process the request
message, which EIP pattern i have to use?

I tried with wireTap and enrich, i didn't got the expected result. Please
suggest.

Thanks,
Santosh


On Sun, Sep 4, 2011 at 12:11 PM, santosh kompelli <sk...@gmail.com>wrote:

> Yes, both share the same service class.
>
> Gave serviceclass = interface name generated by the wsdl. Is this correct?
>
> Thanks,
> Santosh
>
>
>
> On Sun, Sep 4, 2011 at 9:12 AM, Willem.Jiang [via Camel] <
> ml-node+4767056-15208910-222006@n5.nabble.com> wrote:
>
>> Do B, A share the same serviceClass ?
>> If not, you may need to do some transformation in your route.
>>
>> On 9/2/11 11:04 PM, skompelly wrote:
>>
>> > I have started the "cxf:bean:B" in the cxf.xml file as
>> >
>> >   <jaxws:endpoint id="serviceEndpoint"
>> > implementor="...........class name..."/>
>> >
>> >
>> > Is the above is the only way i can start or is there any way?
>> >
>> > Now i am getting error at cxf:bean:B endpoint unmarshalling error. I
>> have
>> > correct object in the exchange from the cxf:bean:A. Any idea on this?
>> >
>> > Thanks,
>> > Santosh
>> >
>> >
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> http://camel.465427.n5.nabble.com/cxf-bean-producer-consumer-tp4761986p4762693.html
>>
>> > Sent from the Camel Development mailing list archive at Nabble.com.
>> >
>>
>>
>> --
>> Willem
>> ----------------------------------
>> FuseSource
>> Web: http://www.fusesource.com
>> Blog:    http://willemjiang.blogspot.com (English)
>>           http://jnn.javaeye.com (Chinese)
>> Twitter: willemjiang
>> Weibo: willemjiang
>>
>>
>> ------------------------------
>>  If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://camel.465427.n5.nabble.com/cxf-bean-producer-consumer-tp4761986p4767056.html
>>  To unsubscribe from cxf : bean producer consumer, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4761986&code=c2tvbXBlbGx5QGdtYWlsLmNvbXw0NzYxOTg2fDE3NDA0Mzc2OTM=>.
>>
>>
>
>
>
> --
> *Thanks & Regards,*
> Santosh Kompelli
>
>


-- 
*Thanks & Regards,*
Santosh Kompelli


--
View this message in context: http://camel.465427.n5.nabble.com/cxf-bean-producer-consumer-tp4761986p4769814.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: cxf : bean producer consumer

Posted by Willem Jiang <wi...@gmail.com>.
Do B, A share the same serviceClass ?
If not, you may need to do some transformation in your route.

On 9/2/11 11:04 PM, skompelly wrote:
> I have started the "cxf:bean:B" in the cxf.xml file as
>
>   	<jaxws:endpoint id="serviceEndpoint"
> 		implementor="...........class name..."/>
>
>
> Is the above is the only way i can start or is there any way?
>
> Now i am getting error at cxf:bean:B endpoint unmarshalling error. I have
> correct object in the exchange from the cxf:bean:A. Any idea on this?
>
> Thanks,
> Santosh
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/cxf-bean-producer-consumer-tp4761986p4762693.html
> Sent from the Camel Development mailing list archive at Nabble.com.
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Re: cxf : bean producer consumer

Posted by skompelly <sk...@gmail.com>.
I have started the "cxf:bean:B" in the cxf.xml file as 

 	<jaxws:endpoint id="serviceEndpoint"
		implementor="...........class name..."/>


Is the above is the only way i can start or is there any way? 
 
Now i am getting error at cxf:bean:B endpoint unmarshalling error. I have
correct object in the exchange from the cxf:bean:A. Any idea on this?

Thanks, 
Santosh





--
View this message in context: http://camel.465427.n5.nabble.com/cxf-bean-producer-consumer-tp4761986p4762693.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: cxf : bean producer consumer

Posted by Willem Jiang <wi...@gmail.com>.
First you route could be like this,
from(cxf:bean:A).to(cxf:bean:B).

from part is CXF server, to part is CXF client.

This route just redirect the request from A to B.

Now if you want the SOAP UI get the response, you need to start a Web 
service for the CXF client B to access.


On 9/2/11 9:41 PM, skompelly wrote:
> Thanks Willem for your quick responses.
>
> Then this case
>
> 1) routeEndPoint is listening at 9004 , this will consume the message from
> soapui.
> 2) serviceEndPoint has to listen at 9000, this will invoke the actual
> method.
>
> Means for every web sevice with WSDL , there should be two port open inorder
> to execute the method. Is this true my understanding?
>
> Is there any approach other than this. So that when i send a request from
> soapui, i want to invoke the method directly serviceEndPoint.
>
> Thanks,
> Santosh
>
>
>
> On Fri, Sep 2, 2011 at 3:02 PM, Willem.Jiang [via Camel]<
> ml-node+4762282-1151138681-222006@n5.nabble.com>  wrote:
>
>> You need to make sure there is a web service which listen to address of
>> serviceEndpoint.
>>
>> On Fri Sep  2 20:52:05 2011, skompelly wrote:
>>
>>> yeah i sent the request to routerEndpoint,
>>>
>>> its consumed and serviceEndpoint is throwing the error message as
>>>
>>> "could not send message"  in soapui
>>>
>>>
>>> --
>>> View this message in context:
>> http://camel.465427.n5.nabble.com/cxf-bean-producer-consumer-tp4761986p4762239.html
>>
>>> Sent from the Camel Development mailing list archive at Nabble.com.
>>
>>
>>
>> --
>> Willem
>> ----------------------------------
>> FuseSource
>> Web: http://www.fusesource.com
>> Blog:    http://willemjiang.blogspot.com (English)
>>           http://jnn.javaeye.com (Chinese)
>> Twitter: willemjiang
>> Weibo: willemjiang
>>
>>
>>
>> ------------------------------
>>   If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://camel.465427.n5.nabble.com/cxf-bean-producer-consumer-tp4761986p4762282.html
>>   To unsubscribe from cxf : bean producer consumer, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4761986&code=c2tvbXBlbGx5QGdtYWlsLmNvbXw0NzYxOTg2fDE3NDA0Mzc2OTM=>.
>>
>>
>
>
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Re: cxf : bean producer consumer

Posted by skompelly <sk...@gmail.com>.
Thanks Willem for your quick responses.

Then this case

1) routeEndPoint is listening at 9004 , this will consume the message from
soapui.
2) serviceEndPoint has to listen at 9000, this will invoke the actual
method.

Means for every web sevice with WSDL , there should be two port open inorder
to execute the method. Is this true my understanding?

Is there any approach other than this. So that when i send a request from
soapui, i want to invoke the method directly serviceEndPoint.

Thanks,
Santosh



On Fri, Sep 2, 2011 at 3:02 PM, Willem.Jiang [via Camel] <
ml-node+4762282-1151138681-222006@n5.nabble.com> wrote:

> You need to make sure there is a web service which listen to address of
> serviceEndpoint.
>
> On Fri Sep  2 20:52:05 2011, skompelly wrote:
>
> > yeah i sent the request to routerEndpoint,
> >
> > its consumed and serviceEndpoint is throwing the error message as
> >
> > "could not send message"  in soapui
> >
> >
> > --
> > View this message in context:
> http://camel.465427.n5.nabble.com/cxf-bean-producer-consumer-tp4761986p4762239.html
>
> > Sent from the Camel Development mailing list archive at Nabble.com.
>
>
>
> --
> Willem
> ----------------------------------
> FuseSource
> Web: http://www.fusesource.com
> Blog:    http://willemjiang.blogspot.com (English)
>          http://jnn.javaeye.com (Chinese)
> Twitter: willemjiang
> Weibo: willemjiang
>
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://camel.465427.n5.nabble.com/cxf-bean-producer-consumer-tp4761986p4762282.html
>  To unsubscribe from cxf : bean producer consumer, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4761986&code=c2tvbXBlbGx5QGdtYWlsLmNvbXw0NzYxOTg2fDE3NDA0Mzc2OTM=>.
>
>



-- 
*Thanks & Regards,*
Santosh Kompelli


--
View this message in context: http://camel.465427.n5.nabble.com/cxf-bean-producer-consumer-tp4761986p4762422.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: cxf : bean producer consumer

Posted by Willem Jiang <wi...@gmail.com>.
You need to make sure there is a web service which listen to address of 
serviceEndpoint.

On Fri Sep  2 20:52:05 2011, skompelly wrote:
> yeah i sent the request to routerEndpoint,
> 
> its consumed and serviceEndpoint is throwing the error message as
> 
> "could not send message"  in soapui
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/cxf-bean-producer-consumer-tp4761986p4762239.html
> Sent from the Camel Development mailing list archive at Nabble.com.



-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang 
Weibo: willemjiang 


Re: cxf : bean producer consumer

Posted by skompelly <sk...@gmail.com>.
yeah i sent the request to routerEndpoint,

its consumed and serviceEndpoint is throwing the error message as 

"could not send message"  in soapui


--
View this message in context: http://camel.465427.n5.nabble.com/cxf-bean-producer-consumer-tp4761986p4762239.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: cxf : bean producer consumer

Posted by Willem Jiang <wi...@gmail.com>.
It looks like you should send the request to routerEndpoint address

"http://localhost:9003/CamelContext/RouterPort"



On 9/2/11 8:19 PM, skompelly wrote:
>
> Okay thanks,
>
> How to invoke a webservice method (wsdl first) from the soapui?
>
> Web service is published at 9004 as below, able to view the wsdl in browser.
> Not able to invoke the method exposed. For this do i have to do anything. i
> was checking this example where i have one port for routerEndpoint and other
> as serviceEndPoint. But not successful with the below configuration too.
>
> Please let me know how i can successfully invoke a web service method using
> cxf or cxf:bean from soap ui?
>
>       <cxf:cxfEndpoint id="routerEndpoint"
> address="http://localhost:9003/CamelContext/RouterPort"
>       		serviceClass="org.apache.hello_world_soap_http.GreeterImpl"/>
>       <cxf:cxfEndpoint id="serviceEndpoint"
> address="http://localhost:9000/SoapContext/SoapPort"
>       		wsdlURL="testutils/hello_world.wsdl"
>       		serviceClass="org.apache.hello_world_soap_http.Greeter"
>       		endpointName="s:SoapPort"
>       		serviceName="s:SOAPService"
>       	xmlns:s="http://apache.org/hello_world_soap_http" />
>
> Thanks in advance,
>
> Regards,
> Santosh
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/cxf-bean-producer-consumer-tp4761986p4762139.html
> Sent from the Camel Development mailing list archive at Nabble.com.
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Re: cxf : bean producer consumer

Posted by skompelly <sk...@gmail.com>.
Okay thanks, 

How to invoke a webservice method (wsdl first) from the soapui?

Web service is published at 9004 as below, able to view the wsdl in browser.
Not able to invoke the method exposed. For this do i have to do anything. i
was checking this example where i have one port for routerEndpoint and other
as serviceEndPoint. But not successful with the below configuration too.

Please let me know how i can successfully invoke a web service method using
cxf or cxf:bean from soap ui?

     <cxf:cxfEndpoint id="routerEndpoint"
address="http://localhost:9003/CamelContext/RouterPort"
     		serviceClass="org.apache.hello_world_soap_http.GreeterImpl"/>
     <cxf:cxfEndpoint id="serviceEndpoint"
address="http://localhost:9000/SoapContext/SoapPort"
     		wsdlURL="testutils/hello_world.wsdl"
     		serviceClass="org.apache.hello_world_soap_http.Greeter"
     		endpointName="s:SoapPort"
     		serviceName="s:SOAPService"
     	xmlns:s="http://apache.org/hello_world_soap_http" />

Thanks in advance,

Regards,
Santosh

--
View this message in context: http://camel.465427.n5.nabble.com/cxf-bean-producer-consumer-tp4761986p4762139.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: cxf : bean producer consumer

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

You misunderstand what the To means, the to(SERVICE_ENDPOINT_URI)  
means it will connect to an external server which is listening on port  
9000, this port isn't started by camel router, it should be some  
external server already there.

Freeman

On 2011-9-2, at 下午7:19, skompelly wrote:

> Hi
>
> I am tring to invoke a webserive method from soapui
>
> 1) WSDL first approach , generated all the files using maven goal is
> wsdl2java
>
> 2) In the route i have below code
>
> ROUTER_ENDPOINT_URI = "cxf://" + ROUTER_ADDRESS + "?" +  
> SERVICE_CLASS + "&"
> + WSDL_LOCATION + "&" + SERVICE_NAME + "&"
> 			+ SOAP_OVER_HTTP_ROUTER + "&dataFormat=POJO";
>
> SERVICE_ENDPOINT_URI = "cxf://" + SERVICE_ADDRESS + "?" +  
> SERVICE_CLASS +
> "&" + WSDL_LOCATION + "&" + SERVICE_NAME + "&" + SOAP_OVER_HTTP
> 			+ "&dataFormat=POJO";
>
> 	from(ROUTER_ENDPOINT_URI)  // this is listening at 9004
> 	.processRef("testProcessor")
> 	.to(SERVICE_ENDPOINT_URI) // this one port is 9000
> 	.stop()
> 	.end();
>
> once i run mvn camel:run -> 9004 port is listening, but 9000 port  
> its not
> listening
>
> as a result  i can see the wsdl xml in browser for 9004 but not for  
> 9000.
>
> When i sent a message through soapui to invoke a method, i am  
> getting below
> error.
>         <faultcode>soap:Server</faultcode>
>         <faultstring>Could not send Message.</faultstring>
>
> In the logs i am getting the error, attached is log
> http://camel.465427.n5.nabble.com/file/n4761986/file.txt file.txt
>
> Please can anyone let me know i am i doing anything wrong.
>
> Same one i am trying with cxf:bean:endpoint  , i got the same error.
>
> Thanks,
> Santosh
>
>
>
> I am using cxf:bean:[endpoint]
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/cxf-bean-producer-consumer-tp4761986p4761986.html
> Sent from the Camel Development mailing list archive at Nabble.com.

---------------------------------------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com