简体   繁体   中英

difference between wsdl.exe and wsimport

A have description of the Web service that I need to implement.

order-processor-Service.wsdl

    <?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions 
    xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
    xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:port="http://xxxx.yy.ru/services/forms/integration/orderprocess"
    xmlns:tns="http://xxxx.yy.ru/services/forms/integration/orderprocess"
    targetNamespace="http://xxxx.yy.ru/services/forms/integration/orderprocess"
    >

    <wsdl:import namespace="http://xxxx.yy.ru/services/forms/integration/orderprocess" location="order-processor.wsdl"/>

    <wsdl:binding name="OrderProcessorSOAP" type="port:IOrderProcessor">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="processOrder">
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
            <wsdl:fault name="fault">
                <soap:fault name="fault" use="literal"/>
            </wsdl:fault>
        </wsdl:operation>
    </wsdl:binding>

    <wsdl:service name="OderProcessorService">
        <wsdl:port name="OrderProcessorSoap" binding="tns:OrderProcessorSOAP">
            <soap:address location="http://localhost/OrderProcessorService"/>
        </wsdl:port>
   </wsdl:service>

</wsdl:definitions>

order-processor.wsdl

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions 
    xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
    xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:data="http://xxxx.yy.ru/services/forms/integration/orderprocess"
    xmlns:tns="http://xxxx.yy.ru/services/forms/integration/orderprocess"
    targetNamespace="http://xxxx.yy.ru/services/forms/integration/orderprocess"
    >


    <wsdl:types>
        <xs:schema>
            <xs:import namespace="http://xxxx.yy.ru/services/forms/integration/orderprocess" schemaLocation="order-processor.xsd"/>
        </xs:schema>
    </wsdl:types>

    <wsdl:message name="processOrderRequest">
        <wsdl:part name="params" element="data:processOrder" />
    </wsdl:message>

    <wsdl:message name="processOrderResponse">
        <wsdl:part name="params" element="data:processOrderResponse" />
    </wsdl:message>

    <wsdl:message name="OrderProcessorException">
        <wsdl:part name="params" element="data:processOrderFault" />
    </wsdl:message>

    <wsdl:portType name="IOrderProcessor">
        <!-- wsdl:portType customizations -->
        <jaxws:bindings xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
            <jaxws:enableWrapperStyle>true</jaxws:enableWrapperStyle>
        </jaxws:bindings>        
        <wsdl:operation name="processOrder">
            <wsdl:input     name="message"  message="tns:processOrderRequest"  />
            <wsdl:output    name="return"   message="tns:processOrderResponse" />
            <wsdl:fault     name="fault"    message="tns:OrderProcessorException"    /> 
        </wsdl:operation>
    </wsdl:portType>

</wsdl:definitions>

order-processor.xsd

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema 
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://xxxx.yy.ru/services/forms/integration/orderprocess"
    xmlns:tns="http://xxxx.yy.ru/services/forms/integration/orderprocess"
    xmlns:types="http://xxxx.yy.ru/services/forms/integration/types"
    elementFormDefault="qualified" 
    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
    jaxb:version="2.0"
    >

    <xs:import namespace="http://xxxx.yy.ru/services/forms/integration/types" schemaLocation="forms-services-types.xsd"/>


    <xs:annotation>
        <xs:appinfo>
            <jaxb:globalBindings>
                <jaxb:javaType name="java.util.Calendar" xmlType="xs:date"
                    parseMethod="javax.xml.bind.DatatypeConverter.parseDateTime"
                    printMethod="javax.xml.bind.DatatypeConverter.printDateTime"
                />
                <jaxb:javaType name="java.util.Calendar" xmlType="xs:dateTime"
                    parseMethod="javax.xml.bind.DatatypeConverter.parseDateTime"
                    printMethod="javax.xml.bind.DatatypeConverter.printDateTime"
                />
                <jaxb:serializable uid="1" />
            </jaxb:globalBindings>
        </xs:appinfo>
    </xs:annotation>

    <xs:element name="processOrder" type="tns:ProcessOrderRequest" />

    <xs:element name="processOrderResponse" type="tns:ProcessOrderResponse" />


    <xs:element name="processOrderFault" type="xs:string">
        <xs:annotation>
            <xs:documentation>
                Элемент содержит сообщение об ошибке (то что будет пользователю показываться)
            </xs:documentation>
        </xs:annotation>
    </xs:element>


    <xs:complexType name="ProcessOrderRequest">
        <xs:sequence>
            <xs:element name="OrderHeader"  type="tns:OrderHeader">
                <xs:annotation>
                    <xs:documentation>
                        Доступная служебная информация о заявке (почти все, что хранится в базе)
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="OrderPayload" >
                <xs:annotation>
                    <xs:documentation>
                        Модель данных из формы
                    </xs:documentation>
                </xs:annotation>
                <xs:complexType>
                    <xs:sequence>
                        <xs:any/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="OrderAttachments" type="tns:OrderAttachments" >
                <xs:annotation>
                    <xs:documentation>
                         Прикрепленные файлы из формы
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="ProcessOrderResponse">
        <xs:sequence>
            <xs:annotation>
                <xs:documentation>
                    Идентификатор заявки назначенный внешней сиситемой
                </xs:documentation>
            </xs:annotation>
            <xs:element name="return" type="xs:string" />
        </xs:sequence>
    </xs:complexType>


    <xs:complexType name="OrderHeader">
        <xs:sequence>
            <xs:element ref="types:order"/>
            <xs:element ref="types:service"/>
        </xs:sequence>            
    </xs:complexType>

    <xs:complexType name="OrderAttachments">
        <xs:sequence>
            <xs:element ref="types:attachments" />
        </xs:sequence>
    </xs:complexType>

