wsdl.exe和wsimport之间的区别

时间:2013-12-17 10:55:12

标签: c# java wsdl

A描述了我需要实现的Web服务。

顺序处理器的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>

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

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

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

当我尝试使用wsimport生成代码时 - 一切都很好,但是当我使用wsdl.exe时 - 我收到错误:

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 /?".

我需要C#的服务实现,而不是java。 求你帮帮我。

1 个答案:

答案 0 :(得分:2)

错误消息

  

缺少肥皂:操作绑定

表示您需要使用

<soap:operation soapAction="" />

声明或类似。

缺少此声明可能会导致您遇到错误。