Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
272 views
in Technique[技术] by (71.8m points)

node.js - How is a SOAP call possible without WSDL?

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

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>`;

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.

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?

How does this work?

question from:https://stackoverflow.com/questions/65598875/how-is-a-soap-call-possible-without-wsdl

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The WSDL is not your web service.

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.

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.

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: Is it mandatory to have a WSDL definition accessible using ?wsdl?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...