87,910
社区成员
发帖
与我相关
我的任务
分享
<html>
<head>
<title>ExtJs测试</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<link rel="stylesheet" type="text/css" href="resources/css/ext-all.css" />
<script type="text/javascript" src="ext-all.js"></script>
<script type="text/javascript" src="adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-lang-zh_CN.js"></script>
<script language="javascript">
Ext.onReady(function(){
var soap = "";
soap += '<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:MyWebServiceIntf-IMyWebService">';
soap += '<soapenv:Header/>';
soap += '<soapenv:Body>';
soap += '<urn:echoTest soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">';
soap += ' <ms_true xsi:type="xsd:string">123456</ms_true>';
soap += '</urn:echoTest>';
soap += ' </soapenv:Body>';
soap += '</soapenv:Envelope>';
Ext.Ajax.request({
url:"http://localhost:8080/IMyWebService",
data: soap,
method:"post",
contentType: "text/xml;charset=UTF-8",
success:function(response,options){
Ext.Msg.alert('成功',response.responseText);
},
failure:function(){
Ext.Msg.alert('失败','与Webservice连接失败');
}
});
});
</script>
</head>
<body>
</body>
</html>
POST http://localhost:8080/soap/IMyWebService HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "urn:MyWebServiceIntf-IMyWebService#echoTest"
Content-Length: 468
Host: localhost:8080
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" name="IZCWebServiceservice" targetNamespace="http://tempuri.org/">
<message name="echoTest0Request">
<part name="ms_true" type="xs:string"/>
</message>
<message name="echoTest0Response">
<part name="return" type="xs:string"/>
</message>
<message name="login1Request">
<part name="ms_option" type="xs:string"/>
</message>
<message name="login1Response">
<part name="return" type="xs:string"/>
</message>
<message name="logout2Request">
<part name="ms_option" type="xs:string"/>
</message>
<message name="logout2Response">
<part name="return" type="xs:string"/>
</message>
<message name="querySQL3Request">
<part name="ms_option" type="xs:string"/>
</message>
<message name="querySQL3Response">
<part name="return" type="xs:string"/>
</message>
<message name="execSQL4Request">
<part name="ms_option" type="xs:string"/>
</message>
<message name="execSQL4Response">
<part name="return" type="xs:string"/>
</message>
<message name="getFileList5Request">
<part name="ms_rand" type="xs:string"/>
</message>
<message name="getFileList5Response">
<part name="return" type="xs:string"/>
</message>
<message name="getFile6Request">
<part name="ms_rand" type="xs:string"/>
<part name="ms_fileName" type="xs:string"/>
</message>
<message name="getFile6Response">
<part name="return" type="xs:base64Binary"/>
</message>
<portType name="IMyWebService">
<operation name="echoTest">
<input message="tns:echoTest0Request"/>
<output message="tns:echoTest0Response"/>
</operation>
<operation name="login">
<input message="tns:login1Request"/>
<output message="tns:login1Response"/>
</operation>
<operation name="logout">
<input message="tns:logout2Request"/>
<output message="tns:logout2Response"/>
</operation>
<operation name="querySQL">
<input message="tns:querySQL3Request"/>
<output message="tns:querySQL3Response"/>
</operation>
<operation name="execSQL">
<input message="tns:execSQL4Request"/>
<output message="tns:execSQL4Response"/>
</operation>
<operation name="getFileList">
<input message="tns:getFileList5Request"/>
<output message="tns:getFileList5Response"/>
</operation>
<operation name="getFile">
<input message="tns:getFile6Request"/>
<output message="tns:getFile6Response"/>
</operation>
</portType>
<binding name="IMyWebServicebinding" type="tns:IMyWebService">
<binding xmlns="http://schemas.xmlsoap.org/wsdl/soap/" style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="echoTest">
<operation xmlns="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="urn:MyWebServiceIntf-IMyWebService#echoTest" style="rpc"/>
<input>
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:MyWebServiceIntf-IMyWebService"/>
</input>
<output>
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:MyWebServiceIntf-IMyWebService"/>
</output>
</operation>
<operation name="login">
<operation xmlns="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="urn:MyWebServiceIntf-IMyWebService#login" style="rpc"/>
<input>
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:MyWebServiceIntf-IMyWebService"/>
</input>
<output>
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:MyWebServiceIntf-IMyWebService"/>
</output>
</operation>
<operation name="logout">
<operation xmlns="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="urn:MyWebServiceIntf-IMyWebService#logout" style="rpc"/>
<input>
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:MyWebServiceIntf-IMyWebService"/>
</input>
<output>
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:MyWebServiceIntf-IMyWebService"/>
</output>
</operation>
<operation name="querySQL">
<operation xmlns="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="urn:MyWebServiceIntf-IMyWebService#querySQL" style="rpc"/>
<input>
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:MyWebServiceIntf-IMyWebService"/>
</input>
<output>
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:MyWebServiceIntf-IMyWebService"/>
</output>
</operation>
<operation name="execSQL">
<operation xmlns="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="urn:MyWebServiceIntf-IMyWebService#execSQL" style="rpc"/>
<input>
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:MyWebServiceIntf-IMyWebService"/>
</input>
<output>
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:MyWebServiceIntf-IMyWebService"/>
</output>
</operation>
<operation name="getFileList">
<operation xmlns="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="urn:MyWebServiceIntf-IMyWebService#getFileList" style="rpc"/>
<input>
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:MyWebServiceIntf-IMyWebService"/>
</input>
<output>
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:MyWebServiceIntf-IMyWebService"/>
</output>
</operation>
<operation name="getFile">
<operation xmlns="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="urn:MyWebServiceIntf-IMyWebService#getFile" style="rpc"/>
<input>
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:MyWebServiceIntf-IMyWebService"/>
</input>
<output>
<mime:multipartRelated>
<part xmlns="http://schemas.xmlsoap.org/wsdl/mime/">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:MyWebServiceIntf-IMyWebService"/>
</part>
<part xmlns="http://schemas.xmlsoap.org/wsdl/mime/">
<content part="return" type="application/binary"/>
</part>
</mime:multipartRelated>
</output>
</operation>
</binding>
<service name="IMyWebServiceservice">
<port name="IMyWebServicePort" binding="tns:IMyWebServicebinding">
<address xmlns="http://schemas.xmlsoap.org/wsdl/soap/" location="http://localhost:8080/soap/IMyWebService"/>
</port>
</service>
</definitions>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>test</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script src="jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$().ready(function() {
var soap = '<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:MyWebServiceIntf-IMyWebService">';
soap += '<soapenv:Header/>';
soap += '<soapenv:Body>';
soap += '<urn:echoTest soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">';
soap += ' <ms_true xsi:type="xsd:string">?</ms_true>';
soap += '</urn:echoTest>';
soap += ' </soapenv:Body>';
soap += '</soapenv:Envelope>';
//soap = encodeURI(soap);
$.ajax({
url: "http://localhost:8080/soap/IMyWebService",
contentType: "text/xml;charset=UTF-8",
data: soap,
cache: false,
async: false,
headers: {"SOAPAction": "urn:MyWebServiceIntf-IMyWebService#echoTest"},
type: "post",
success: function(data, textStatus){
alert("成功");
},
error: function(XMLHttpRequest, textStatus, errorThrown){
alert('失败='+XMLHttpRequest.status+':'+XMLHttpRequest.readyState+':'+textStatus);
},
complete: function(XMLHttpRequest, textStatus) {
alert("完成="+XMLHttpRequest.status+':'+XMLHttpRequest.readyState+':'+textStatus);
}
});
});
</script>
</head>
<body>
</body>
</html>
失败$.ajax({
url: "http://localhost:8080/soap/IZCWebService",
contentType: "text/xml;charset=UTF-8",
data: soap,
cache: false,
async: false,
method: "post",
success: function(data, textStatus){
alert("成功");
},
error: function(XMLHttpRequest, textStatus, errorThrown){
alert('失败='+XMLHttpRequest.status+':'+XMLHttpRequest.readyState+':'+textStatus);
},
complete: function(XMLHttpRequest, textStatus) {
alert("完成="+XMLHttpRequest.status+':'+XMLHttpRequest.readyState+':'+textStatus);
}
});
我得到的error中的值是: 失败=0:0:error
..