javascript - 将 WSDL 文件导入 Javascript
问题描述
我想将 XML 文件中的 WSDL 导入我的 JavaScript 项目,这将允许我使用 Web 客户端来搜索信息。
有什么特殊的方法可以导入到我的项目中,还是需要一个包,或者需要转成JS?我知道 NPM 中有一个 soap 包,但我希望这不是唯一的方法。我还阅读了有关 W3 的教程,但仍然不太确定如何管理它。
我有这样的事情:
function soap() {
var xmlhttp = new XMLHttpRequest();
xmlhttp.open('POST', '127.0.0.1/start.html', true);
// build SOAP request
var sr =
'<soapenv:Envelope ' +
'xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" ' +
'xmlns:aut="http://demo.krd.pl/Authorization" xmlns:dto="http://demo.krd.pl/Chase3.1/Dto"> ' +
'<soapenv:Header> ' +
'<aut:Authorization> '+
'<aut:AuthorizationType>LoginAndPassword</aut:AuthorizationType> ' +
'<aut:Login>login</aut:Login> ' +
'<aut:Password>password</aut:Password> ' +
'</aut:Authorization> ' +
'</soapenv:Header> ' +
'<soapenv:Body> ' +
'<dto:SearchNonConsumerRequest> ' +
'<dto:Number>24041803749</dto:Number> ' +
'<dto:NumberType>TaxId</dto:NumberType> ' +
'</dto:SearchNonConsumerRequest> ' +
'</soapenv:Body> ' +
'</soapenv:Envelope> ';
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
alert('done. use firebug/console to see network response');
}
}
}
// Send the POST request
xmlhttp.setRequestHeader('Content-Type', 'text/xml');
xmlhttp.send(sr);
// send request
// ...
}
此外,响应将保存在哪里,还是仅发布在控制台中?
解决方案
推荐阅读
- javascript - 页面加载后密码管理器如何运行 JS?
- python - Python - 使用 pandas 数据框时,Matplotlib 绘制不正确的图形
- python - 如何从python中的时间列中删除一个时间点到另一个时间点的时间戳
- java - 不能将泛型数组直接分配给局部变量
- android - 检测 Recycler 视图中显示的项目
- css - margin-left 在 Firefox 中不起作用
- ext.net - 在 Ext.Net 中获取生成的商店 ID
- mule - 我正在尝试通过骡子从共享点获取文件元数据
- c# - DTO、数据层和要返回的类型
- python - Python程序不写入输出csv,其他一切似乎都正常工作