0 Replies Latest reply on Dec 11, 2011 9:09 PM by nathanp812

    Why are my SOAP headers not being sent?




      I have a small flex 4.5 app set up that talks to a standard .NET asmx web service via SOAP.

      Everything works great, however I really want to be able to secure this service so I added soap header requirements.


      Being a noob to Flex I hunted around for examples on how to add soap headers to service operations.

      So in my Service class I have overridden a web service call and tried to add soap headers in the class that extends my base service class by doing the following.


      private var header1:SOAPHeader;


      public override function EmailAddresses():AsyncToken


           var obj:Object = new Object;

           obj.EList = null;

           // Create QName and SOAPHeader objects.

           var q1:QName=new QName("http://www.servername.com", "email");   // Email is the property name of the header in the asmx web service.

           header1=new SOAPHeader(q1, obj);


           // reference the base class abstract operation and add a header



           // make the call.  The header should be added.

           return super.EmailAddresses();



      But it does not work because it complains about null references. 

      I suspect that the addHeader() call is not available when I am trying to add the header to the operation.


      I looked at various forum posts here like http://forums.adobe.com/message/4040467#4040467 and http://forums.adobe.com/message/3069512#3069512 and tried to follow them too but nothing seems to work.


      I also tried bypassing the generated service proxies and just connecting directly to the web service, then defining header information once the service loaded, but that did not work either.

      The header is always null when it gets to the asmx web service (I view via breakpoint on my local machine).

      I know the web service is fine because everything works perfectly until I add the soapheader requirement to the webmethod signature.


      Could someone please point me in the right direction,

      Any help would be appreciated.