You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by xiangqiuzhao <xi...@gmail.com> on 2011/08/15 11:47:06 UTC

how to invoke webservice with wsdl or not in camel?

i need to send message to webservice server, like
from("direct://test").process().to("cxf://...")

i have get the remote webservice wsdl, and i know what service name i will
invoke, how to write the "to" URI?

and if i have not the wsdl, and i know the webservice adress, service name,
input and output, then how to write ?

--
View this message in context: http://camel.465427.n5.nabble.com/how-to-invoke-webservice-with-wsdl-or-not-in-camel-tp4700436p4700436.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: how to invoke webservice with wsdl or not in camel?

Posted by Willem Jiang <wi...@gmail.com>.
There are lots of examples in the camel-cxf wiki page[1]
Please take some time to read about it.

[1]http://camel.apache.org/cxf.html

On Sun Aug 21 10:18:33 2011, xiangqiuzhao wrote:
> how to send webservice request use wsdl and operation name?
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/how-to-invoke-webservice-with-wsdl-or-not-in-camel-tp4700436p4719616.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 webservice with wsdl or not in camel?

Posted by xiangqiuzhao <xi...@gmail.com>.
how to send webservice request use wsdl and operation name?

--
View this message in context: http://camel.465427.n5.nabble.com/how-to-invoke-webservice-with-wsdl-or-not-in-camel-tp4700436p4719616.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: how to invoke webservice with wsdl or not in camel?

Posted by xiangqiuzhao <xi...@gmail.com>.
i need to use wsdl and not send envelop message only, but i need to set the
operationName dynamic by program.

i want to send service request to the special service adress and invoke the
operationName  in the  special wsdl file . how to use uri and set the
message body?

--
View this message in context: http://camel.465427.n5.nabble.com/how-to-invoke-webservice-with-wsdl-or-not-in-camel-tp4700436p4703939.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: how to invoke webservice with wsdl or not in camel?

Posted by Willem Jiang <wi...@gmail.com>.
If you just want to send the soap envelop to the back end service, you 
just need to use the MESSAGE data format.
If you don't want to use the WSDL, you can consider to use camel-http 
component instead of camel-cxf component.

Willem

On 8/16/11 10:43 AM, xiangqiuzhao wrote:
> this is my wsdl generate the request in soap ui:
>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:iws="http://www.wstest.sunyard.com/IWSTestService/">
>     <soapenv:Header/>
>     <soapenv:Body>
>        <iws:getComplexObjectRequest>
>
>           <iws:userNames>
>              <iws:name>test</iws:name>
>           </iws:userNames>
>           <iws:userNames>
>              <iws:name>test12</iws:name>
>           </iws:userNames>
>        </iws:getComplexObjectRequest>
>     </soapenv:Body>
> </soapenv:Envelope>
>
> so i write my program like
>
>          CamelContext context = new DefaultCamelContext();
>
>          context.addRoutes(new RouteBuilder() {
>              public void configure() throws Exception {
>                  from("direct:test")
>                  .process(new MyProcessor())
>
> .to("cxf://http://localhost:8000/wstest/services/IWSTestService?wsdlURL=D:/IWSTestService.wsdl&dataFormat=PAYLOAD");
>              }
>          });
>
>          context.start();
>
>          Endpoint endpoint = context.getEndpoint("direct:test");
>          Exchange exchange = endpoint.createExchange();
>          exchange.getIn().setHeader("operationName",
> "getComplexObjectService");
>
>          byte[] in = FileUtil.readAsByteArray(new File("d:/a.xml")); //a.xml
> content as the soapui request
>          exchange.getIn().setBody(new String(in));
>
>          Producer producer = endpoint.createProducer();
>          producer.process(exchange);
>
> but it's error as "Cannot set right payload paremeters. Please check the
> BindingOperation and PayLoadMessage"
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/how-to-invoke-webservice-with-wsdl-or-not-in-camel-tp4700436p4703094.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 webservice with wsdl or not in camel?

Posted by xiangqiuzhao <xi...@gmail.com>.
this is my wsdl generate the request in soap ui:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:iws="http://www.wstest.sunyard.com/IWSTestService/">
   <soapenv:Header/>
   <soapenv:Body>
      <iws:getComplexObjectRequest>
         
         <iws:userNames>
            <iws:name>test</iws:name>
         </iws:userNames>
         <iws:userNames>
            <iws:name>test12</iws:name>
         </iws:userNames>
      </iws:getComplexObjectRequest>
   </soapenv:Body>
</soapenv:Envelope>

so i write my program like 

        CamelContext context = new DefaultCamelContext();
        
        context.addRoutes(new RouteBuilder() {
            public void configure() throws Exception {
                from("direct:test")
                .process(new MyProcessor())
               
.to("cxf://http://localhost:8000/wstest/services/IWSTestService?wsdlURL=D:/IWSTestService.wsdl&dataFormat=PAYLOAD");
            }
        });
        
        context.start();
        
        Endpoint endpoint = context.getEndpoint("direct:test");
        Exchange exchange = endpoint.createExchange();
        exchange.getIn().setHeader("operationName",
"getComplexObjectService");

        byte[] in = FileUtil.readAsByteArray(new File("d:/a.xml")); //a.xml
content as the soapui request
        exchange.getIn().setBody(new String(in));

        Producer producer = endpoint.createProducer();
        producer.process(exchange);

but it's error as "Cannot set right payload paremeters. Please check the
BindingOperation and PayLoadMessage"

--
View this message in context: http://camel.465427.n5.nabble.com/how-to-invoke-webservice-with-wsdl-or-not-in-camel-tp4700436p4703094.html
Sent from the Camel - Users mailing list archive at Nabble.com.