You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by mshtelma <ms...@gmail.com> on 2008/10/22 21:32:34 UTC

Accessing web service from the camel

Hello,

I would like to poll some web service after the timer event and to route the
web service invocation result to the next component. I am using the
following camel configuration. What parameters should I specify for the
cxf:Endpoint? I do not want to have the web service interface in the
classpath, I would rather work with the raw xml (I mean results of the web
service invocation) using xpath and xslt. Is it possible to do so? This conf
unfortunately produces different errors, something like it cannot find the
service or some NullPointers... Could you give me right example of the conf,
that does something similar, like accesses some web service.. 

 <bean ref="myTransform" method="transform"/> this just pases the value
property as a result.

Thank you in advance!

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:osgi="http://www.springframework.org/schema/osgi"
       xmlns:camel-osgi="http://activemq.apache.org/camel/schema/osgi"
       xmlns:jaxws="http://cxf.apache.org/jaxws"
       xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
       xmlns:cxf="http://activemq.apache.org/camel/schema/cxfEndpoint"
       xmlns:bz="http://services.mm.de/"
      .................>

    <import resource="classpath:META-INF/cxf/cxf.xml"/>
    <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>

    <camel-osgi:camelContext
xmlns="http://activemq.apache.org/camel/schema/spring">
        <route>
            <from
uri="timer://myTimer?fixedRate=true&amp;period=5000&amp;exchangePattern=InOut"/>
            <bean ref="myTransform" method="transform"/>
            <to uri="cxf:bean:customerService"/>
            <bean ref="myTransform" method="display"/>
        </route>
    </camel-osgi:camelContext>

    <bean id="myTransform"
class="org.apache.servicemix.examples.cxfcamel.MyTransform">
        <property name="value">
            <value>

                <![CDATA[<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ser="http://services.mm.de/">   <soapenv:Header/>   <soapenv:Body>     
<ser:getCustomerList/>   </soapenv:Body></soapenv:Envelope>]]>           
</value>
        </property>
    </bean>

    <cxf:endpoint id="customerService"
                    wsdl="http://localhost:8080/cxf/CustomerService?wsdl"
                   
locationURI="http://localhost:8080/cxf/CustomerService"/>
</beans>


-- 
View this message in context: http://www.nabble.com/Accessing-web-service-from-the-camel-tp20118137s22882p20118137.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Accessing web service from the camel

Posted by Willem Jiang <wi...@gmail.com>.
Current CXF endpoint need to use the SEI for marshal and unmarshal the
message. If you just want to work with raw xml, you can use the http
producer[1] which is very easy to use, you don't need name the wsdl file
either.

[1]http://cwiki.apache.org/CAMEL/http.html

Willem

mshtelma wrote:
> Hello,
> 
> I would like to poll some web service after the timer event and to route the
> web service invocation result to the next component. I am using the
> following camel configuration. What parameters should I specify for the
> cxf:Endpoint? I do not want to have the web service interface in the
> classpath, I would rather work with the raw xml (I mean results of the web
> service invocation) using xpath and xslt. Is it possible to do so? This conf
> unfortunately produces different errors, something like it cannot find the
> service or some NullPointers... Could you give me right example of the conf,
> that does something similar, like accesses some web service.. 
> 
>  <bean ref="myTransform" method="transform"/> this just pases the value
> property as a result.
> 
> Thank you in advance!
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xmlns:osgi="http://www.springframework.org/schema/osgi"
>        xmlns:camel-osgi="http://activemq.apache.org/camel/schema/osgi"
>        xmlns:jaxws="http://cxf.apache.org/jaxws"
>        xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
>        xmlns:cxf="http://activemq.apache.org/camel/schema/cxfEndpoint"
>        xmlns:bz="http://services.mm.de/"
>       .................>
> 
>     <import resource="classpath:META-INF/cxf/cxf.xml"/>
>     <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
> 
>     <camel-osgi:camelContext
> xmlns="http://activemq.apache.org/camel/schema/spring">
>         <route>
>             <from
> uri="timer://myTimer?fixedRate=true&amp;period=5000&amp;exchangePattern=InOut"/>
>             <bean ref="myTransform" method="transform"/>
>             <to uri="cxf:bean:customerService"/>
>             <bean ref="myTransform" method="display"/>
>         </route>
>     </camel-osgi:camelContext>
> 
>     <bean id="myTransform"
> class="org.apache.servicemix.examples.cxfcamel.MyTransform">
>         <property name="value">
>             <value>
> 
>                 <![CDATA[<soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:ser="http://services.mm.de/">   <soapenv:Header/>   <soapenv:Body>     
> <ser:getCustomerList/>   </soapenv:Body></soapenv:Envelope>]]>           
> </value>
>         </property>
>     </bean>
> 
>     <cxf:endpoint id="customerService"
>                     wsdl="http://localhost:8080/cxf/CustomerService?wsdl"
>                    
> locationURI="http://localhost:8080/cxf/CustomerService"/>
> </beans>
> 
>