<script type="text/javascript">
function post() {
var xmlhttp=false;
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
{
try
{
xmlhttp = new XMLHttpRequest();
}
catch (e)
{
xmlhttp=false;
}
}
if (!xmlhttp && window.createRequest)
{
try
{
xmlhttp = window.createRequest();
}
catch (e)
{
xmlhttp=false;
}
}
var dest = "http://localhost:8080/cxf-ws/services/UserManager";
xmlhttp.open("POST", dest, true);
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState==4)
{ document.getElementById("result").innerHTML = xmlhttp.responseText;
}
};
xmlhttp.setRequestHeader("Man", "POST " + dest + " HTTP/1.1");
xmlhttp.setRequestHeader("MessageType", "CALL");
xmlhttp.setRequestHeader("Content-Type", "text/xml");
var soapmess = "<?xml version='1.0' encoding='UTF-8'?>" + '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema">' + "<SOAP-ENV:Body>" + "<Insert> <userId>2005221104210066</userId> <userName>Leon Cao</userName> <userEmail>caohongliang2@163.com</userEmail> <userAge>23</userAge> </Insert> " + "</SOAP-ENV:Body> </SOAP-ENV:Envelope>";
xmlhttp.send(soapmess);
}
</script>
用javascript发送web service信息
最新推荐文章于 2022-05-13 15:51:30 发布