无法使用基于soap的wcf服务

无法使用基于soap的wcf服务,wcf,post,soap,Wcf,Post,Soap,我正在开发一个基于soap的wcf服务,它需要接受参数,然后做出相应的响应。当我试图通过测试客户端使用它时,出现以下错误: 值不能为空。参数名称:s interface: [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest, RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Json,

我正在开发一个基于soap的wcf服务,它需要接受参数,然后做出相应的响应。当我试图通过测试客户端使用它时,出现以下错误:

值不能为空。参数名称:s

interface:     

[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest, RequestFormat = WebMessageFormat.Xml, 
    ResponseFormat = WebMessageFormat.Json, UriTemplate = "/updateTimesheet?timesheetID={timesheetID}")]
[OperationContract]
string updateTimesheet(string timesheetID);
实现类:

public string updateTimesheet(string timesheet)
{
    XmlDocument doc = new XmlDocument();
    doc.LoadXml(timesheet);
    XmlNode xnodeTimeSheetHourID = doc.DocumentElement.SelectSingleNode("TimeSheetHourID");
    XmlNode xnodeHours = doc.DocumentElement.SelectSingleNode("TimeSheetHourID");
    return xnodeTimeSheetHourID.Value+" "+xnodeHours.Value;
}
web.config:

<service behaviorConfiguration="postServiceBehavior" name="postService">
<endpoint address="http://172.xx.xxx.xxx:xxxx/postService.svc/basic" binding="basicHttpBinding" bindingConfiguration="basicBinding" contract="IpostService">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />

请你帮我解决这个错误好吗?我很确定WebInvoke方法中存在一些问题,但我无法捕捉到它

谢谢


Pankaj

在web.config文件中,端点定义错误:

应该是这样的:

<service behaviorConfiguration="postServiceBehavior" name="namespace.postService">
<endpoint address="http://172.xx.xxx.xxx:xxxx/postService.svc/basic" binding="basicHttpBinding" bindingConfiguration="basicBinding" contract="namespace.IpostService">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />

分别检查service元素和endpoint元素中的name和contract属性


为了得到正确的名称空间,如果您可以发布接口类的完整框架,那么我可以给出名称空间的值

您的代码暗示您正在使用webHttpBinding,因此updateTimesheet操作将返回JSON格式的响应,而不是soap。请将system.serviceModel配置或WCF服务配置代码添加到您的答案中,好吗?您可以发布有关如何访问WCF的客户端代码吗Service@SixtoSaez请检查我的更新代码,我已经在这里添加了我的web.config代码。这就是你要问的吗?@Rajesh此刻我正在用wcf测试客户端测试它