Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 9th, 2012  |  syntax: None  |  size: 1.96 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. MessageHeader Issue in WCF
  2. [MessageContract(WrapperName = "GetFooRequest", WrapperNamespace = "http://whatever.services.schema")]
  3. public class GetFooRequest
  4. {
  5.     [MessageHeader]
  6.     public int ResponseType { get; set; }
  7.  
  8.     [MessageBodyMember(Order = 1)]
  9.     public string FirstName { get; set; }
  10.  
  11.     [MessageBodyMember(Order = 1)]
  12.     public string LastName { get; set; }
  13. }
  14.  
  15. [MessageContract(WrapperName = "GetBarRequest", WrapperNamespace = "http://whatever.services.schema")]
  16. public class GetBarRequest
  17. {
  18.     [MessageHeader]
  19.     public int ResponseType { get; set; }
  20.  
  21.     [MessageBodyMember(Order = 1)]
  22.     public string FirstName { get; set; }
  23.  
  24.     [MessageBodyMember(Order = 1)]
  25.     public string LastName { get; set; }
  26. }
  27.        
  28. [MessageHeader]
  29. public string ResponseType { get; set; }
  30.        
  31. Error: Cannot obtain Metadata from http://localhost:42575/Services/Test/TestService.svc If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address.  For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error    URI: http://localhost:42575/Services/Test/TestService.svc    Metadata contains a reference that cannot be resolved: 'http://localhost:42575/Services/Test/TestService.svc'.    Content Type application/soap+xml; charset=utf-8 was not supported by service http://localhost:42575/Services/Test/TestService.svc.  The client and service bindings may be mismatched.    The remote server returned an error: (415) Unsupported Media Type.HTTP GET Error    URI: http://localhost:42575/Services/Test/TestService.svc    There was an error downloading 'http://localhost:42575/Services/Test/TestService.svc'.    The underlying connection was closed: The connection was closed unexpectedly.
  32.        
  33. [MessageHeader(Name = "TextResponseType")]
  34. public string ResponseType { get; set; }  - Name property resolve the issue