• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Flash Builder 4.5 and SOAPHeader operation problem.

New Here ,
Nov 22, 2011 Nov 22, 2011

Copy link to clipboard

Copied

I have been working on this for the last couple days and I have not been able to come up with a solution.  Anyone out there have any suggestions.

I am trying to consume a Web service and it requires an Authentication Header.  I know the web services works by other means.  I would like to use the auto generated code, but it does not seem to want to add the authheader.

I have tried the following forum links to no avail.

http://forums.adobe.com/message/3069512

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/rpc/soap/Operation.html#addHea...

Here is the function I am calling.

public function headers():void {
var header1:SOAPHeader;
var obj:Object = new Object;
obj.Username = "XXX";
obj.Password = "YYY";
// Create QName and SOAPHeader objects.
var q1:QName=new QName("http://www.server.com/yadda/yadda", "AuthHeader");
header1=new SOAPHeader(q1, obj);

// Add the Authentication SOAP Header to all web service request.
operations["GetCommand"].addHeader(header1);
operations["SetCommand"].addHeader(header1);
}

When I debug this I can see that all the information is in it's correct place, however when I wireshark the actual communication I get the following.

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <SOAP-ENV:Header>

    <tns:AuthHeader xmlns:tns="http://www.server.com/yadda/yadda"/>

  </SOAP-ENV:Header>

  <SOAP-ENV:Body>

    <tns:GetCommand xmlns:tns="http://www.server.com/yadda/yadda">

      <tns:value1></tns:value1>

      <tns:value2></tns:value2>

    </tns:GetCommand>

  </SOAP-ENV:Body>

</SOAP-ENV:Envelope>

So I am getting the AuthHeader and the QName added, just not the username and password vaules.   Any ideas on what I am doing wrong?

-Stewart

Views

735

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 15, 2011 Dec 15, 2011

Copy link to clipboard

Copied

LATEST

I did get this to work.  If you do the following in the action script file that has the preinitialization fuction.  The header gets added properly.

This gets initalized on the load of the application.  I would really like to be able to set the username and password with a login box.  However, since this loads on launch I have not been able to get the values into the header.  Does anyone know how you can refresh this operation to reflect the changes in the values?  I know the values are getting set in my Login.as, but I can not find anything on how to reload the webservice to pick up the change in values. 

        import mx.rpc.soap.SOAPHeader;

        var header1:SOAPHeader;  

        var obj:Object = new Object;

        obj.Username = "XXX";  

        obj.Password = "YYY";

        // Create QName and SOAPHeader objects.

        var q1:QName=new QName("http://www.server.com/yadda/yadda", "AuthHeader");

        header1=new SOAPHeader(q1, obj);

        // Add the Authentication SOAP Header to all web service request.

        _serviceControl.addHeader(header1);

-Stewart

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines