相关疑难解决方法(0)

为什么使用SOAP与前端(即Web浏览器)进行通信不是一个好主意?

为什么使用SOAP与前端进行通信不是一个好主意?例如,使用JavaScript的Web浏览器.

javascript soap

23
推荐指数
3
解决办法
3431
查看次数

如何从Javascript/jQuery调用SOAP WS

我想直接从Javascript调用SOAP WebService.我一直在寻找,但仍然无法有所作为.我假设我必须构建SOAP enveloppe(见下文).我也使用jQuery.

首先,我确信我可以调用位于其他地方的SOAP Web服务吗?这就是没有像跨域限制这样的限制.

另外我不确定我需要使用什么是正确的URL,使用Ladon公开SOAP服务,出于调试目的我已经检查过WS与soapUI一起工作,这里是我能找到的URL:

  • WSDL URL:http://192.168.1.5/ws/MyWS/soap/description//从我的理解,它不能是这个
  • 服务端点: http://192.168.1.5/ws/MyWS/soap
  • SOAPAction的: http://192.168.1.5/ws/MyWS/soap/myOperation

我认为我应该使用端点或SOAPAction但它不起作用.我可能会错过这里或后来的Javascript是如此错误,以至于我无法确定.

现在我的实际JS正在进行调用(注释中有一些问题):

<html>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<head>

<script type="text/javascript" src="ressources/jquery-1.7.1.min.js"></script>

<script type="text/javascript">

// inspired by http://openlandscape.net/2009/09/25/call-soap-xm-web-services-with-jquery-ajax/

var soapServiceURL = 'http://192.168.1.5/ws/MyWS/soap/myOperation; // not sure what to put here from a LADON point of view

