需要实现一个小功能
1. 需要有一个button,按这个button就发送一个SOAP代码到我的server。SOAP XML 我自己有的。
2. 再有一个textbox把 SOAP返回的XML显示在这个textbox里面。
我实现了REQUEST部分但是response部分做不来。不过也可以用ajax写。
先行谢过哇
<html>
<head>
<title>SOAP Connection</title>
<script type="text/javascript">
function soap() {
var xmlhttp = new XMLHttpRequest();
xmlhttp.open('POST', 'https://xxxx.com:443/ws/xxxx', true);
// build SOAP request
var sr =
'<?xml version="1.0" encoding="utf-8"?>' +
'<soapenv:Envelope ' +
'xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" ' +
xxxxx +
'</soapenv:Body>' +
'</soapenv:Envelope>';
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
alert('done use firebug to see responce');
}
}
}
// Send the POST request
xmlhttp.setRequestHeader('Content-Type', 'text/xml');
xmlhttp.send(sr);
// send request
// ...CC
}
</script>
</head>
<body>
<form name="Demo" action="" method="post">
<div>
<input type="button" value="Soap" onclick="soap();" />
</div>
</form>
</body>
<html>