Soap客户端-SoapClient

    使用

    1. 使用SoapUI解析WSDL地址,找到WebService方法和参数。
    1. 按照SoapUI中的相应内容构建SOAP请求。
    1. 方法名为:
    2. 定义了一个命名空间,前缀为web,URI为http://WebXml.com.cn/
    1. SoapClient client = SoapClient.create("http://www.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx")
    2. // 设置要请求的方法,此接口方法前缀为web,传入对应的命名空间
    3. .setMethod("web:getCountryCityByIp", "http://WebXml.com.cn/")
    4. .setParam("theIpAddress", "218.21.240.106");
    5. // 发送请求,参数true表示返回一个格式化后的XML内容
    6. Console.log(client.send(true));