wsdl接口xml
<definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://tempuri.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://tempuri.org/" name="PublicWebServiceInterface">
<types>
<xsd:schema>
<xsd:import namespace="http://tempuri.org/" schemaLocation="http://localhost:8899/yherp/PublicWebServiceInterface?xsd=1"/>
</xsd:schema>
</types>
<message name="getCount">
<part name="parameters" element="tns:getCount"/>
</message>
<message name="getCountResponse">
<part name="parameters" element="tns:getCountResponse"/>
</message>
<message name="login">
<part name="parameters" element="tns:login"/>
</message>
<message name="loginResponse">
<part name="parameters" element="tns:loginResponse"/>
</message>
<message name="getExceptionDetail">
<part name="parameters" element="tns:getExceptionDetail"/>
</message>
<message name="getExceptionDetailResponse">
<part name="parameters" element="tns:getExceptionDetailResponse"/>
</message>
<message name="iniParment">
<part name="parameters" element="tns:iniParment"/>
</message>
soapui工具分析出来的数据
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
<soapenv:Header/>
<soapenv:Body>
<tem:callWebMethod>
<!--Optional:-->
<arg0>{"methodName":259,"inParam":{"HH":"984328061159","HYH":"HB00144-A"}}</arg0>
</tem:callWebMethod>
</soapenv:Body>
</soapenv:Envelope>
js调用方法
var data;
data = '<?xml version="1.0" encoding="utf-8"?>';
data = data + '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">';
data = data + ' <soapenv:Body>';
data = data + ' <tem:callWebMethod>';
data = data + '<arg0>{"methodName":328,"inParam":{"RQ":"2022-12","LCID":"BM010102","BC":"","YGXM":"","CJID":""}}</arg0>';
data = data + ' </tem:callWebMethod>';
data = data + ' </soapenv:Body>';
data = data + '</soapenv:Envelope>';
alert(data);//SOAP请求报文格式
var request = new XMLHttpRequest();//第一步:创建需要的对象
request.onreadystatechange = function() {
if (request.readyState == 4){
var text = request.responseText;
alert('结果'+'\n'+text); //SOAP响应报文格式
document.getElementById("data").innerHTML = text;
}
};
//第二步:打开连接/***发送XML格式文件必须设置请求头 ;如下 - */
request.open('POST', "http://localhost:8899/yherp/PublicWebServiceInterface", true);
//SOAP 1.1为text/xml ; 1.2为 application/soap+xml,这里修改了content-Type,所以是非简单请求
request.setRequestHeader("Content-Type","text/xml;charset=utf-8");
request.send(data);
记录调用xml接口方式