您好我正在开发使用WCF的XML Soap服务。我的要求是更新一些数据库表。我有一个方法来更新数据库中的值。以下是我的服务。如何使用POSTMAN测试wcf soap服务?
[ServiceContract]
public interface IOpportunity
{
[OperationContract]
[WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Xml, UriTemplate = "postmethod/updateOpportunity")]
bool updateOpportunity(opportunityActivity obj);
}
[DataContract]
public class opportunityActivity
{
[DataMember]
public string opportunityID { get; set; }
[DataMember]
public string opportunityStatus { get; set; }
[DataMember]
public string opportunityserviceType { get; set; }
}
下面是我的XML。
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:s="http://localhost:39512/Opportunity.svc">
<soapenv:Header/>
<soapenv:Body>
<s:request>
<opportunityID>1-1D5SJX</opportunityID>
<opportunityStatus>Completed</opportunityStatus>
<opportunityserviceType>LEASE_REQUEST</opportunityserviceType>
</s:request>
</soapenv:Body>
</soapenv:Envelope>
当我我尝试如上图所示,我得到400错误的请求error.May我知道我是以下正确的方法来测试服务?如果我做错了,有人能纠正我吗?任何帮助将不胜感激。谢谢。
这是不正确的 - 你不能手动构建soap请求。用一些工具为你做 –