在没有 WSDL 的情况下如何进行 SOAP 调用? [英] How is a SOAP call possible without WSDL?

查看:38
本文介绍了在没有 WSDL 的情况下如何进行 SOAP 调用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对我的 SOAP 调用在下面的工作方式感到困惑.

I am confused over how my SOAP call is working below.

我们对我们的软件进行了产品升级,并且托管在 https://"+host+"/tc/services/BotOps-2018-11-ASMLBotOps?wsdl 的 WSLD 是移动到其他位置,无法通过网络访问.

We had a product upgrade to our software, and the WSLDs hosted at https://"+host+"/tc/services/BotOps-2018-11-ASMLBotOps?wsdl are moved to a different location, which is not accessible via web.

我现有的代码如下所示:

My existing code looks like this:

var options = {​​​​​​​​
  url:"https://"+host+"/tc/services/BotOps-2018-11-ASMLBotOps?wsdl",
  method:'POST',
  body:xml,
  headers: {​​​​​​​​
    'Content-Type':'text/xml;charset=utf-8',
    'Content-Length':xml.length,
    'SOAPAction':"asmlValidateUserAdminBotOpsService",
    'Cookie':from
  }​​​​​​​​
}​​​​​​​​;
       
var xml = `<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:asm="http://a5oa.com/Schemas/BotOps/2018-11/ASMLBotOps">
    <soapenv:Header/>
    <soapenv:Body>
       <asm:AsmlValidateUserAdminBotOpsServiceInput>
          <asm:asmlValidateUserIsAdminOpsInput pszAsmlTcUserID="`+args[1]+`" pszRequestorUserId="`+args[2]+`"/>
       </asm:AsmlValidateUserAdminBotOpsServiceInput>
    </soapenv:Body>
 </soapenv:Envelope>`;

这在没有我们的产品升级的情况下运行良好,我理解.但是,如果 WSDL 被移动到一个无法访问的不同位置,并且我所指的 url 现在没有任何意义,那么这个 Web 服务请求怎么可能仍然按预期工作?我原以为 Web 服务现在会失败,因为 WSDL 不存在,但它仍然有效.

This worked fine without our product upgrade, which I understand. But if the WSDLs are moved to a different location which are not accessible and the url that I am referring to means nothing now, how can it be that this web service request is still working as expected? I was expecting that the web service now fails because the WSDL does not exist, but it still works.

我在某处读到 WSDL 就像其他语言中的头文件,其中包含 SOAP 粗略地接受作为输入并作为输出返回的蓝图.那么在没有 WSDL 的情况下触发 SOAP 请求是否明智?

I have read somewhere that a WSDL is like a header file in other languages, that contains the blueprint of what a SOAP accepts as input roughly and returns as output. So is it even sensible to fire a SOAP request without a WSDL?

这是如何工作的?

推荐答案

WSDL 不是您的网络服务.

WSDL 用于描述网络服务合同,以便您了解如何调用网络服务(它具有哪些操作、哪些参数名称、参数类型、在哪里可以找到其端点等).然后调用 Web 服务,而不是 WSDL.

The WSDL is used to describe a web service contract so that you know how to call the web service (what operations it has, what parameter names, parameter types, where to find its endpoints, etc). You then call the web service, not the WSDL.

另一件要提到的事情是您获得了一个 WSDL(通常按照在 Web 服务端点上使用 ?wsdl 参数的约定),但是您通过执行 POST 来调用 Web 服务.因此,如果服务仍然存在并接受 POST 请求,那么您可以从何处检索其 WSDL 并不重要.

Another thing to mention is that you GET a WSDL (normally with the convention of using a ?wsdl parameter on the web service endpoint), but you call the web service by doing a POST. So if the service is still there and accepts POST request, it doesn't really matter from where you can retrieve its WSDL.

提供一个(可能是愚蠢的)类比,WSDL 适用于 SOAP Web 服务,就像菜单适用于餐厅一样.您可以在线下载菜单,您可以在餐厅获得菜单,或者如果有人在从印刷厂运送到餐厅时丢失了菜单,您可以在街上找到菜单.但是如果你想在餐厅消费食物,你必须去餐厅,你不消费菜单本身.

To provide a (possible silly) analogy, the WSDL is for a SOAP web service like a menu is to a restaurant. You can download the menu online, you can get the menu at the restaurant, or you can find the menu on the street if someone dropped it when it was transported from the printing house to the restaurant. But if you want to consume food at the restaurant, you have to go to the restaurant, you don't consume the menu itself.

您可能会觉得有用的其他一些细节:

Some other details you might find useful:

这篇关于在没有 WSDL 的情况下如何进行 SOAP 调用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