You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Jaishankar <ja...@wipro.com> on 2014/06/19 07:01:26 UTC

Consume CXF Web service using setHeader or anyway without using JAVA code Error

I'm trying to consume web service using setHeader component. *My main goal
here is not to write any java code and directly call the method with
arguments.* As well I'm very much new to camel tools. So I would really
expect your suggestion more. Please help me out in understanding and
executing my task. I'll share all the sample works which I've done.


camel-context.xml
<cxf:cxfEndpoint id="callCXF" address="http://localhost:1101/CustomDetails" 
	serviceClass="com.webservice.CustomerMethod"
	serviceName="s:getHelloWorldMessage" xmlns:s="http://webservice.com">
		<cxf:properties>
			<entry key="dataFormat" value="POJO" />
		</cxf:properties>
	</cxf:cxfEndpoint>


	<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"
trace="true">
		<route>
			<from uri="timer://foo?period=6000" />
			<setHeader headerName="getHelloWorldMessage">
				<simple>Hi</simple>
			</setHeader>
			<to uri="cxf:bean:callCXF" />
			<log message=">>> data is : ${body}" />
		</route>
	</camelContext>

WSDL file:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://www.springframework.org/schema/beans"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:ns2="http://schemas.xmlsoap.org/soap/http"
xmlns:ns1="http://webservice.com/" name="CustomerMethod"
targetNamespace="http://www.springframework.org/schema/beans">
  <wsdl:import
location="http://localhost:1101/CustomDetails?wsdl=CustomerMethod.wsdl"
namespace="http://webservice.com/">
    </wsdl:import>
  <wsdl:binding name="CustomerMethodSoapBinding" type="ns1:CustomerMethod">
    <soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="getHelloWorldMessage">
      <soap:operation soapAction="" style="rpc"/>
      <wsdl:input name="getHelloWorldMessage">
        <soap:body namespace="http://webservice.com/" use="literal"/>
      </wsdl:input>
      <wsdl:output name="getHelloWorldMessageResponse">
        <soap:body namespace="http://webservice.com/" use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="getNameAddPhnNo">
      <soap:operation soapAction="" style="rpc"/>
      <wsdl:input name="getNameAddPhnNo">
        <soap:body namespace="http://webservice.com/" use="literal"/>
      </wsdl:input>
      <wsdl:output name="getNameAddPhnNoResponse">
        <soap:body namespace="http://webservice.com/" use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="getCustomerID">
      <soap:operation soapAction="" style="rpc"/>
      <wsdl:input name="getCustomerID">
        <soap:body namespace="http://webservice.com/" use="literal"/>
      </wsdl:input>
      <wsdl:output name="getCustomerIDResponse">
        <soap:body namespace="http://webservice.com/" use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="CustomerMethod">
    <wsdl:port binding="tns:CustomerMethodSoapBinding" name="SOAPOverHTTP">
      <soap:address location="http://localhost:1101/CustomDetails"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>





--
View this message in context: http://camel.465427.n5.nabble.com/Consume-CXF-Web-service-using-setHeader-or-anyway-without-using-JAVA-code-Error-tp5752533.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: Consume CXF Web service using setHeader or anyway without using JAVA code Error

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

This is the wrong forum to ask. Use the @user forum for user questions
on Apache Camel
http://camel.apache.org/discussion-forums.html

