3

我有以下架构:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns:m="http://ws.mypackage.com" 
xmlns:xmime="http://www.w3.org/2005/05/xmlmime" elementFormDefault="qualified"
targetNamespace="http://ws.mypackage.com" 
attributeFormDefault="unqualified"> 

    <xs:element name="downloadMessageRequestSaaj">
        <xs:complexType/>
    </xs:element>

    <xs:element name="downloadMessageRequest">
        <xs:complexType/>
    </xs:element>   

    <xs:element name="downloadMessageResponseSaaj" type="m:downloadResponseSaajType" />

    <xs:complexType name="downloadResponseSaajType">
            <xs:sequence>
                <xs:element name="requestName" type="xs:string"/>
                <xs:element name="payLoad">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="messagePayLoad" type="xs:base64Binary" xmime:expectedContentTypes="multipart/related"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
     </xs:complexType>

    <xs:element name="downloadMessageResponse" type="m:downloadResponseType" />

    <xs:complexType name="downloadResponseType">
            <xs:sequence>
                <xs:element name="requestName" type="xs:string"/>
                <xs:element name="payLoad">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="messagePayLoad" type="xs:base64Binary" xmime:expectedContentTypes="multipart/related"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
     </xs:complexType>


     <xs:element name="localDTMRequest">
        <xs:complexType/>
    </xs:element>

    <xs:element name="localDTMResponse">
        <xs:complexType>        
            <xs:sequence>
                <xs:element name="localDTM" type="xs:dateTime"/>
            </xs:sequence>          
        </xs:complexType>
    </xs:element>    

</xs:schema>

并配置 Spring 自动生成 WSDL 文件,如下所示:

<ws:dynamic-wsdl id="serviceDefinition" portTypeName="myService"
        locationUri="http://localhost:8080/springWsTest/webservice">
        <ws:xsd location="/WEB-INF/schemas/schema.xsd" />
    </ws:dynamic-wsdl>

生成的 WSDL 文件缺少用于 downloadMessageRequestSaaj 和 downloadMessageResponseSaaj 的“消息”。这是为什么?

这是生成的wsdl文件..

<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:sch="http://ws.mypackage.com" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://ws.mypackage.com" targetNamespace="http://ws.mypackage.com">
  <wsdl:types>
    <xs:schema xmlns:m="http://ws.mypackage.com" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://ws.mypackage.com">   

    <xs:element name="downloadMessageRequestSaaj">
        <xs:complexType/>
    </xs:element>

    <xs:element name="downloadMessageRequest">
        <xs:complexType/>
    </xs:element>   

    <xs:element name="downloadMessageResponseSaaj" type="m:downloadResponseSaajType"/>

    <xs:complexType name="downloadResponseSaajType">
            <xs:sequence>
                <xs:element name="requestName" type="xs:string"/>
                <xs:element name="payLoad">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="messagePayLoad" type="xs:base64Binary" xmime:expectedContentTypes="multipart/related"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
     </xs:complexType>

    <xs:element name="downloadMessageResponse" type="m:downloadResponseType"/>

    <xs:complexType name="downloadResponseType">
            <xs:sequence>
                <xs:element name="requestName" type="xs:string"/>
                <xs:element name="payLoad">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="messagePayLoad" type="xs:base64Binary" xmime:expectedContentTypes="multipart/related"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
     </xs:complexType>


     <xs:element name="localDTMRequest">
        <xs:complexType/>
    </xs:element>

    <xs:element name="localDTMResponse">
        <xs:complexType>        
            <xs:sequence>
                <xs:element name="localDTM" type="xs:dateTime"/>
            </xs:sequence>          
        </xs:complexType>
    </xs:element>    

</xs:schema>
  </wsdl:types>
  <wsdl:message name="localDTMRequest">
    <wsdl:part element="tns:localDTMRequest" name="localDTMRequest">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="localDTMResponse">
    <wsdl:part element="tns:localDTMResponse" name="localDTMResponse">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="downloadMessageRequest">
    <wsdl:part element="tns:downloadMessageRequest" name="downloadMessageRequest">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="downloadMessageResponse">
    <wsdl:part element="tns:downloadMessageResponse" name="downloadMessageResponse">
    </wsdl:part>
  </wsdl:message>
  <wsdl:portType name="myService">
    <wsdl:operation name="localDTM">
      <wsdl:input message="tns:localDTMRequest" name="localDTMRequest">
    </wsdl:input>
      <wsdl:output message="tns:localDTMResponse" name="localDTMResponse">
    </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="downloadMessage">
      <wsdl:input message="tns:downloadMessageRequest" name="downloadMessageRequest">
    </wsdl:input>
      <wsdl:output message="tns:downloadMessageResponse" name="downloadMessageResponse">
    </wsdl:output>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="myServiceSoap11" type="tns:myService">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="localDTM">
      <soap:operation soapAction=""/>
      <wsdl:input name="localDTMRequest">
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="localDTMResponse">
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="downloadMessage">
      <soap:operation soapAction=""/>
      <wsdl:input name="downloadMessageRequest">
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="downloadMessageResponse">
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="myServiceService">
    <wsdl:port binding="tns:myServiceSoap11" name="myServiceSoap11">
      <soap:address location="http://localhost:8080/springWsTest/webservice"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

我已经浏览了模式文件一百万次,但看不到生成的消息和未生成的消息之间有任何区别。你能明白为什么他们不是吗?

4

1 回答 1

13

是因为名字。Spring 使用消息被调用SomethingRequest和响应的约定SomethingResponse

于 2012-07-14T17:13:48.400 回答