使用Alamofire 4和Swift在SOAP请求中发送参数

时间:2019-07-11 06:32:42

标签: ios swift xcode soap alamofire

我是Swift和Alamofire的新手,必须使用SOAP。我当前正在使用名为alamofiresoap的肥皂的alamofire扩展来发送请求,但无法在soap请求中发送参数。我想问问是否有人知道如何向soap请求发送参数?下面是功能

    func Sendrequest() {
     AlamofireSoap.soapRequest("http://www.dneonline.com/calculator.asmx", soapmethod: "Add", soapparameters: ["intA" : "1", "intB" : "2" ], namespace: "http://tempuri.org").responseString { response in
            print("Request: \(String(describing: response.request))")   // original url request
            print("Response: \(String(describing: response.response))") // http url response
            print("Result: \(response.value)")
    }
  }
}

这是未检测到参数的输出

<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><soap:Body><AddResponse xmlns=\"http://tempuri.org/\"><AddResult>0</AddResult></AddResponse></soap:Body></soap:Envelope>"

0 个答案:

没有答案