On Thu, Jun 19, 2014 at 7:01 AM, Jaishankar <ja...@wipro.com> wrote:
> I'm trying to consume web service using setHeader component. *My main goal
> here is not to write any java code and directly call the method with
> arguments.* As well I'm very much new to camel tools. So I would really
> expect your suggestion more. Please help me out in understanding and
> executing my task. I'll share all the sample works which I've done.
>
>
> camel-context.xml
> <cxf:cxfEndpoint id="callCXF" address="http://localhost:1101/CustomDetails"
>         serviceClass="com.webservice.CustomerMethod"
>         serviceName="s:getHelloWorldMessage" xmlns:s="http://webservice.com">
>                 <cxf:properties>
>                         <entry key="dataFormat" value="POJO" />
>                 </cxf:properties>
>         </cxf:cxfEndpoint>
>
>
>         <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"
> trace="true">
>                 <route>
>                         <from uri="timer://foo?period=6000" />
>                         <setHeader headerName="getHelloWorldMessage">
>                                 <simple>Hi</simple>
>                         </setHeader>
>                         <to uri="cxf:bean:callCXF" />
>                         <log message=">>> data is : ${body}" />
>                 </route>
>         </camelContext>
>
> WSDL file:
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:tns="http://www.springframework.org/schema/beans"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:ns2="http://schemas.xmlsoap.org/soap/http"
> xmlns:ns1="http://webservice.com/" name="CustomerMethod"
> targetNamespace="http://www.springframework.org/schema/beans">
>   <wsdl:import
> location="http://localhost:1101/CustomDetails?wsdl=CustomerMethod.wsdl"
> namespace="http://webservice.com/">
>     </wsdl:import>
>   <wsdl:binding name="CustomerMethodSoapBinding" type="ns1:CustomerMethod">
>     <soap:binding style="rpc"
> transport="http://schemas.xmlsoap.org/soap/http"/>
>     <wsdl:operation name="getHelloWorldMessage">
>       <soap:operation soapAction="" style="rpc"/>
>       <wsdl:input name="getHelloWorldMessage">
>         <soap:body namespace="http://webservice.com/" use="literal"/>
>       </wsdl:input>
>       <wsdl:output name="getHelloWorldMessageResponse">
>         <soap:body namespace="http://webservice.com/" use="literal"/>
>       </wsdl:output>
>     </wsdl:operation>
>     <wsdl:operation name="getNameAddPhnNo">
>       <soap:operation soapAction="" style="rpc"/>
>       <wsdl:input name="getNameAddPhnNo">
>         <soap:body namespace="http://webservice.com/" use="literal"/>
>       </wsdl:input>
>       <wsdl:output name="getNameAddPhnNoResponse">
>         <soap:body namespace="http://webservice.com/" use="literal"/>
>       </wsdl:output>
>     </wsdl:operation>
>     <wsdl:operation name="getCustomerID">
>       <soap:operation soapAction="" style="rpc"/>
>       <wsdl:input name="getCustomerID">
>         <soap:body namespace="http://webservice.com/" use="literal"/>
>       </wsdl:input>
>       <wsdl:output name="getCustomerIDResponse">
>         <soap:body namespace="http://webservice.com/" use="literal"/>
>       </wsdl:output>
>     </wsdl:operation>
>   </wsdl:binding>
>   <wsdl:service name="CustomerMethod">
>     <wsdl:port binding="tns:CustomerMethodSoapBinding" name="SOAPOverHTTP">
>       <soap:address location="http://localhost:1101/CustomDetails"/>
>     </wsdl:port>
>   </wsdl:service>
> </wsdl:definitions>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Consume-CXF-Web-service-using-setHeader-or-anyway-without-using-JAVA-code-Error-tp5752533.html
> Sent from the Camel Development mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: Consume CXF Web service using setHeader or anyway without using JAVA code Error

Posted by contactreji <co...@gmail.com>.
Check out RESTful services. Those can be invoked using parameters alone. No
XML structure required.



--
View this message in context: http://camel.465427.n5.nabble.com/Consume-CXF-Web-service-using-setHeader-or-anyway-without-using-JAVA-code-Error-tp5752533p5752542.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: Consume CXF Web service using setHeader or anyway without using JAVA code Error

Posted by contactreji <co...@gmail.com>.
The basic requirement for calling a web service is to pass the data as per
the schema of the operations in web service. The structure of the data has
to be adhered to. 
Else it will always throw Marshalling Exceptions at server and and return a
Client fault code.



--
View this message in context: http://camel.465427.n5.nabble.com/Consume-CXF-Web-service-using-setHeader-or-anyway-without-using-JAVA-code-Error-tp5752533p5752541.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: Consume CXF Web service using setHeader or anyway without using JAVA code Error

Posted by Jaishankar <ja...@wipro.com>.
I've done this way.. Like sending soap message as an input and getting back
the response.
But my question was, is there any possiblility that without using any
payload or java code can I be able to call web service operation with
arguements only by using camel context file.



--
View this message in context: http://camel.465427.n5.nabble.com/Consume-CXF-Web-service-using-setHeader-or-anyway-without-using-JAVA-code-Error-tp5752533p5752540.html
Sent from the Camel Development mailing list archive at Nabble.com.