</xs:schema>

and forms-services-types.xsd

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema 
    version="1.0"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://xxxx.yy.ru/services/forms/integration/types"
    xmlns:tns="http://xxxx.yy.ru/services/forms/integration/types"
    elementFormDefault="qualified"
    >

    <xs:element name="order" type="tns:OrderType"/>
    <xs:element name="service" type="tns:ServiceType"/>
    <xs:element name="attachments" >
        <xs:complexType>
            <xs:sequence>
                <xs:element name="attachment" type="tns:AttachmentType" minOccurs="1" maxOccurs="unbounded"/> 
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:complexType name="OrderType">
        <xs:sequence>
            <xs:element name="guid" type="xs:string">
                <xs:annotation>
                    <xs:documentation>
                        внутренний мдентификатор заявки. для служебного пользования
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="humanID" type="xs:string">
                <xs:annotation>
                    <xs:documentation>
                        идентификатор заявки  отображаемый пользователю
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="externalId" type="xs:string">
                <xs:annotation>
                    <xs:documentation>
                        идентификатор заявки, присваеваемый обрабатывающей сиситемой. 
                        Если система поддерживает наши идентификаторы, то вероятно будет равен guid
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="creationDate" type="xs:dateTime">
                <xs:annotation>
                    <xs:documentation>
                        дата создаия заявки
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="userId" type="xs:string">
                <xs:annotation>
                    <xs:documentation>
                        идентификатор пользователя, подавшего заявку
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="serviceId" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>


    <xs:complexType name="ServiceType">
        <xs:sequence>
            <xs:element name="guid" type="xs:string">
                <xs:annotation>
                    <xs:documentation>
                        идентификатор услуги                        
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="name" type="xs:string">
                <xs:annotation>
                    <xs:documentation>
                        имя услуги
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="orderPrefix" type="xs:string">
                <xs:annotation>
                    <xs:documentation>
                        префикс для идентификтора заявки  данной услуги.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="properties">
                <xs:annotation>
                    <xs:documentation>
                        свойства специфичные для обработчиков данной услуги
                    </xs:documentation>
                </xs:annotation>
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="property" type="tns:PropertyType" minOccurs="1" maxOccurs="unbounded"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="PropertyType">
        <xs:sequence>
            <xs:element name="value" type="xs:string"/>
        </xs:sequence>
        <xs:attribute name="name" type="xs:string" use="required"/>
    </xs:complexType>

    <xs:complexType name="AttachmentType">
        <xs:sequence>
            <xs:element name="name"     type="xs:string"/>
            <xs:element name="mimeType" type="xs:string"/>
            <xs:element name="data"     type="xs:base64Binary"/>
        </xs:sequence>
    </xs:complexType>



</xs:schema>

When I try to generate code using wsimport - all good, but when I use wsdl.exe - I get an error:

C:\Documents and Settings\Alex\Рабочий стол\orders-processing>"C:\Program Files\
Microsoft SDKs\Windows\v7.0A\bin\wsdl.exe" /serverInterface order-processor-Serv
ice.wsdl order-processor.wsdl order-processor.xsd forms-services-types.xsd
Microsoft (R) Web Services Description Language Utility
[Microsoft (R) .NET Framework, Version 2.0.50727.3038]
Copyright (C) Microsoft Corporation. All rights reserved.
Error: Unable to import binding 'OrderProcessorSOAP' from namespace 'http://xxxx
.yy.ru/services/forms/integration/orderprocess'.
  - Unable to import operation 'processOrder'.
  - The operation binding 'processOrder' from namespace 'http://xxxx.yy.ru/servi
ces/forms/integration/orderprocess' had invalid syntax.  Missing soap:operation
binding.

If you would like more help, please type "wsdl /?".

I need a service implementation for C#, not java. Please, help me.

The error message

Missing soap:operation binding

implies that you need to use a

<soap:operation soapAction="" />

declaration or similar.

The absence of this declaration can cause the error you are experiencing.

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