1

I have a WCF Service that has a method GetEmployees(). I need to display the resulting message in XML format in a ASP.NET website using Response.Write method. What is the easiest way for doing it?

Note: We need to display the complete message; not only the data content

informatik01
  • 16,038
  • 10
  • 74
  • 104
LCJ
  • 22,196
  • 67
  • 260
  • 418
  • If GetEmployees() returning List then create one function to generate XML from List by using XMLSerializarion. Visit http://msdn.microsoft.com/en-us/library/ms950721.aspx – Jignesh Thakker Sep 13 '12 at 10:41
  • http://stackoverflow.com/questions/2587952/is-there-a-way-to-get-the-raw-soap-request-from-within-a-asp-net-webmethod and http://stackoverflow.com/questions/4329825/using-linq-to-xml-to-parse-a-soap-message – LCJ Sep 13 '12 at 11:00

2 Answers2

1

write own behaviour, you can get soap message before deserialization

implement interfaces IClientMessageInspector, IDispatchMessageInspector in class attribute, and use it

msdn

burning_LEGION
  • 13,246
  • 8
  • 40
  • 52
  • I used WCF Test Client. Referred the svc url obtained while browsing the svc (http://localhost:1791/CalculationService.svc) Used Invoke operation in the tool. That gave me the SOAP Envelope. Do you see any shortcoming with this approach? – LCJ Sep 14 '12 at 05:14
  • this way suitable for client part only, and you can get this soap message after wcf behaviuor only, WCF Test Client have not behaviour and it's client part therefore you get same data – burning_LEGION Sep 14 '12 at 11:49
0

I used WCF Test Client. Referred the svc url obtained while browsing the svc (http://localhost:1791/CalculationService.svc). Used Invoke operation in the tool. See the XML tab That gave me the SOAP Envelope.

Do you see any shortcoming with this approach? [Of course I cannot use it in asp.net. But it will meet my current need]

WcfTestClient: Type the “WcfTestClient” command in “Visual Studio Command Prompt”. http://blogs.msdn.com/b/wcftoolsteamblog/archive/2010/01/04/tips-for-launching-wcf-test-client.aspx

LCJ
  • 22,196
  • 67
  • 260
  • 418