2

I would like to add a namespace prefix to the XML root node and I found an entry by Scott Hanselman which details exactly what I would like to achieve. The only problem being the implementation is missing !

Modifying the namespace PREFIX of the root node of the body of a SOAP Web Services Response....whew!

It would be of great help if I could get a few leads on how to go about this.

  1. Is there an implementation that already exists somewhere ?

  2. The entry by Scott was posted in 2003. Have things changed since then ? With .NET 3.5 around, are Soap Extensions still the right approach ?

EDIT: Current Web Service Response is something like ...

<response>
   <my-ns:name/>
</response>

desired response should look like ...

<my-ns:response>
   <my-ns:name/>
</my-ns:response>
Preets
  • 6,792
  • 12
  • 37
  • 38
  • Please say what you're trying to accomplish. Why does the prefix matter? Also, I don't think SoapExtensions were necessary to begin with - see http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlnamespacedeclarationsattribute.aspx. – John Saunders Mar 24 '09 at 14:58
  • @John, The prefix does not and should not matter, but it is a "client" requirement which one has to meet. If you read the Scott's entry, that is precisely what he mentions. – Preets Mar 24 '09 at 16:27
  • 1
    Scott does say: > If you want the code, and to go to > hell, email me [Here](http://2idi.com/contact/=scott.hanselman), that's probably the best route if no-one has any ideas. – Tristan Warner-Smith Mar 24 '09 at 13:33

1 Answers1

1

Seems like the issue with the missing namespace prefix for the root node exists only on .NET Framework 1.1 !

I migrated the code to .NET 3.5 and the "my-ns:" namespace prefix was added to the root node without me having to modify any code ! So I wouldn't have to write a Soap Extension after all !

Preets
  • 6,792
  • 12
  • 37
  • 38