0

I generate Java code using wsimport and a given, 3rd party WSDL (which I can't change). The WSDL uses a Java keyword ('return') and thus wsimport will not generate the JAVA code.

To be able to show you an example I globally replaced the name 'return' into 'retParam'.

Here's the generated java code fot a certain message from the WSDL:

/**
 * 
 * @param retParam
 * @param header0
 * @param parameters
 * @param header
 */
@WebMethod(operationName = "CreatePermissionRequest", action = "http://www.url.be/WSUpdate/v1/CreatePermissionRequest")
public void createPermissionRequest(
    @WebParam(name = "CreatePermissionRequestRequest", targetNamespace = "http://www.url2.be/WSUpdate/messages/v1_00", partName = "parameters")
    CreatePermissionRequestRequest parameters,
    @WebParam(name = "SyncHeader", targetNamespace = "http://www.url.be/v1_00", header = true, partName = "header")
    SyncHeader header,
    @WebParam(name = "CreatePermissionRequestReply", targetNamespace = "http://www.url2.be/WSUpdate/messages/v1_00", mode = WebParam.Mode.OUT, partName = "retParam")
    Holder<CreatePermissionRequestReply> retParam,
    @WebParam(name = "SyncResponseHeader", targetNamespace = "http://www.url.be/v1_00", header = true, mode = WebParam.Mode.OUT, partName = "header")
    Holder<SyncResponseHeader> header0);

And this is the entry in the WSDL :

<message name="CreatePermissionRequestReply">
    <part name="retParam" element="messages:CreatePermissionRequestReply" />
    <part name="header" element="fsb:SyncResponseHeader" />
</message>

As you can see the part name is called 'retParam' and this is translated in an attribute of the createPermissionRequest - interface. Which custom binding do I need the specify when I generate the Java code using wsimport so the the part name 'retParam' is mapped to something else ?

Currently I'm using this bindings file, but it doesn't work :( :

 <?xml version="1.0" encoding="UTF-8"?>
 <jaxws:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jaxws="http://java.sun.com/xml/ns/jaxws" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" version="2.0" wsdlLocation="WSUpdateTAP.wsdl">
      <jaxws:bindings node="wsdl:definitions/wsdl:portType[@name='WSUpdate']/wsdl:operation[@name='CreatePermissionRequest']">
          <jaxb:parameter part="definitions/message[@name='CreatePermissionRequestReply']/
part[@name='retParam']" element="retParam"
name="ret"/> 
      </jaxws:bindings>
  </jaxws:bindings>

And here is a full WSDL (not fot the Update service as mentioned above, but for the Status service, it's a smaller WSDL but has the same problem : use of return keyword) :

<types>
    <xs:schema
        targetNamespace="http://www.url2.be/WSStatus/messages/v1_00"
        elementFormDefault="qualified" attributeFormDefault="unqualified">
        <xs:import namespace="http://www.url1.be/v1_00"
            schemaLocation="fsb/fsb.xsd" />
        <xs:include schemaLocation="WSStatus/wsstatus_messages.xsd" />
    </xs:schema>
</types>

<message name="checkAvailabilityRequestMessage">
    <part name="parameters" element="messages:checkAvailability" />
    <part name="header" element="fsb:SyncHeader" />
</message>

<message name="checkAvailabilityResponseMessage">
    <part name="return" element="messages:checkAvailabilityReturn" />
    <part name="header" element="fsb:SyncResponseHeader" />
</message>

<portType name="WSStatus">
    <operation name="checkAvailability">
        <input message="tns:checkAvailabilityRequestMessage"></input>
        <output message="tns:checkAvailabilityResponseMessage"></output>
    </operation>
</portType>

<binding name="WSStatusSOAPBinding" type="tns:WSStatus">
    <soap:binding style="document"
        transport="http://schemas.xmlsoap.org/soap/http" />

    <operation name="checkAvailability">
        <soap:operation style="document"
            soapAction="http://www.url1.be/WSStatus/v1/checkAvailability" />

        <input>
            <soap:body use="literal" parts="parameters" />
            <soap:header use="literal" part="header"
                message="tns:checkAvailabilityRequestMessage" />
        </input>

        <output>
            <soap:body use="literal" parts="return" />
            <soap:header use="literal" part="header"
                message="tns:checkAvailabilityResponseMessage">
            </soap:header>
        </output>
    </operation>
</binding>

<service name="WSStatusService">
    <port name="WSStatusSOAP" binding="tns:WSStatusSOAPBinding">
        <soap:address location="https://www.url2.be/fsb/WSStatus" />
    </port>
</service>
</definitions>

Any ideas what's wrong ?

N0lf
  • 138
  • 7

0 Answers0