function callSOAPWS(myParameter)
{
  var soapMessage =
  '<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:LDetector"> \
     <soapenv:Header/> \
     <soapenv:Body> \
        <urn:myOperation soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> \
           <myParameter xsi:type="xsd:string">' + myParameter + '</myParameter > \
        </urn:myOperation > …
Run Code Online (Sandbox Code Playgroud)

javascript jquery soap

16
推荐指数
2
解决办法
9万
查看次数

AngularJS作为SOAP客户端

有没有办法将angularJS用作SOAP客户端或开发SOAP客户端服务?

soap web-services angularjs

10
推荐指数
1
解决办法
3万
查看次数

如何访问SOAP响应属性?

所有

最近几天我找到了如何使用JS访问soap,毕竟我从这个链接得到了解决方案Simplest SOAP示例

现在我能够提醒我的肥皂请求.但我想使用它的属性,并希望打印响应(我的意思是解析响应和显示)

这是我的代码

const xmlhttp = new XMLHttpRequest();
xmlhttp.open('POST', 'http://service.project-development-site.de/soap.php', true);
xmlhttp.onreadystatechange = function() {
  if (xmlhttp.readyState == 4) {
    alert(xmlhttp.responseText);

    // http://www.terracoder.com convert XML to JSON
    let json = XMLObjectifier.xmlToJSON(xmlhttp.responseXML);
    const result = json.Body[0].GetQuoteResponse[0].GetQuoteResult[0].Text;
    // Result text is escaped XML string, convert string to XML object then convert to JSON object
    json = XMLObjectifier.xmlToJSON(XMLObjectifier.textToXML(result));
    alert(symbol + ' Stock Quote: $' + json.Stock[0].Last[0].Text);
  }
};
xmlhttp.setRequestHeader('SOAPAction', 'http://service.project-development-site.de/soap.php');
xmlhttp.setRequestHeader('Content-Type', 'text/xml');
const xml =
  '<?xml version="1.0" encoding="utf-8"?>' +
  '<soapenv:Envelope …
Run Code Online (Sandbox Code Playgroud)

javascript jquery soap enyo

8
推荐指数
1
解决办法
2万
查看次数

javascript和Web服务WSDL

我想使用javascript调用Web服务.我有一个表单,我给出一些参数(int),并希望得到结果如何使用javascript做到这一点?

这是WSDL文件

<definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://lapack.sws4hpsc.uth/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://lapack.sws4hpsc.uth/" name="DgesvSampleWsService">
<ns1:Policy xmlns:ns1="http://www.w3.org/ns/ws-policy" wsu:Id="DgesvSampleWsPortBinding_MTOM_Policy">
<ns1:ExactlyOne>
<ns1:All>
<ns2:OptimizedMimeSerialization xmlns:ns2="http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization" ns1:Optional="true"/>
</ns1:All>
</ns1:ExactlyOne>
</ns1:Policy>
<types>
<xsd:schema>
<xsd:import namespace="http://lapack.sws4hpsc.uth/" schemaLocation="http://83.212.96.238:8080/DgesvSampleWs/DgesvSampleWsService?xsd=1"/>
</xsd:schema>
</types>
<message name="_dgesv">
<part name="parameters" element="tns:_dgesv"/>
</message>
<message name="_dgesvResponse">
<part name="parameters" element="tns:_dgesvResponse"/>
</message>
<portType name="DgesvSampleWs">
<operation name="_dgesv">
<input message="tns:_dgesv"/>
<output message="tns:_dgesvResponse"/>
</operation>
</portType>
<binding name="DgesvSampleWsPortBinding" type="tns:DgesvSampleWs">
<ns3:PolicyReference xmlns:ns3="http://www.w3.org/ns/ws-policy" URI="#DgesvSampleWsPortBinding_MTOM_Policy"/>
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="_dgesv">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="DgesvSampleWsService">
<port name="DgesvSampleWsPort" binding="tns:DgesvSampleWsPortBinding">
<soap:address location="http://83.212.96.238:8080/DgesvSampleWs/DgesvSampleWsService"/> …
Run Code Online (Sandbox Code Playgroud)

javascript wsdl

8
推荐指数
2
解决办法
1万
查看次数

如何从浏览器发布SOAP请求?

是否可以直接从浏览器向服务提供商发送SOAP请求?然后在javascript中解析输出以显示结果?

举例来说,如果我有一个SOAP请求这样的:

POST /InStock HTTP/1.1
Host: www.example.org
Content-Type: application/soap+xml; charset=utf-8
Content-Length: nnn

<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Body xmlns:m="http://www.example.org/stock">
  <m:GetStockPrice>
    <m:StockName>IBM</m:StockName>
  </m:GetStockPrice>
</soap:Body>

</soap:Envelope>
Run Code Online (Sandbox Code Playgroud)

那么我可以通过点击网页上的链接获得"IBM股票价格"吗?并在xml处理后显示结果.

xml soap webclient

6
推荐指数
1
解决办法
2万
查看次数

如何在XMLHttpRequest asyn中设置多个标头数据

我的api调用要求我在标题中传递api键,但是我从api服务中收到错误 {"error":"2424452","message":"Invalid Api Key"}

我知道我的api密钥是有效的,因为我可以在Python中进行相同的api调用,例如:

req = requests.Session()
req.headers.update({'x-api-key': 'my-api-key', 'X-Product': 'my-product-name'})
req.get(url)
Run Code Online (Sandbox Code Playgroud)

但是在javscript中,同样的调用错误了.我相信我没有正确设置标题或什么?

var req = new XMLHttpRequest();
req.onreadystatechange=handleStateChange;
req.open("GET", "url", true);
req.setRequestHeader("Host", "api.domain.com", "x-api-key", "my-api-key", "X-Product", "my-product-name");
req.send();
Run Code Online (Sandbox Code Playgroud)

*此XMLHttpRequest不是浏览器调用,而是支持XMLHttpRequest的应用程序

javascript xmlhttprequest http-headers

6
推荐指数
2
解决办法
7083
查看次数

如何在React js中进行Soap调用?

我尝试了几种通过Reactjs进行Soap调用的方法。但是我总是在每种方法上都遇到一些错误。有人可以在这里帮助我,还是请给我提供一些小的工作示例,以便我参考?

我曾尝试使用npm soapeasysoap软件包,但无法成功。任何可行的例子都非常有用。我也尝试了以下方法,但是它也不起作用。

var xmlhttp = new XMLHttpRequest();
xmlhttp.open('GET', '{My soap endpoint}', true);

// build SOAP request
var sr =
    '<soap:Envelope xmlns:soap="{My soap request}"'

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);
Run Code Online (Sandbox Code Playgroud)

soap node.js reactjs

5
推荐指数
1
解决办法
9268
查看次数

如何使用HTML发送SOAP请求并接收响应?

我想向SOAP “服务器” 发送一个数字(我不知道是否可以称其为服务器,如果我输入错了,请更正我),并使用HTML接收响应,我看到了很多带有答案的问题包含发送XML请求的示例,例如以下示例,但是我不知道如何在HTML上接收和查看响应,抱歉,我是SOAP的新手。

PS:当然,对于HTML,我的意思是HTML内的JavaScript:P


服务器:在这里

提前致谢!

<html>

<head>
    <title>SOAP JavaScript Client Test</title>
    <script type="text/javascript">
        function soap() {
            var xmlhttp = new XMLHttpRequest();
            xmlhttp.open('POST', 'http://192.168.0.251:9080/wsa/wsa1', true);

            // build SOAP request
            var sr =
                '<?xml version="1.0" encoding="utf-8"?>' +
                '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:services-progress-com:notavailable">' +
                '<soapenv:Header/>' +
                '<soapenv:Body>' +
                '<urn:lnestagio>' +
                '<urn:vvalor>5</urn:vvalor>' +
                '</urn:lnestagio>' +
                '</soapenv:Body>' +
                '</soapenv:Envelope>';

            xmlhttp.onreadystatechange = function() {
                    if (xmlhttp.readyState == 4) {
                        if (xmlhttp.status == 200) {

                            alert('done use firebug to see …
Run Code Online (Sandbox Code Playgroud)

html javascript soap wsdl web-services

3
推荐指数
1
解决办法
2万
查看次数