Updated on 2023-10-10 GMT+08:00

SoapClient

Path

com.roma.apic.livedata.client.v1.SoapClient

Description

This class is used to send SOAP requests.

Example

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": {
            "ser:name": "Spain"
        },
    };
    soap.setContent(content);

    var client = new SoapClient(soap);
    var result = client.execute();
    var body = result.getBody();

    return XmlUtils.toJson(body);
}

Constructor Details

public SoapClient(SoapConfig soapCfg)

Constructs a SOAP request that contains the SoapConfig information.

Parameter soapCfg indicates the SoapClient information.

Method List

Returned Type

Method and Description

APIConnectResponse

execute()

Send SOAP requests.