2012-05-15 34 views
5

Tôi gặp sự cố khi tạo WS từ WSDL bằng phương tiện của wsimport.Tạo webservice từ WSDL với định dạng Tài liệu/dạng chữ

WSDL là TMDD chuẩn v3.0 đặc điểm kỹ thuật (WSDL và XSD file có liên quan có thể tìm thấy here)

Theo this article from IBM WSDL có vẻ là ở định dạng tài liệu/chữ.

Để có được WSDL biên soạn tôi đã tạo ra một số bindings/chỉnh tuy nhiên tôi đang bị mắc kẹt tại lỗi này (nó không tạo ra một phương pháp kể từ khi hoạt động có nhiều hơn một phần):

[WARNING] Ingoring operation "DlFullEventUpdateSubscription": more than one part 
bound to body 
    line 17 of file:/O:/temp/wsdltest/TMDD-stripped.wsdl 

Để đơn giản hóa, đây là phiên bản rút gọn của WSDL với chỉ định nghĩa hoạt động thú vị

<?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> 

các 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> 

Các dòng lệnh để gọi wsimport như sau:

O:\temp\wsdltest>wsimport -extension -Xdebug -s src -b bindings.xjb TMDD-stripped.wsdl 

Tôi có thể làm gì để có được những "DlFullEventUpdateSubscription" hoạt động tạo ra một cách chính xác? Có bất kỳ lựa chọn thay thế nào để tạo dịch vụ web Java không? Tôi không thể sửa đổi định nghĩa hoạt động, vì điều đó sẽ không tuân thủ tiêu chuẩn.

Cập nhật. Giải pháp

tôi quản lý để làm cho nó làm việc bằng cách sửa đổi WSDL vì vậy mỗi một phần của thông điệp được gán cho tiêu đề và cơ thể:

<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> 

Trả lời

2

Document-Literal có thể không có các hoạt động nhắn đa phần. Bạn có thể sử dụng các giải pháp thay thế dưới đây.

  • Sử dụng kiểu văn bản/theo kiểu chữ - Bọc nhiều phần trong một tài liệu .
  • Sử dụng kiểu RPC/Literal - Không có hạn chế về việc ràng buộc nhiều phần trong phần thân xà phòng.

Cảm ơn, Sreehari.

+0

Bạn định cấu hình bất kỳ lựa chọn thay thế nào trong wsdl? Cảm ơn –

+0

Đặt c2cMessageSubscription và eventRequestMsg trong phần tử khác. ' \t ... \t ... ' sau đó thêm "gốc" như chỉ là một phần của MSG_EventSubscription. – sreehari

Các vấn đề liên quan