Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 325891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:15:32+00:00 2026-05-12T09:15:32+00:00

I have a flex client connecting to a web service that needs an authentication

  • 0

I have a flex client connecting to a web service that needs an authentication token added as a header, named “Identity”. An example of the expected message is:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
    <Identity xmlns="ns">2188dcbe-0325-4c1e-9a77-19110e0ea99f</Identity>
    <To s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">https://localhost:8001/MyService</To>
    <Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">ns/MyService/MyOperation</Action>
  </s:Header>
  <s:Body>
    ...
  </s:Body>
</s:Envelope>

How do I add this kind of header in flex? I’ve tried using both .addHeader() and .addSimpleHeader, but both of these seem to add sub-elements to the header element like:

<Identity xmlns="ns">
  <Value>34234234-234-234-23-234324</Value>
</Identity>

I know this should be possible, since flex is doing this for the “To” and “Action” headers. The documentation for addHeader seems to suggest you can give it raw XML but I haven’t been able to make it work.

Thanks in advance for any pointers!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T09:15:32+00:00Added an answer on May 12, 2026 at 9:15 am

    There’s a couple of ways of doing it. I personally prefer overriding the native SOAPEncoder class which given you access to the actual soap envelope before it is sent. This enables you to have more control and add things like ws-addressing and custom authenication headers.

    public class myEncoder 
    extends SOAPEncoder
    {
    
    private const WSSE_NS:Namespace = new Namespace("wsse", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wsswssecurity-secext-1.0.xsd");
    
        //--------------------------------------------------------------------------
        //
        // Constructor
        // 
        //--------------------------------------------------------------------------
        public function wsseEncoder()
        {
            super();
        }
    
        //--------------------------------------------------------------------------
        //
        // Methods
        // 
        //--------------------------------------------------------------------------
    
        /**
         * <p>  override super classes method and recieve raw soap message to manpulate soap envelope
         * </p>
         */
        public override function encodeRequest(args:* = null, headers:Array = null):XML
        {
            //get soap envelope from super class
            var SOAPEnvelope:XML = super.encodeRequest(args, headers);
    
                   //create a header in xml and append it at as a child
            securityHeaderXml = <Security/>;
            securityHeaderXml.setNamespace(WSSE_NS);
            securityHeaderXml.@[mustUnderstand] = 1;
    
            //set deafult ws-security namespace - filters to all child nodes
            securityHeaderXml.setNamespace(WSSE_NS);
    
                var id:XML = <Identity/>;
                id.appendChild('value here');
                SOAPEnvelope.prependChild(id);
    
                SOAPEnvelope.prependChild(headerXml);
    
            return SOAPEnvelope;
        }
    
    
        }
    }
    

    Then all you need to do is change the default encoder to this one, if your using generate web service classes go to the serviceBase and look for the method ‘Call’ and change this line to this

    var enc:SOAPEncoder = new myEncoder(); //instead of this -> new SOAPEncoder();

    if not iots something like myService.encoder = new myEncoder();

    As simple as that.

    Obviously override the encoder class gives you alot more control. You can also do the same with the SOAPDecoder class to catch the soap envelope before it get de-serialised.

    Hope this helps

    Jon

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 209k
  • Answers 209k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I think if you press ALT, SHIFT and F10 in… May 12, 2026 at 9:44 pm
  • Editorial Team
    Editorial Team added an answer See http://rusanu.com/2006/06/17/the-mysterious-notification/ for an explanation how SqlDependency works under the… May 12, 2026 at 9:44 pm
  • Editorial Team
    Editorial Team added an answer There will most likely be a difference, but it's not… May 12, 2026 at 9:44 pm

Related Questions

I have a Java server application and a Flex client application. For my data
I have a WCF service operation that accepts a data contract parameter of custom
I have a project where the client can save data from a flex app
I have a flex application that needs the ability to generate and execute JavaScript.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.