SOAP Headers with C#: how to support different XML fields in Request and Reply

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ken Newman
    New Member
    • May 2007
    • 5

    SOAP Headers with C#: how to support different XML fields in Request and Reply

    I have a SOAP Header that has different XML fields in the request and response.

    I instantiate one Header class for the Request and Response SOAP Header and using XmlIgnoreAttrib ute and bool fields to activate/de-activate the XML tags that are included or absent in each Instance.

    My problem is how to declare the SOAP Header in the Web Reference file to support unique classes for the inbound and outbound SOAP Headers. When the wsdl was consumed by Visual Studio, it just setup one Header that is declared:

    [System.Web.Serv ices.Protocols. SoapHeaderAttri bute("Header", Direction=Syste m.Web.Services. Protocols.SoapH eaderDirection. InOut)]

    This does not seem to work with a Header that has unique Header for the Request and Response, the Response comes back with the Header unchanged.

    Thanks
    Ken Newman
  • dorinbogdan
    Recognized Expert Contributor
    • Feb 2007
    • 839

    #2
    Hi,

    Did you find the answer to your question?
    If not, please let me know.
    If yes, feel free to share it.

    Thanks,
    Dorin.

    Comment

    • Ken Newman
      New Member
      • May 2007
      • 5

      #3
      Originally posted by dorinbogdan
      Hi,

      Did you find the answer to your question?
      If not, please let me know.
      If yes, feel free to share it.

      Thanks,
      Dorin.

      I think I have a better understanding of the issue and new question to pose:

      I need to serialize my SOAP Header with a specific namepsace prefix. the server I am talking to sends back the SOAP Header in the response with this namespace prefix and I belive that the de-serializer wont work if I have not specified my SOAP Header with the namespace and the prefix.

      Its odd that the server accepts my request as long as the namespace url is correct but will send back the soap header with the namespace and prefix. My program does not report an error for an unknown namespace prefix unless its a soap fault that returns, then I get an error that the namespace prefix is not recognized.

      Any ideas as to how to have my outbound and inbound soiap header to have a unqique namespace prefix ?

      thanks
      Ken Newman

      Comment

      Working...