更新时间:2026-04-29 GMT+08:00
SoapClient类说明
路径
com.roma.apic.livedata.client.v1.SoapClient
说明
使用此类进行SOAP请求。
使用示例
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ser="http://spring.io/guides/gs-producing-web-service">
<soapenv:Header/>
<soapenv:Body>
<ser:getCountryRequest>
<ser:name>Spain</ser:name>
</ser:getCountryRequest>
</soapenv:Body>
</soapenv:Envelope> 以上面的SOAP请求体为例,对应的代码实现如下:
importClass(com.roma.apic.livedata.client.v1.SoapClient);
importClass(com.roma.apic.livedata.config.v1.SoapConfig);
importClass(com.roma.apic.livedata.common.v1.XmlUtils);
function execute(data) {
var soap = new SoapConfig();
soap.setUrl("http://test.webservice.com/ws");
soap.setNamespace("http://spring.io/guides/gs-producing-web-service");
soap.setOperation("getCountryRequest");
soap.setNamespacePrefix("ser");
soap.setBodyPrefix("ser");
soap.setEnvelopePrefix("soapenv");
var content = {
"getCountryRequest": {
"name": "Spain"
},
};
soap.setContent(content);
var client = new SoapClient(soap);
var result = client.execute();
var body = result.getBody();
return XmlUtils.toJson(body);
} 构造器详情
public SoapClient(SoapConfig soapCfg)
构造一个包含SoapConfig配置信息的SOAP请求。
参数:soapCfg表示传入SoapClient的配置信息。
方法列表
| 返回类型 | 方法和说明 |
|---|---|
| APIConnectResponse | execute() 用于发送SOAP请求 |
父主题: 自定义后端开发(函数后端)