How to grab unknown SOAP header, convert to string, and pass to class library parser?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stroudg2
    New Member
    • Dec 2009
    • 4

    How to grab unknown SOAP header, convert to string, and pass to class library parser?

    Situation:

    I have been tasked to provide a non-intrusive solution to allow .NET web services to grab an incoming SOAP header and process the credentials stored within in such a way that a credential object is returned to the web method so they can access the appropriate role information to add to database query.

    In order to accomplish this, I created two class libraries, one that provides the "CredentialProf ile" object definition, and one that actually parses the SOAP header to build the "CredentialProf ile". These pieces function correctly when tested with a mock SOAP.xml file feed that simulates the incoming header.

    The problem I am running into now is that I am using the standard approach to get SOAP headers without having to define them in the web service by using "SOAPUnknownHea der" and decorating the web method. This seems to be working, I can get the SOAP header and do some light processing on it to convert it to a string that gets passed to my parser class library but as soon as the parser library method gets invoked I get the following exception returned to me in the SOAP response:

    System.IO.FileN otFoundExceptio n... could not find file C:\windows\syst em32\inetsrv\Sy stem.Web.Servic es.Protocols.SO APUnknownHeader

    This is being thrown from my parser class library right at the following line:

    public CredentialProfi le parseCredential s(string header)

    So my question is, why would my parser class library care about finding SOAPUnknownHead er when the web service itself is converting the SOAPUnknownHead er to a string and sending it to the parser class library? Am I missing something?
  • stroudg2
    New Member
    • Dec 2009
    • 4

    #2
    How to grab unknown SOAP header, convert to string, and pass to class library parser?

    Situation:

    I have been tasked to provide a non-intrusive solution to allow .NET web services to grab an incoming SOAP header and process the credentials stored within in such a way that a credential object is returned to the web method so they can access the appropriate role information to add to database query.

    In order to accomplish this, I created two class libraries, one that provides the "CredentialProf ile" object definition, and one that actually parses the SOAP header to build the "CredentialProf ile". These pieces function correctly when tested with a mock SOAP.xml file feed that simulates the incoming header.

    The problem I am running into now is that I am using the standard approach to get SOAP headers without having to define them in the web service by using "SOAPUnknownHea der" and decorating the web method. This seems to be working, I can get the SOAP header and do some light processing on it to convert it to a string that gets passed to my parser class library but as soon as the parser library method gets invoked I get the following exception returned to me in the SOAP response:

    System.IO.FileN otFoundExceptio n... could not find file C:\windows\syst em32\inetsrv\Sy stem.Web.Servic es.Pr otocols.SOAPUnk nownHeader

    This is being thrown from my parser class library right at the following line:

    public CredentialProfi le parseCredential s(string header)

    So my question is, why would my parser class library care about finding SOAPUnknownHead er when the web service itself is converting the SOAPUnknownHead er to a string and sending it to the parser class library? Am I missing something?

    Comment

    • tlhintoq
      Recognized Expert Specialist
      • Mar 2008
      • 3532

      #3
      Please don't double-post your questions. It divides attempts to help you in an organized and cohesive manner. Your threads have been merged
      ############### ############### ############### ############### ############### ############### ############### ####

      Comment

      • stroudg2
        New Member
        • Dec 2009
        • 4

        #4
        Sorry about that, I originally posted in .NET by mistake and re-posted in ASP.NET in hopes I could remove the original post from the .NET section. Thanks for the merge!

        Comment

        • stroudg2
          New Member
          • Dec 2009
          • 4

          #5
          Figured it out...

          No one replyed so I assume no one has run into this issue but through much experimentation , I figured it out. In the end, I just sent the raw SoapUnknownHead er straight to my parser class and utlized the ".Element" property set associated with SoapUnknownHead er to parse and get what I needed. The sample from the start of my parser class is as follows:

          public CredentialProfi le parseCredential s(SoapUnknownHe ader header)
          {
          credentialProfi le = new SAMLTokenParser ();
          credentialProfi le.setUid(getUI D(header.Elemen t));

          XmlNodeList samlAttributes = header.Element. GetElementsByTa gName(ATT_TAG);

          By specifying header.Element, you can get full access to the XML properties. Hopefully this will help some lost soul in the future.

          Comment

          Working...