1 Reply Latest reply on Jun 26, 2010 5:37 AM by William Marchetto

    Using Soap Headers

    William Marchetto Level 1

      Hello everibody.

      I wrote a .Net C# web service, that's working fine.

      A method M of my web service can treat a Soap Header sent by a client.


      Here's the soap header's structure:

      class Marker

      { int Counter;

        string Remark;



      One client is a simple Flex application, FlexApp.


      It uses the tag

      <mx:WebService id="ws" wsdl="http://mySite/myWS.asmx?wsdl" useProxy="false"

      result="AnswerOK(event);" fault="AnswerNOK(event);" />


      Here's the AS code which calls the method M (when a button is pressed):


      var q1:QName=new QName("NamespaceWS","Marker");

      var header1:SOAPHeader = new SOAPHeader(q1, {Counter:"0",Remark:"FlexApp Client"});




      Then, the routine that treats the web service's answer:

      private function AnswerOK(event:ResultEvent):void


        var ac:ArrayCollection = (ArrayCollection)(event.result);

        dg.dataProvider = ac;


      where dg is a <mx:DataGrid> object.


      Everything goes right: dg gets filled with the correct data sent by myWS; the web service receives the soap header sent by FlexApp (another client, an ASPX page, shows it).


      But my job isn't completed.

      In fact the web service method M modifies the soap header, incrementing the Counter sent by the client and appending a suffix to Remark.

      In the case of the ASPX page, it works: the client shows the new values of Counter and Remark without any problem.


      But, in FlexApp case, I don't know HOW show the return values of the soap header's fields Counter and Remark.


      I tried to use myWS.M.getHeader into AnswerOK code:


      var q1:QName=new QName("WSVirgo","MarkerPlus");

      var hea:SOAPHeader = LibWS.BooksDnListByAuthor.getHeader(q1);


      but it shows the initial values of Counter and Remark, and not the different values returned by the web service !


      Can anyone help me, possibly with a code snippet ?

      Thanks in advance