You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by martin11 <ma...@gmail.com> on 2013/04/22 13:32:00 UTC

CXF consumer by soapAction

Hello,

I`m using camel ver. 2.10.4 and I want to create web service by using CXF
(contract-first approach) and I have two method (Add & Remove) in single
WSDL:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions name="AdditiveRoleEndpointService"
                  xmlns:nps="http://www.test.com/nest/schemas/AdditiveRole"
                  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                 
targetNamespace="http://www.test.com/nest/schemas/AdditiveRole">
    <wsdl:types>
        ...
        ...
    </wsdl:types>
    <wsdl:message name="AddRequest">
        <wsdl:part element="nps:AddRequest" name="parameters"/>
    </wsdl:message>
    <wsdl:message name="AddResponse">
        <wsdl:part element="nps:AddResponse" name="parameters"/>
    </wsdl:message>
    <wsdl:message name="RemoveRequest">
        <wsdl:part name="parameters" element="nps:RemoveRequest"/>
    </wsdl:message>
    <wsdl:message name="RemoveResponse">
        <wsdl:part name="parameters" element="nps:RemoveResponse"/>
    </wsdl:message>
    <wsdl:portType name="AdditiveRoleEndpoint">
        <wsdl:operation name="Add">
            <wsdl:input message="nps:AddRequest"/>
            <wsdl:output message="nps:AddResponse"/>
        </wsdl:operation>
        <wsdl:operation name="Remove">
            <wsdl:input message="nps:RemoveRequest"/>
            <wsdl:output message="nps:RemoveResponse"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="AdditiveRoleBinding"
type="nps:AdditiveRoleEndpoint">
        <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="Add">
            <soap:operation
soapAction="http://www.test.com/nest/schemas/AdditiveRole/Add"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="Remove">
            <soap:operation
soapAction="http://www.test.com/nest/schemas/AdditiveRole/Remove"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="AdditiveRoleEndpointService">
        <wsdl:port name="AdditiveRoleService"
binding="nps:AdditiveRoleBinding">
            <soap:address location="http://localhost:9000/additiverole"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>


<cxf:cxfEndpoint id="serviceEndpoint"
                     address="http://localhost:9000/role"
                    
serviceClass="com.test.nest.schemas.additiverole.AdditiveRoleEndpoint"
                     wsdlURL="service.wsdl"
                     endpointName="s:AdditiveRoleService"
                     serviceName="s:AdditiveRoleEndpointService"
                    
xmlns:s="http://www.test.com/nest/schemas/AdditiveRole"/>

*Can I use something like SOAP action for specify CXF consumer for each
method from WSDL?*

<camel:route id="route-add">
    <camel:from uri="cxf:bean:serviceEndpoint?SOAPaction=Add"/>
    <camel:process ref="testingProcessor"/>
    ...
</camel:route>
<camel:route id="route-remove">
    <camel:from uri="cxf:bean:serviceEndpoint?SOAPaction=Remove"/>
    <camel:process ref="testingProcessor"/>
    ...
</camel:route>


Thanks for any advice or suggestions,

Martin



--
View this message in context: http://camel.465427.n5.nabble.com/CXF-consumer-by-soapAction-tp5731241.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CXF consumer by soapAction

Posted by Aki Yoshida <el...@gmail.com>.
i think what you want is a single starting endpoint that branches on the
operation header (or whatever that distinguishes the call).
 <camlel:route id="root">
       <camel:from uri="cxf:bean...." />
       <camel:choice>
        <camel:when>
         <camel:simple>${header.operationName} == 'op1'</camel:simple>
         <camel:to uri="direct:op1route/>
        </camel:when>
        <camel:when>
         <camel:simple>${header.operationName} == 'op2'</camel:simple>
         <camel:to uri="direct:op2route/>
        </camel:when>
  </camel:route>

 <camel:route id="op1route">
     <camel:from uri="direct:op1route"/>
     ,,,
<camel:route id="op2route">
     <camel:from uri="direct:op2route"/>
     ,,,



2013/4/22 martin11 <ma...@gmail.com>

> Hello,
>
> I`m using camel ver. 2.10.4 and I want to create web service by using CXF
> (contract-first approach) and I have two method (Add & Remove) in single
> WSDL:
>
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <wsdl:definitions name="AdditiveRoleEndpointService"
>                   xmlns:nps="http://www.test.com/nest/schemas/AdditiveRole
> "
>                   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>                   xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>                   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
> targetNamespace="http://www.test.com/nest/schemas/AdditiveRole">
>     <wsdl:types>
>         ...
>         ...
>     </wsdl:types>
>     <wsdl:message name="AddRequest">
>         <wsdl:part element="nps:AddRequest" name="parameters"/>
>     </wsdl:message>
>     <wsdl:message name="AddResponse">
>         <wsdl:part element="nps:AddResponse" name="parameters"/>
>     </wsdl:message>
>     <wsdl:message name="RemoveRequest">
>         <wsdl:part name="parameters" element="nps:RemoveRequest"/>
>     </wsdl:message>
>     <wsdl:message name="RemoveResponse">
>         <wsdl:part name="parameters" element="nps:RemoveResponse"/>
>     </wsdl:message>
>     <wsdl:portType name="AdditiveRoleEndpoint">
>         <wsdl:operation name="Add">
>             <wsdl:input message="nps:AddRequest"/>
>             <wsdl:output message="nps:AddResponse"/>
>         </wsdl:operation>
>         <wsdl:operation name="Remove">
>             <wsdl:input message="nps:RemoveRequest"/>
>             <wsdl:output message="nps:RemoveResponse"/>
>         </wsdl:operation>
>     </wsdl:portType>
>     <wsdl:binding name="AdditiveRoleBinding"
> type="nps:AdditiveRoleEndpoint">
>         <soap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http"/>
>         <wsdl:operation name="Add">
>             <soap:operation
> soapAction="http://www.test.com/nest/schemas/AdditiveRole/Add"/>
>             <wsdl:input>
>                 <soap:body use="literal"/>
>             </wsdl:input>
>             <wsdl:output>
>                 <soap:body use="literal"/>
>             </wsdl:output>
>         </wsdl:operation>
>         <wsdl:operation name="Remove">
>             <soap:operation
> soapAction="http://www.test.com/nest/schemas/AdditiveRole/Remove"/>
>             <wsdl:input>
>                 <soap:body use="literal"/>
>             </wsdl:input>
>             <wsdl:output>
>                 <soap:body use="literal"/>
>             </wsdl:output>
>         </wsdl:operation>
>     </wsdl:binding>
>     <wsdl:service name="AdditiveRoleEndpointService">
>         <wsdl:port name="AdditiveRoleService"
> binding="nps:AdditiveRoleBinding">
>             <soap:address location="http://localhost:9000/additiverole"/>
>         </wsdl:port>
>     </wsdl:service>
> </wsdl:definitions>
>
>
> <cxf:cxfEndpoint id="serviceEndpoint"
>                      address="http://localhost:9000/role"
>
> serviceClass="com.test.nest.schemas.additiverole.AdditiveRoleEndpoint"
>                      wsdlURL="service.wsdl"
>                      endpointName="s:AdditiveRoleService"
>                      serviceName="s:AdditiveRoleEndpointService"
>
> xmlns:s="http://www.test.com/nest/schemas/AdditiveRole"/>
>
> *Can I use something like SOAP action for specify CXF consumer for each
> method from WSDL?*
>
> <camel:route id="route-add">
>     <camel:from uri="cxf:bean:serviceEndpoint?SOAPaction=Add"/>
>     <camel:process ref="testingProcessor"/>
>     ...
> </camel:route>
> <camel:route id="route-remove">
>     <camel:from uri="cxf:bean:serviceEndpoint?SOAPaction=Remove"/>
>     <camel:process ref="testingProcessor"/>
>     ...
> </camel:route>
>
>
> Thanks for any advice or suggestions,
>
> Martin
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/CXF-consumer-by-soapAction-tp5731241.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>