我想使用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);
}
绑定当前设置为此,我需要更改吗?
<endpoint address="" binding="wsHttpBinding" contract="FileTransfer.Wcf.ITransferFile">
那我怎么用肥皂叫呢?例如使用(HttpWebRequest)WebRequest
非常感谢提前
答案 0 :(得分:5)
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>
3肥皂行动
POST /FileTransferService/TransferFile.svc HTTP/1.1
SOAPAction: "http://www.MySite.com/Services/TransferFile/ITransferFile/ByRuleId"
我想要一个(HttpWebRequest)WebRequest,只是作为一种可行的方式,我最终使用了Web Reference和fiddler
答案 1 :(得分:1)
您是否有理由选择WebRequest而不是使用svcutil.exe生成客户端代理来处理所有管道?
答案 2 :(得分:1)