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

Man*_*ndo 3 java soap wsdl web-services

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

WS-I: (BP2208) wsdl:operation was not a request/response or one-way operation.
Run Code Online (Sandbox Code Playgroud)

这是我写的 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>
Run Code Online (Sandbox Code Playgroud)

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

我认为问题的根源是“updateManager”操作,但我不知道如何解决。有人能帮助我吗?先感谢您。

Bog*_*dan 5

一个端点可以支持 4 种类型的操作。从WSDL 规范

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

  • 单向。端点接收消息。
  • 请求响应。端点接收消息,并发送相关消息。
  • 请求响应。端点发送消息,并接收相关消息。
  • 通知。端点发送消息。

WS-I Profile 似乎有一条规则,只支持其中两个。来自 WS-I,测试断言:BP2208

上下文:
对于 wsdl:portType 定义中的候选 wsdl:operation

断言描述:
wsdl:operation 元素是 WSDL 请求/响应或单向操作(无通知或请求响应)。

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

你的updateManager操作是一个Notification和从这里你的警告。

清除错误取决于您的互操作性合规性需求。您可以忽略警告(这样您的服务就不会 100% 兼容互操作性),也可以通过更改操作类型(这取决于您的应用程序)来修复它。