使用SOAP调用调用WCF

dbo*_*nes 1 wcf soap

我想用SOAP调用WCF服务?

这是我的合同:

[ServiceContract(Namespace = "http://www.MySite.com/Services/TransferFile")]
public interface ITransferFile : ICloseableAndAbortable
{
    /// <summary>
    /// This will send the file which is associated with this rule to all the subscribers.
    /// </summary>
    /// <param name="ruleId"></param>
    [OperationContract]
    void ByRuleId(int ruleId);
}
Run Code Online (Sandbox Code Playgroud)

绑定目前设置为此,我需要更改它吗?

<endpoint address="" binding="wsHttpBinding" contract="FileTransfer.Wcf.ITransferFile">
Run Code Online (Sandbox Code Playgroud)

那我怎么用肥皂叫呢?例如使用(HttpWebRequest)WebRequest

提前谢谢了

dbo*_*nes 5

  1. 将Binding更改为basicHttpBinding

2消息

<?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>
    <ByRuleId xmlns="http://www.MySite.com/Services/TransferFile">
      <ruleId>3</ruleId>
    </ByRuleId>
  </soap:Body>
</soap:Envelope>
Run Code Online (Sandbox Code Playgroud)

3肥皂行动

POST /FileTransferService/TransferFile.svc HTTP/1.1
SOAPAction: "http://www.MySite.com/Services/TransferFile/ITransferFile/ByRuleId"
Run Code Online (Sandbox Code Playgroud)

我想要一个(HttpWebRequest)WebRequest,只是作为一种可行的方式,我最终使用了Web Reference和fiddler