我对WCF很新。我想向Web服务发送SOAP请求并从中接收响应。 WSDL是:http://content.domain.com/ContentService?wsdl。我已将此wsdl添加到ServiceReference中。下一步是什么?
我需要构建的SOAP请求应该看起来像 -
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"xmlns:con="http://content.domain.com" xmlns:api="http://api.content.domain.com">
<soapenv:Header />
<soapenv:Body>
<con:get1>
<con:in0>
<api:AID>89575</api:AID>
<api:clientLoginID>abc</api:clientLoginID>
<api:domain>en</api:domain>
</con:in0>
</con:get1>
</soapenv:Body>
</soapenv:Envelope>
对此请求将有一个xml响应,我需要解析并从中获取值。我怎样才能在c#中实现这个目标?
答案 0 :(得分:0)
阅读以下article
//Step 1: Create an instance of the WCF proxy.
CalculatorClient client = new CalculatorClient();
// Step 2: Call the service operations.
// Call the Add service operation.
double value1 = 100.00D;
double value2 = 15.99D;
double result = client.Add(value1, value2);