I am having troubles generating a WS from a WSDL by means of wsimport.
The WSDL is the TMDD v3.0 standard specification (WSDL and related XSD files can be found here)
According to this article from IBM the WSDL seems to be in Document/literal format.
In order to get the WSDL compiled I have created some bindings/tweaks however I am stuck at this error (it does not generate a method since the operation has more than one part):
[WARNING] Ingoring operation "DlFullEventUpdateSubscription": more than one part
bound to body
line 17 of file:/O:/temp/wsdltest/TMDD-stripped.wsdl
To simplify, this is the stripped down version of the WSDL with only the interesting operation definition
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:tns="http://www.tmdd.org/3/dialogs"
xmlns:tmdd="http://www.tmdd.org/3/messages" xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:c2c="http://www.ntcip.org/c2c-message-administration" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
name="TMDDCenterServices" targetNamespace="http://www.tmdd.org/3/dialogs">
<documentation>
</documentation>
<types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import namespace="http://www.tmdd.org/3/messages"
schemaLocation="TMDD.xsd" />
<xs:import namespace="http://www.ntcip.org/c2c-message-administration"
schemaLocation="C2C.xsd" />
</xs:schema>
</types>
<message name="MSG_EventSubscription">
<part name="c2cMsgAdmin" element="c2c:c2cMessageSubscription" />
<part name="message" element="tmdd:eventRequestMsg" />
</message>
<!-- Common Messages -->
<message name="MSG_ConfirmationReceipt">
<!-- CONNECTION MANAGEMENT Messages -->
<part name="message" element="c2c:c2cMessageReceipt" />
</message>
<message name="MSG_ErrorReport">
<part name="message" element="tmdd:errorReportMsg" />
</message>
<!-- TMDD Owner Center Porttype -->
<portType name="tmddOCSoapHttpServicePortType">
<operation name="DlFullEventUpdateSubscription">
<documentation>
<objectClass>Event</objectClass>
<msgPattern>Sub</msgPattern>
<requirement>REQ1261</requirement>
</documentation>
<input message="tns:MSG_EventSubscription" />
<output message="tns:MSG_ConfirmationReceipt" />
<fault name="errorReport" message="tns:MSG_ErrorReport" />
</operation>
</portType>
<!-- TMDD Owner Center binding -->
<binding name="tmddOCSoapHttpServiceBinding" type="tns:tmddOCSoapHttpServicePortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="DlFullEventUpdateSubscription">
<soap:operation soapAction="' '" style="document" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
<fault name="errorReport">
<soap:fault name="errorReport" use="literal" />
</fault>
</operation>
</binding>
<!-- TMDD Owner Center Service -->
<service name="tmddOCSoapHttpService">
<!-- ************************ -->
<!-- OWNER CENTER Services -->
<!-- ************************ -->
<port name="tmddOCSoapHttpServicePort" binding="tns:tmddOCSoapHttpServiceBinding">
<soap:address location="http://tmdd.owner.center.com/c2cxml/" />
</port>
</service>
</definitions>
The bindings file:
<?xml version="1.0" encoding="UTF-8"?>
<bindings xmlns="http://java.sun.com/xml/ns/jaxb" version="2.1" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
<!-- To create standalone classes instead of nested classes -->
<!--<globalBindings localScoping="toplevel"/>-->
<!--*****************-->
<!-- Package Binding -->
<!--*****************-->
<!--*****************************-->
<!-- C2C classes package binding -->
<!--*****************************-->
<bindings schemaLocation="C2C.xsd">
<schemaBindings>
<package name="tdf.tmdd.model.ntcip.messageadministration" />
</schemaBindings>
</bindings>
<!--**************************************-->
<!-- ITIS-Adopted classes package binding -->
<!--**************************************-->
<bindings schemaLocation="ITIS-Adopted-03-00-02.xsd">
<schemaBindings>
<package name="tdf.tmdd.model.itis.adopted" />
</schemaBindings>
</bindings>
<!--************************************-->
<!-- ITIS-Local classes package binding -->
<!--************************************-->
<bindings schemaLocation="ITIS-Local-03-00-02.xsd">
<schemaBindings>
<package name="tdf.tmdd.model.itis.local" />
</schemaBindings>
</bindings>
<!--**************************************-->
<!-- LRMS-Adopted classes package binding -->
<!--************************************* -->
<bindings schemaLocation="LRMS-Adopted-02-00-00.xsd">
<schemaBindings>
<package name="tdf.tmdd.model.lrms.adopted" />
</schemaBindings>
</bindings>
<!--************************************-->
<!-- LRMS-Local classes package binding -->
<!--************************************-->
<bindings schemaLocation="LRMS-Local-02-00-00.xsd">
<schemaBindings>
<package name="tdf.tmdd.model.lrms.local" />
</schemaBindings>
</bindings>
<!--*******************************-->
<!-- NTCIP classes package binding -->
<!--*******************************-->
<bindings schemaLocation="NTCIP-References.xsd">
<schemaBindings>
<package name="tdf.tmdd.model.ntcip.objectreferences" />
</schemaBindings>
</bindings>
<!--******************************-->
<!-- TMDD classes package binding -->
<!--******************************-->
<bindings schemaLocation="TMDD.xsd">
<schemaBindings>
<package name="tdf.tmdd.model" />
</schemaBindings>
</bindings>
<!--***********************-->
<!-- Class personalization -->
<!--***********************-->
<!--************************************-->
<!-- LRMS-Adopted class personalization -->
<!--************************************-->
<bindings schemaLocation="LRMS-Adopted-02-00-00.xsd">
<bindings node="//xs:complexType[@name='Chain']//xs:sequence//xs:element[@name='chain']//xs:complexType">
<class name="ChainElement" />
</bindings>
<bindings node="//xs:complexType[@name='GridPointPair']">
<class name="GridPointPairAdopted" />
</bindings>
<bindings node="//xs:complexType[@name='AreaLocation']">
<class name="AreaLocationAdopted" />
</bindings>
<bindings node="//xs:complexType[@name='LinkLocation']">
<class name="LinkLocationAdopted" />
</bindings>
<bindings node="//xs:complexType[@name='AdminAreaGroup']">
<class name="AdminAreaGroupAdopted" />
</bindings>
<bindings node="//xs:complexType[@name='GridPointSequence']">
<class name="GridPointSequenceAdopted" />
</bindings>
<bindings node="//xs:complexType[@name='Grid']">
<class name="GridAdopted" />
</bindings>
<bindings node="//xs:complexType[@name='NodeAttribute']">
<class name="NodeAttributeAdopted" />
</bindings>
<bindings node="//xs:complexType[@name='GridPoint']">
<class name="GridPointAdopted" />
</bindings>
</bindings>
<!--********************************-->
<!-- factory method personalization -->
<!--********************************-->
<!--*************************************-->
<!-- TMDD factory method personalization -->
<!--*************************************-->
<bindings schemaLocation="TMDD.xsd" >
<bindings node="//xs:complexType[@name='IntersectionSignalInventoryLinkList']">
<factoryMethod name="createIntersectionSignalInventoryLinks" />
</bindings>
</bindings>
</bindings>
The command line to invoke wsimport is the following:
O:\temp\wsdltest>wsimport -extension -Xdebug -s src -b bindings.xjb TMDD-stripped.wsdl
What can I do to get the "DlFullEventUpdateSubscription" operation correctly created? Are there any alternatives to generate the Java web service? I can not modify the operation definition, since that would not comply with the standard.
Update. Solution
I managed to get it working by modifying WSDL so each part of the message is assigned to header and body:
<binding name="tmddOCSoapHttpServiceBinding" type="tns:tmddOCSoapHttpServicePortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="DlFullEventUpdateSubscription">
<soap:operation soapAction="' '" style="document" />
<input>
<soap:header message="tns:MSG_EventSubscription" use="literal" part="c2cMsgAdmin"/>
<soap:body use="literal" parts="message"/>
</input>
<output>
<soap:body use="literal" />
</output>
<fault name="errorReport">
<soap:fault name="errorReport" use="literal" />
</fault>
</operation>
</binding>
Document-Literal cannot have multi-part message operations. You can use below alternatives.
- Use Document/Literal Wrapped style - Wrap multiple parts in a single document.
- Use RPC/Literal style - No restrictions on binding multiple parts in soap body.
Thanks, Sreehari.
来源:https://stackoverflow.com/questions/10597270/generate-webservice-from-wsdl-with-document-literal-format