camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: CXF -- problem how to use Camel-Cxf to invoke a webservice
Date Fri, 30 Dec 2011 04:27:29 GMT
Hi,

I think you should use the POJO data format which save you lots of time 
to prepare the request and parser the response.
If you are using MESSAGE data format, you need to create the soap 
message yourself.

BTW, the WSDL is using document-literal, CXF support it out of box.

On Fri Dec 30 11:45:13 2011, jiangfan wrote:
> I now is to want to use the Camel-CXF call to the third party web services.
> They provide to me they released WSDL documents :
>
>   <?xml version="1.0" encoding="UTF-8" ?>
> -<wsdl:definitions name="BlfThirdIntegrateImplService"
> targetNamespace="http://ws.cxfExample.ygsoft.com/"
> xmlns:ns1="http://cxf.apache.org/bindings/xformat"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:tns="http://ws.cxfExample.ygsoft.com/"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> -<wsdl:types>
> +<xsd:schema attributeFormDefault="unqualified"
> elementFormDefault="unqualified"
> targetNamespace="http://ws.cxfExample.ygsoft.com/"
> xmlns:tns="http://ws.cxfExample.ygsoft.com/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>    <xsd:element name="getZWItemsYW" type="tns:getZWItemsYW" />
> +<xsd:complexType name="getZWItemsYW">
>    <xsd:sequence />
>    </xsd:complexType>
>    <xsd:element name="getZWItemsYWResponse" type="tns:getZWItemsYWResponse"
> />
> +<xsd:complexType name="getZWItemsYWResponse">
> -<xsd:sequence>
>    <xsd:element minOccurs="0" name="return" type="xsd:string" />
>    </xsd:sequence>
>    </xsd:complexType>
>    <xsd:element name="newQueryZWData" type="tns:newQueryZWData" />
> +<xsd:complexType name="newQueryZWData">
> -<xsd:sequence>
>    <xsd:element minOccurs="0" name="arg0" type="xsd:string" />
>    <xsd:element minOccurs="0" name="arg1" type="xsd:string" />
>    <xsd:element name="arg2" type="xsd:int" />
>    <xsd:element minOccurs="0" name="arg3" type="xsd:string" />
>    </xsd:sequence>
>    </xsd:complexType>
>    <xsd:element name="newQueryZWDataResponse"
> type="tns:newQueryZWDataResponse" />
> +<xsd:complexType name="newQueryZWDataResponse">
> -<xsd:sequence>
>    <xsd:element minOccurs="0" name="return" type="xsd:string" />
>    </xsd:sequence>
>    </xsd:complexType>
>    </xsd:schema>
>    </wsdl:types>
> +<wsdl:message name="newQueryZWData">
>    <wsdl:part element="tns:newQueryZWData" name="parameters" />
>    </wsdl:message>
> +<wsdl:message name="newQueryZWDataResponse">
>    <wsdl:part element="tns:newQueryZWDataResponse" name="parameters" />
>    </wsdl:message>
> -<wsdl:message name="getZWItemsYW">
>    <wsdl:part element="tns:getZWItemsYW" name="parameters" />
>    </wsdl:message>
> -<wsdl:message name="getZWItemsYWResponse">
>    <wsdl:part element="tns:getZWItemsYWResponse" name="parameters" />
>    </wsdl:message>
> -<wsdl:portType name="BlfThirdIntegrate">
> -<wsdl:operation name="getZWItemsYW">
>    <wsdl:input message="tns:getZWItemsYW" name="getZWItemsYW" />
>    <wsdl:output message="tns:getZWItemsYWResponse"
> name="getZWItemsYWResponse" />
>    </wsdl:operation>
> +<wsdl:operation name="newQueryZWData">
>    <wsdl:input message="tns:newQueryZWData" name="newQueryZWData" />
>    <wsdl:output message="tns:newQueryZWDataResponse"
> name="newQueryZWDataResponse" />
>    </wsdl:operation>
>    </wsdl:portType>
> -<wsdl:binding name="BlfThirdIntegrateImplServiceSoapBinding"
> type="tns:BlfThirdIntegrate">
>    <soap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http" />
> -<wsdl:operation name="getZWItemsYW">
>    <soap:operation soapAction="" style="document" />
> -<wsdl:input name="getZWItemsYW">
>    <soap:body use="literal" />
>    </wsdl:input>
> -<wsdl:output name="getZWItemsYWResponse">
>    <soap:body use="literal" />
>    </wsdl:output>
>    </wsdl:operation>
> +<wsdl:operation name="newQueryZWData">
>    <soap:operation soapAction="" style="document" />
> -<wsdl:input name="newQueryZWData">
>    <soap:body use="literal" />
>    </wsdl:input>
> -<wsdl:output name="newQueryZWDataResponse">
>    <soap:body use="literal" />
>    </wsdl:output>
>    </wsdl:operation>
>    </wsdl:binding>
> -<wsdl:service name="BlfThirdIntegrateImplService">
> -<wsdl:port binding="tns:BlfThirdIntegrateImplServiceSoapBinding"
> name="BlfThirdIntegrateImplPort">
>    <soap:address
> location="http://127.0.0.1:8080/YGFMISWeb/services/BlfThirdIntegrate" />
>    </wsdl:port>
>    </wsdl:service>
>    </wsdl:definitions>
>
>
> Now I want to call the service of the method is getZWItemsYW
> My camel routing is like this :
> <camel:route id="cxf-example">
>      <camel:from uri="jms:queue:cxf-example?jmsMessageType=Text" />
>      <camel:to
> uri="cxf://http://127.0.0.1:8080/YGFMISWeb/services/BlfThirdIntegrate?wsdl?wsdlURL=src/main/resources/BlfThirdIntegrate.wsdl&amp;serviceName={http://ws.cxfExample.ygsoft.com/}BlfThirdIntegrateImplService&amp;portName={http://ws.cxfExample.ygsoft.com/}BlfThirdIntegrateImplPort&amp;dataFormat=MESSAGE"
> />
>      <camel:log loggingLevel="INFO" message="&gt;&gt;&gt;${body}" />
> </camel:route>
>
> I have some questions:
> 1.Write like this, can I call for example Axis released service
> 2.One of the local written, I guess is basic it is, don't know the correct
> this how to write:
> <camel:to
> uri="cxf://http://127.0.0.1:8080/YGFMISWeb/services/BlfThirdIntegrate?wsdl?wsdlURL=src/main/resources/BlfThirdIntegrate.wsdl&amp;serviceName={http://ws.cxfExample.ygsoft.com/}BlfThirdIntegrateImplService&amp;portName={http://ws.cxfExample.ygsoft.com/}BlfThirdIntegrateImplPort&amp;dataFormat=MESSAGE"
> />
> Because to finish this section of time I found that didn't write operation
> in
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/CXF-problem-how-to-use-Camel-Cxf-to-invoke-a-webservice-tp5107111p5109194.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

Mime
View raw message