如何使用jquery ajax调用wsdl

时间:2014-11-11 17:48:04

标签: javascript jquery ajax soap wsdl

我想从我的html代码(使用jquery ajax)调用一个方法,将一个以.wsdl作为扩展名的服务调用,该方法将以xml格式返回数据。

我的HTML代码是

我的wsdl网址是     HTTP://"本地主机":8080 / AdvanShelfWS /服务/ DBConnection的WSDL

当我在浏览器中粘贴此网址时,它显示为

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

我怎么称这个方法名为&#34; fnSelectAllResponse&#34; 什么是网址? 什么是肥皂要求?

目前我的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\"",

        });

0 个答案:

没有答案