Re: How to invoke CXF webservice from processor bean
I have something like this working in a unit test. Maybe you can try something similar: public static final String CXF_OPERATION_NAME = operation; public static final String CXF_OPERATION_NAMESPACE = http://opNamespace;; @Test @DirtiesContext public void myTest() throws Exception { String pathToFileForExchangeBody=src/test/resources/xmlInstances/mypayload.xml; Exchange senderExchange = createCXFExchange(pathToFileForExchangeBody); //Send the one-way exchange. Using template.send will send a one way message Exchange returnExchange = template.send(cxf:bean:mybean?dataFormat=PAYLOADloggingFeatureEnabled=truesynchronous=true, senderExchange); //Use getException to see if we received an exception if (returnExchange.getException() != null) { throw new Exception(returnExchange.getException()); } } private Exchange createCXFExchange(String pathToFileForExchangeBody) { //Create a new exchange Exchange senderExchange = new DefaultExchange(context); //Set the operation name and operation namespace for the CXF exchange senderExchange.getIn().setHeader(CxfConstants.OPERATION_NAME, CXF_OPERATION_NAME); senderExchange.getIn().setHeader(CxfConstants.OPERATION_NAMESPACE, CXF_OPERATION_NAMESPACE); //Read the icotns request file from the file system, this one has no endpoint to route to File inputFile = new File(pathToFileForExchangeBody); assertTrue(inputFile.exists()); log.debug(Does input file exist: + inputFile.exists()); //Set it as the message message body senderExchange.getIn().setBody(inputFile); return senderExchange; } -- View this message in context: http://camel.465427.n5.nabble.com/How-to-invoke-CXF-webservice-from-processor-bean-tp5716272p5716569.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to invoke CXF webservice from processor bean
Yeah, this example is setting the right headers on the message which is passed by the exchange. On Sat Jul 28 06:17:56 2012, ychawla wrote: I have something like this working in a unit test. Maybe you can try something similar: public static final String CXF_OPERATION_NAME = operation; public static final String CXF_OPERATION_NAMESPACE = http://opNamespace;; @Test @DirtiesContext public void myTest() throws Exception { String pathToFileForExchangeBody=src/test/resources/xmlInstances/mypayload.xml; Exchange senderExchange = createCXFExchange(pathToFileForExchangeBody); //Send the one-way exchange. Using template.send will send a one way message Exchange returnExchange = template.send(cxf:bean:mybean?dataFormat=PAYLOADloggingFeatureEnabled=truesynchronous=true, senderExchange); //Use getException to see if we received an exception if (returnExchange.getException() != null) { throw new Exception(returnExchange.getException()); } } private Exchange createCXFExchange(String pathToFileForExchangeBody) { //Create a new exchange Exchange senderExchange = new DefaultExchange(context); //Set the operation name and operation namespace for the CXF exchange senderExchange.getIn().setHeader(CxfConstants.OPERATION_NAME, CXF_OPERATION_NAME); senderExchange.getIn().setHeader(CxfConstants.OPERATION_NAMESPACE, CXF_OPERATION_NAMESPACE); //Read the icotns request file from the file system, this one has no endpoint to route to File inputFile = new File(pathToFileForExchangeBody); assertTrue(inputFile.exists()); log.debug(Does input file exist: + inputFile.exists()); //Set it as the message message body senderExchange.getIn().setBody(inputFile); return senderExchange; } -- View this message in context: http://camel.465427.n5.nabble.com/How-to-invoke-CXF-webservice-from-processor-bean-tp5716272p5716569.html Sent from the Camel - Users 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: How to invoke CXF webservice from processor bean
You just set the header on the exchange which is passed to process method. You should set the header on the ProducerTemplate, please use the method requestBodyAndHeader instead of requestBody. On Fri, Jul 20, 2012 at 9:34 AM, jeyaseelan78 jeyaseelansuku...@gmail.comwrote: Hi, I have processor bean using which i would like to invoke an external webservice. I need to pass the operation name as well as parameters. If I pass the parameter in header then its ignored and if i send it via uri then I am getting error as invalid parameter name. public void process(Exchange exchange) throws Exception { ListString params = new ArrayListString(); params.add((String)exchange.getIn().getBody()); exchange.getIn().setHeader(CxfConstants.OPERATION_NAME, processClient); try{ String reply = exchange.getContext().createProducerTemplate().requestBody(cxf:bean:PASLIEndpoint,params,String.class); System.out.println(Reply --- : +reply); exchange.getOut().setBody(reply); }catch(Exception ex){ ex.printStackTrace(); } } If I use the above code then the operation name is ignored and camel calls only the first operation in the webservice. If I use String reply = exchange.getContext().createProducerTemplate().requestBody(cxf:bean:PASLIEndpoint?operationName=processClient,params,String.class); then the parameter operationName is not identified and I get an exception. can you please tell me how should I be able to use the operation name and parameters using processor bean. Thanks a lot. -- View this message in context: http://camel.465427.n5.nabble.com/How-to-invoke-CXF-webservice-from-processor-bean-tp5716272.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to invoke CXF webservice from processor bean
Hi, Here is my SEI. - import javax.jws.WebMethod; import javax.jws.WebService; @WebService public interface PasApplicationAdapterService { @WebMethod public String processClient(String pasXml) throws Exception; @WebMethod public void processPASLoadStatus(String pasLoadStatus) throws Exception; } Below is my end point configuration, cxf:cxfEndpoint id=PASLIEndpoint address=http://localhost:9080/LegacyIntegration/services/pas/; serviceClass=xyz.abc.PasApplicationAdapterService wsdlURL=wsdl/PASService.wsdl / Can you please help to locate the problem? Thanks in advance. -- View this message in context: http://camel.465427.n5.nabble.com/How-to-invoke-CXF-webservice-from-processor-bean-tp5716272p5716341.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to invoke CXF webservice from processor bean
Hi, I see that you set the operationName but did you set the operationNamespace. For example: senderExchange.getIn().setHeader(CxfConstants.OPERATION_NAMESPACE, http://yourOperationNamespace;); Try setting that and see if you get the same results. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/How-to-invoke-CXF-webservice-from-processor-bean-tp5716272p5716360.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to invoke CXF webservice from processor bean
Yeah, the operationNamespace is needed if the serviceName namespace is not same with the operationName. On Tue, Jul 24, 2012 at 2:54 AM, ychawla premiergenerat...@yahoo.comwrote: Hi, I see that you set the operationName but did you set the operationNamespace. For example: senderExchange.getIn().setHeader(CxfConstants.OPERATION_NAMESPACE, http://yourOperationNamespace;); Try setting that and see if you get the same results. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/How-to-invoke-CXF-webservice-from-processor-bean-tp5716272p5716360.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to invoke CXF webservice from processor bean
Hi, I even tried giving exchange.getIn().setHeader(CxfConstants.OPERATION_NAMESPACE, http://pas.adapter.service.xyz.abc.XX/;); but still no luck and it looks like it is just ignoring the headers completely. it always invokes one specific operation defined in the SEI. I have the following questions here, 1. In my implementation I am using the cxf endpoint as url , should I be using the cxf uri instead? 2. While invoking the webservice, should I have to use CxfProducer template instead of just the producertemplate? I feel I am running out of options and not clear which one to try. Can you please provide some example if you have already encountered situation like mine above. I am breaking my head for post couple weeks, your help would be highly appreciated. Thanks for your kind support. -- View this message in context: http://camel.465427.n5.nabble.com/How-to-invoke-CXF-webservice-from-processor-bean-tp5716272p5716379.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to invoke CXF webservice from processor bean
soap:body use=literal / /wsdl:output wsdl:fault name=Exception soap:fault name=Exception use=literal / /wsdl:fault /wsdl:operation wsdl:operation name=processPASLoadStatus soap:operation soapAction= style=document / wsdl:input name=processPASLoadStatus soap:body use=literal / /wsdl:input wsdl:output name=processPASLoadStatusResponse soap:body use=literal / /wsdl:output wsdl:fault name=Exception soap:fault name=Exception use=literal / /wsdl:fault /wsdl:operation /wsdl:binding wsdl:service name=PasApplicationAdapterServiceService wsdl:port binding=tns:PasApplicationAdapterServiceServiceSoapBinding name=PasApplicationAdapterServicePort soap:address location=http://localhost:9080/LegacyIntegration/services/pas; / /wsdl:port /wsdl:service /wsdl:definitions Thanks a lot. -- View this message in context: http://camel.465427.n5.nabble.com/How-to-invoke-CXF-webservice-from-processor-bean-tp5716272p5716300.html Sent from the Camel - Users 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: How to invoke CXF webservice from processor bean
/wsdl:operation wsdl:operation name=processPASLoadStatus soap:operation soapAction= style=document / wsdl:input name=processPASLoadStatus soap:body use=literal / /wsdl:input wsdl:output name=processPASLoadStatusResponse soap:body use=literal / /wsdl:output wsdl:fault name=Exception soap:fault name=Exception use=literal / /wsdl:fault /wsdl:operation /wsdl:binding wsdl:service name=PasApplicationAdapterServiceService wsdl:port binding=tns:PasApplicationAdapterServiceServiceSoapBinding name=PasApplicationAdapterServicePort soap:address location=http://localhost:9080/LegacyIntegration/services/pas; / /wsdl:port /wsdl:service /wsdl:definitions Thanks a lot. -- View this message in context: http://camel.465427.n5.nabble.com/How-to-invoke-CXF-webservice-from-processor-bean-tp5716272p5716300.html Sent from the Camel - Users mailing list archive at Nabble.com.
How to invoke CXF webservice from processor bean
Hi, I have processor bean using which i would like to invoke an external webservice. I need to pass the operation name as well as parameters. If I pass the parameter in header then its ignored and if i send it via uri then I am getting error as invalid parameter name. public void process(Exchange exchange) throws Exception { ListString params = new ArrayListString(); params.add((String)exchange.getIn().getBody()); exchange.getIn().setHeader(CxfConstants.OPERATION_NAME, processClient); try{ String reply = exchange.getContext().createProducerTemplate().requestBody(cxf:bean:PASLIEndpoint,params,String.class); System.out.println(Reply --- : +reply); exchange.getOut().setBody(reply); }catch(Exception ex){ ex.printStackTrace(); } } If I use the above code then the operation name is ignored and camel calls only the first operation in the webservice. If I use String reply = exchange.getContext().createProducerTemplate().requestBody(cxf:bean:PASLIEndpoint?operationName=processClient,params,String.class); then the parameter operationName is not identified and I get an exception. can you please tell me how should I be able to use the operation name and parameters using processor bean. Thanks a lot. -- View this message in context: http://camel.465427.n5.nabble.com/How-to-invoke-CXF-webservice-from-processor-bean-tp5716272.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to invoke CXF webservice from processor bean
Hi, I think you didn't specify a right operation name. Can I have a look at your SEI (Service Endpoint Interface) ? On Fri Jul 20 09:34:22 2012, jeyaseelan78 wrote: Hi, I have processor bean using which i would like to invoke an external webservice. I need to pass the operation name as well as parameters. If I pass the parameter in header then its ignored and if i send it via uri then I am getting error as invalid parameter name. public void process(Exchange exchange) throws Exception { ListString params = new ArrayListString(); params.add((String)exchange.getIn().getBody()); exchange.getIn().setHeader(CxfConstants.OPERATION_NAME, processClient); try{ String reply = exchange.getContext().createProducerTemplate().requestBody(cxf:bean:PASLIEndpoint,params,String.class); System.out.println(Reply --- : +reply); exchange.getOut().setBody(reply); }catch(Exception ex){ ex.printStackTrace(); } } If I use the above code then the operation name is ignored and camel calls only the first operation in the webservice. If I use String reply = exchange.getContext().createProducerTemplate().requestBody(cxf:bean:PASLIEndpoint?operationName=processClient,params,String.class); then the parameter operationName is not identified and I get an exception. can you please tell me how should I be able to use the operation name and parameters using processor bean. Thanks a lot. -- View this message in context: http://camel.465427.n5.nabble.com/How-to-invoke-CXF-webservice-from-processor-bean-tp5716272.html Sent from the Camel - Users 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