Javascript 如何使用jquery ajax调用wsdl
我想从我的html代码(使用jQueryAjax)调用一个方法到一个扩展名为.wsdl的服务,该服务将返回xml格式的数据 我的html代码是 我的wsdl url是 http://“localhost”:8080/AdvanShelfWS/services/DBConnection?wsdl 当我在浏览器中粘贴此url时,它显示为Javascript 如何使用jquery ajax调用wsdl,javascript,jquery,ajax,soap,wsdl,Javascript,Jquery,Ajax,Soap,Wsdl,我想从我的html代码(使用jQueryAjax)调用一个方法到一个扩展名为.wsdl的服务,该服务将返回xml格式的数据 我的html代码是 我的wsdl url是 http://“localhost”:8080/AdvanShelfWS/services/DBConnection?wsdl 当我在浏览器中粘贴此url时,它显示为 <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:n
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://WebService" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org /2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org /wsdl/soap12/" targetNamespace="http://WebService">
<wsdl:documentation>Please Type your service description here</wsdl:documentation>
<wsdl:types>
<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://WebService">
<xs:element name="fnSelectAll">
<xs:complexType>
<xs:sequence/>
</xs:complexType>
</xs:element>
<xs:element name="fnSelectAllResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
请在此处键入您的服务说明
我如何调用名为“fnSelectAllResponse”的方法
网址是什么?
什么是soap请求
目前我的html代码如下
var wsUrl = "http://"localhost":8080/WS/services/DBConnection.DBConnectionHttpSoap11Endpoint/"
var soapRequest =
'<?xml version="1.0" encoding="utf-8"?> \
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" \
xmlns:xsd="http://www.w3.org/2001/XMLSchema" \
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> \
<soap:Body> \
<fnSelectAll xmlns="http://localhost:8080/WS/services/DBConnection?wsdl"> \
</fnSelectAll> \
</soap:Body> \
</soap:Envelope>';
$.ajax({
type: "POST",
url: wsUrl,
contentType: "text/xml",
dataType: "xml",
data: soapRequest,
success: function(msg){
alert("bingo");
},
error: function(msg){
alert("error");
},
contentType: "text/xml; charset=\"utf-8\"",
});
var wsUrl=“http://“localhost”:8080/WS/services/DBConnection.DBConnectionHttpSoap11Endpoint/”
var soapRequest=
' \
\
\
\
\
\
';
$.ajax({
类型:“POST”,
url:wsUrl,
contentType:“text/xml”,
数据类型:“xml”,
数据:soapRequest,
成功:功能(msg){
警惕(“宾果”);
},
错误:函数(msg){
警报(“错误”);
},
contentType:“text/xml;字符集=\“utf-8\”,
});
我建议安装soapUI并对您的Web服务运行一些执行。然后,您将看到驱动它所需的HTTP流量。从那里,您可以在Ajax请求中克隆它。@Kolban:当我在firebug中检查这段代码时,它告诉了我一些关于CORS的信息。啊,这是一条重要的线索。您现在需要研究通过Ajax调用web站点的安全性,而不是页面本身从中加载的Ajax。您的问题与Web服务无关,而是Ajax与国外位置的关系。哦,好的,谢谢,我已经阅读了有关处理CORS的代理的内容。你能给我发一个可行的代码或链接,我可以在没有ajax的情况下调用基于soap的服务吗?我建议用谷歌搜索“cors ajax jquery”,然后尽可能地学习/阅读。如果在阅读后,你对这一领域有具体和集中的问题,请将其作为新问题发布。