我正在尝试使用Ballerina和http:ClientConnector调用SOAP WS,我如何才能将主体和参数传递给POST方法?
发布于 2017-10-06 11:57:12
请参阅sample code of soapConnector.bal (0.93版)
您需要构造一个请求XML负载,如下所示
xml soapRequest = xmls:parse("<soapenv:Envelope xmlns:soapenv=\"" + namespace + "\"></soapenv:Envelope>");并设置有效负载和标头,以便调用端点
message backendServiceReq ={};
string reqType = "application/soap+xml";
string soapDefinition;
soapDefinition, _ = (string) namespaceMap["1.2"];
messages:setXmlPayload(backendServiceReq, soapRequest);
messages:setHeader(backendServiceReq, "Content-Type", reqType);
if (soapAction != "null") {
messages:setHeader(backendServiceReq, "SOAPAction", soapAction);
}
message response = httpConnector.post(url, backendServiceReq);https://stackoverflow.com/questions/46572314
复制相似问题