2016-08-02 54 views
-1

http://wishisdone.com/IphoneService.svc/echoWithPost 重点:S 值:欢迎WCF服务无法正常工作,邮政业

以下错误:

service help page

for constructing valid requests to the service. The exception message is 'The incoming message has an unexpected message format 'Raw'. The expected message formats for the operation are 'Xml', 'Json'. This can be because a WebContentTypeMapper has not been configured on the binding. See the documentation of WebContentTypeMapper for more details.'. See server logs for more details. The exception stack trace is:

+1

请首先使用授权,因为您的方法可公开访问。 –

+0

它是公开访问的授权。请使用邮递员访问此服务: http://wishisdone.com/IphoneService.svc/echoWithPost密钥:S值:欢迎 –

+0

[你有没有验证过这个链接](http://stackoverflow.com/questions/26123619/wcf -service-error-incoming-message-has-an-unexpected-message-format-raw-exp)与类似的问题 – Keppy

回答

0

参数应和JSON格式 { “雇员” :“601”}。使用firefox restclient检查错误。

+0

我使用restclient为此,但是正在抛出错误: 服务器遇到错误处理请求。请参阅服务帮助页面以构建对服务的有效请求。异常消息是'有一个错误检查System.String类型的对象的开始元素。遇到意想不到的人物'。'。查看服务器日志获取更多详细信 –

+0

你能让我确认什么是确切的错误。? –

+0

在restclient中,您必须添加标题content-type:application-json。本地主机上 –

0

这将工作。

HTTP POST:http://wishisdone.com/IphoneService.svc/echoWithPost?content=Hello

这回我状态200 OK。返回的XML是

<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/"> 
    Post: 
</string> 

的原因是字符串是基本数据类型,因此,即使在HTTP请求POST它应该被追加为查询字符串。

+0

爵士它显示公共字符串echoWithPost(字符串s) { 回报“后:”检查错误+ S ; } 但不是您输入查询字符串的消息。 –