【问题标题】:Understanding WSDL files. Two WSDL files for one web service了解 WSDL 文件。一个 Web 服务的两个 WSDL 文件
【发布时间】:2016-12-05 09:49:10
【问题描述】:

我参与使用网络服务。我给出的文档是两个 WSDL 文件。由于安全原因,我无法发布这些文件。我必须创建一个代码来使用这个 Web 服务。我已经收到了调用该服务的凭据。

我必须完全依赖这个 WSDL 文件。以下是文件中的示例代码 sn-p。

WebService.wsdl

 <wsdl:message name:"createFunctionRequest”>
    <wsdl:part name=“ createFunctionRequest” element=“s1: createFunctionRequestMsg"
 </wsdl:message>

 <wsdl:operation name:"createFunctionRequest”>
    <wsdl:input name=“ createFunctionRequest” message=“ins: createFunctionRequest"
 </wsdl:operation>

第三方.wsdl

 <wsdl:message name:"FunctionCreated”>
    <wsdl:part name=“FunctionCreated” element=“s1: FunctionCreatedMsg"
 </wsdl:message>

 <wsdl:operation name:"FunctionCreated”>
    <wsdl:input name=“FunctionCreated” message=“ins: FunctionCreated"
 </wsdl:operation>

我的假设是“调用 createFunctionRequest 我必须向 Web 服务发送一个 createFunctionRequestMsg。然后作为响应,我将收到 FunctionCreatedMsg。 “对吗?

我正在尝试在 SoapUI 中使用此 wsdl 文件创建模拟 Web 服务。但是它在操作后发送了响应:createFunctionRequest dint 中有输出字段。在这种情况下,如何将这两个文件合并为一个并模拟 Web 服务?

请帮助我理解这一点。 谢谢。

【问题讨论】:

    标签: web-services wsdl soapui soap-client


    【解决方案1】:

    你的假设是部分正确的。

    正确 -

    要调用 createFunctionRequest 我必须发送一个 将 createFunctionRequestMsg 发送到 Web 服务。

    不正确 -

    然后作为响应,我将收到 FunctionCreatedMsg。

    因为createFunctionRequest操作只包含input参数,所以没有output参数。所以你不会得到任何回复。这是一个on-way web-service的例子。我的理解是你正在寻找一个同步的请求-响应web-service,你的wsdl会变得更像下面的那个。

    你需要在你的wsdl操作中添加output变量——

         <wsdl:message "name:createFunctionRequest">
        <wsdl:part name="createFunctionRequest” element="s1: createFunctionRequestMsg"/>
     </wsdl:message>
    <wsdl:message "name:FunctionCreated">
    <wsdl:part name="FunctionCreated” element="s1:FunctionCreatedMsg"/>
    </wsdl:message>
    
     <wsdl:operation "name:createFunctionRequest”>
        <wsdl:input name="createFunctionRequest" message="ins: createFunctionRequest"/>
        <wsdl:output name="FunctionCreated" message="ins: FunctionCreated"/>
     </wsdl:operation>
    

    另一种方法是在你的Webservice.wsdl中导入Thirdparty.wsdl。这样你就可以得到消息类型了。

    这样做您将能够在 SOAPUI 中获得响应。

    如果您的服务是异步服务,您需要回调 FunctionCreated 操作作为 createFunctionRequest 的响应,那么您的 wsdl 看起来会有所不同。如果是这样,请告诉我。

    【讨论】:

    • 嗨哈宾,感谢您的回复。 Web 服务将向我发送推送消息。从我作为描述的一部分得到的序列图中说,作为对“createFunctionRequest”的响应,当在服务器中创建新函数时,我将得到“FunctionCreated”响应。
    • 我的理解是您正在处理异步 Web 服务。在这里很好地解释了-docs.oracle.com/cd/E14571_01/web.1111/e15184/…。这里是 SOAPUI 测试的链接blog.soasuitehandbook.org/…
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-10-07
    • 1970-01-01
    • 2011-03-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多