Eclipse中验证期间出现奇怪的WSDL警告:“wsdl:operation不是请求/响应或单向操作”

时间:2014-01-17 15:09:26

标签: java web-services soap wsdl

我正在编写一个WSDL文件,我无法从Eclipse验证器中删除此警告:

WS-I: (BP2208) wsdl:operation was not a request/response or one-way operation.

这是我写的WSDL源代码:

<?xml version="1.0" encoding="UTF-8"?>

<definitions name="Master"
    targetNamespace="http://pad.polito.it/ACSAuth"
    xmlns:tns="http://pad.polito.it/ACSAuth"

    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns="http://schemas.xmlsoap.org/wsdl/">

    <types>
        <xs:schema 
        xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0"
        targetNamespace="http://pad.polito.it/ACSAuth"
        xmlns:tns="http://pad.polito.it/ACSAuth">

            <xs:element name="AccessDB" type="tns:AccessDBType">
            <!-- OMITTED COMPLEX TYPE AccessDBType -->

            <xs:element name="passThrough" type="tns:passThroughType"/>
            <!-- OMITTED COMPLEX TYPE passThroughType -->

        </xs:schema>
    </types>

    <message name="updatedDB">
        <part name="db" element="tns:AccessDB"/>
    </message>

    <message name="passThroughNotice">
        <part name="info" element="tns:passThrough"/>
    </message>

    <portType name="myPorts">
        <operation name="updateManager">
            <output name="newUpdate" message="tns:updatedDB"/>
        </operation>
        <operation name="noticeManager">
            <input name="newNotice" message="tns:passThroughNotice"/>
        </operation>
    </portType>

    <binding name="myBindings" type="tns:myPorts">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
        <operation name="updateManager">
            <soap:operation soapAction="" />
            <output>
                <soap:body use="literal"/>
            </output>
        </operation>
        <operation name="noticeManager">
            <soap:operation soapAction="" />
            <input>
                <soap:body use="literal"/>
            </input>
        </operation>
    </binding>

    <service name="MyServices">
        <port name="ACSAuth" binding="tns:myBindings">
            <soap:address location="http://localhost:8181/ACSAuth"/>
        </port>
    </service>

</definitions>

在这里,您可以找到完整的WSDL文件:https://dl.dropboxusercontent.com/u/33459047/StackOverflow/Master.wsdl

我认为问题的根源是操作“updateManager”,但我不知道如何修复它。 有谁可以帮助我吗?提前谢谢。

1 个答案:

答案 0 :(得分:3)

端点可以支持4种类型的操作。来自WSDL specs

  

WSDL有四个端点可以支持的传输原语:

     
      
  • 单向即可。端点收到一条消息。
  •   
  • 请求 - 响应即可。端点接收消息,并发送相关消息。
  •   
  • 要求响应即可。端点发送消息,并接收相关消息。
  •   
  • 通知即可。端点发送消息。
  •   

WS-I配置文件似乎有一条规则只支持其中两个。 From WS-I, Test Assertion: BP2208

  

<强>上下文   
对于候选wsdl:在wsdl:portType定义中的操作

     

断言说明:   
wsdl:operation元素是WSDL请求/响应或单向操作(无通知或Sollicit-Response)。

     

失败消息:   
wsdl:操作不是请求/响应或单向操作。

您的updateManager操作是Notification,此处是您的警告。

清除错误取决于您interoperability compliance的需求。您可以忽略警告(然后您的服务将不是100%互操作性兼容),或者您可以通过更改操作类型(取决于您的应用程序)来修复它。