WCF服务不适用于邮政服务

时间:2016-08-02 06:48:00

标签: c# wcf

http://wishisdone.com/IphoneService.svc/echoWithPost 重点:S 价值:欢迎

错误下方:

service help page

  

用于构造对服务的有效请求。异常消息   是'传入消息具有意外的消息格式'原始'。该   该操作的预期消息格式是'Xml','Json'。这个可以   是因为尚未配置WebContentTypeMapper   捆绑。有关更多信息,请参阅WebContentTypeMapper的文档   细节。'。请参阅服务器日志以获取更多详异常堆栈跟踪   是:

2 个答案:

答案 0 :(得分:0)

参数shold是json格式 {" EmployeeId":" 601"}。使用firefox restclient检查错误。

答案 1 :(得分:0)

这样可行。

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

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

     Error:(13, 64) error: cannot find symbol class RegistrationInformation
     Error:(60, 15) error: cannot find symbol class RegistrationInformation
     Error:(37, 5) error: method does not override or implement a method from a supertype
    Error:(31, 5) error: method does not override or implement a method from a supertype
   Error:(43, 5) error: method does not override or implement a method from a supertype
   Error:(49, 5) error: method does not override or implement a method from a supertype
   Error:(52, 75) error: cannot find symbol variable mContext
   Error:(52, 27) error: cannot find symbol variable HelloLayoutsSEGControl
   Error:(53, 84) error: cannot find symbol variable mContext
   Error:(53, 35) error: cannot find symbol variable HelloLayoutsSEGControl
   Error:(55, 16) error: cannot find symbol variable isSW2
   Error:(59, 5) error: method does not override or implement a method from a supertype
   Error:(61, 20) error: cannot find symbol class       SampleRegistrationInformation
 :app:compileDebugJavaWithJavac FAILED
   Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
  > Compilation failed; see the compiler error output for details.

原因是字符串是原始数据类型,因此,即使HTTP请求POST,它也应作为查询字符串附加。