简体   繁体   中英

wsimport creates classes that produce a wsdl that is different from the source wsdl

I'm trying to use wsimport (or more accurately I'm using the eclipse wizard that uses wsimport) to generate new server side classes for a webservice. The source WSDL comes from the current implementation via the ../ServiceName?wsdl URL.

My problem is that when I publish the new classes and navigate to the new ?wsdl URL the results WSDL is different than the original. This seems to be a cause of errors when the existing clients try to use the new version of the service. Here is a subsection of the WSDL with an example of a difference that seems to cause a problem with the clients:

Original:

<wsdl:message name="executeResponse">
  <wsdl:part element="impl:ServiceNameResult" name="ServiceNameResult"/>
</wsdl:message>
<wsdl:message name="executeRequest">
  <wsdl:part element="impl:executeRequest" name="executeRequest"/>
</wsdl:message>
<wsdl:portType name="ServiceName">
  <wsdl:operation name="execute" parameterOrder="executeRequest">
    <wsdl:input message="impl:executeRequest" name="executeRequest"/>
    <wsdl:output message="impl:executeResponse" name="executeResponse"/>
  </wsdl:operation>
</wsdl:portType>

New:

<wsdl:message name="executeResponse">
    <wsdl:part element="tns:ServiceNameResult" name="ServiceNameResult">
    </wsdl:part>
</wsdl:message>
<wsdl:message name="execute">
    <wsdl:part element="tns:executeRequest" name="executeRequest">
  </wsdl:part>
</wsdl:message>
<wsdl:portType name="ServiceName">
    <wsdl:operation name="execute">
    <wsdl:input message="tns:execute" name="execute">
    </wsdl:input>
    <wsdl:output message="tns:executeResponse" name="executeResponse">
    </wsdl:output>
  </wsdl:operation>
</wsdl:portType>

The change is in the portType input message. It gets renamed from "executeRequest" to simply "execute".

I can't figure out why this would change or how to correct it in the java classes. All the annotations seem correct.

It seems like the missing "Request" suffix is a feature and not a bug of CXF. What I need to do is either update my clients or implement serverside interceptors:

http://cxf.apache.org/docs/interceptors.html

This:

You will need to subclass org.apache.cxf.service.factory.DefaultServiceConfiguration and override getInputMessageName method to append the QName with "Request". Then, you will have to configure CXF to point the service configuration to your subclass

Also seems like a good solution if I can figure out how to do it. https://stackoverflow.com/questions/27818072/subclassing-defaultserviceconfiguration

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM