I'm new to Apache CXF and web services in general, but this situation
doesn't work yet and, to me, it looks like it should


My WSDL produces methods such as this:



    @WebResult(name = "purchaseResponse", targetNamespace = "")

    @RequestWrapper(localName = "purchase", targetNamespace =
"http://PartnerTransactionServiceGateway/wsdl";, className =
"partnertransactionservicegateway.wsdl.Purchase")

    @WebMethod

    @ResponseWrapper(localName = "purchaseResponse", targetNamespace =
"http:// PartnerTransactionServiceGateway/wsdl", className = "
partnertransactionservicegateway.wsdl.PurchaseResponse")

    public partnertransactionservicegateway.wsdl.PurchaseResponseType
purchase(

        @WebParam(name = "purchaseRequest", targetNamespace = "")

        partnertransactionservicegateway.wsdl.PurchasedRequestType
purchaseRequest,

        @WebParam(name = "header", targetNamespace = "
http://PartnerTransactionServiceGateway/wsdl";, header = true)

        Header requestHeader

    ) throws PurchaseFaultMsg;



But the runtime does not pass the requestHeader parameter and the call
fails.



I am converting this Web Service from WebSphere web services to jBoss 6 EAP
and Apache CXF 2.7.5 (for wsdl2java)



These are the details of the WSDL



            <wsdl:message name="purchaseHeaderMsg">

                        <wsdl:part name="request_header" element="tns:header
"/>

            </wsdl:message>

            <wsdl:message name="purchaseRequestMsg">

                        <wsdl:part name="purchaseParameters" element="
tns:purchase"/>

            </wsdl:message>

            <wsdl:message name="purchaseResponseMsg">

                        <wsdl:part name="purchaseResult" element="
tns:purchaseResponse"/>

            </wsdl:message>

            <wsdl:message name="purchase_faultMsg">

                        <wsdl:part name="fault" element="
tns:FaultType_element"/>

            </wsdl:message>



portType

  <wsdl:operation name="purchase">

<wsdl:input name="purchaseRequest" message="bons1:purchaseRequestMsg"/>

 <wsdl:output name="purchaseResponse" message="bons1:purchaseResponseMsg"/>

<wsdl:fault name="fault" message="bons1:purchase_faultMsg"/>

</wsdl:operation>

bindings
<wsdl:operation name="purchase">
 <soap:operation soapAction="urn#purchase"/>
<wsdl:input name="purchaseRequest">
 <soap:header message="Port_0:purchaseHeaderMsg" part="request_header"
use="literal"/>
<soap:body parts="purchaseParameters" use="literal"/>
 </wsdl:input>
<wsdl:output name="purchaseResponse">
<soap:body use="literal"/>
 </wsdl:output>
<wsdl:fault name="fault">
<soap:fault name="fault" use="literal"/>
 </wsdl:fault>
</wsdl:operation>

Finally, I use maven to generate my java code

              <plugin>
                  <groupId>org.apache.cxf</groupId>
                  <artifactId>cxf-codegen-plugin</artifactId>
                  <version>${cxf.version}</version>
                  <executions>
                     <execution>
                        <configuration>
<fork>once</fork>
                          <sourceRoot>
                              ${basedir}/target/generated-sources
                           </sourceRoot>
   <defaultOptions>
<frontEnd>jaxws21</frontEnd>
    </defaultOptions>
                           <wsdlOptions>
                                <wsdlOption>
                                   <wsdl>

 ${basedir}/src/main/resources/PartnerTransactionServices.wsdl
                                   </wsdl>

 <extendedSoapHeaders>true</extendedSoapHeaders>
                               </wsdlOption>
                           </wsdlOptions>
                        </configuration>
                        <goals>
                           <goal>wsdl2java</goal>
                        </goals>
                     </execution>
                  </executions>
 <dependencies>
<dependency>
   <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-impl</artifactId>
   <version>2.2</version>
</dependency>
 <dependency>
   <groupId>com.sun.xml.bind</groupId>
   <artifactId>jaxb-xjc</artifactId>
    <version>2.2</version>
</dependency>
                            <dependency>
                                <groupId>org.apache.cxf</groupId>

<artifactId>cxf-rt-bindings-soap</artifactId>
                                <version>2.7.5</version>
                            </dependency>
                        </dependencies>
               </plugin>

Brett Heroux

Reply via email to