Axis2 SOAP Envelope Header Information

Posted by BigZig on Stack Overflow See other posts from Stack Overflow or by BigZig
Published on 2009-08-24T21:46:24Z Indexed on 2011/01/15 11:53 UTC
Read the original article Hit count: 216

Filed under:
|
|
|

I'm consuming a web service that places an authentication token in the SOAP envelope header. It appears (through looking at the samples that came with the WS WSDL) that if the stub is generated in .NET, this header information is exposed through a member variable in the stub class. However, when I generate my Axis2 java stub using WSDL2Java it doesn't appear to be exposed anywhere.

What is the correct way to extract this information from the SOAP envelope header?

WSDL: http://www.vbar.com/zangelo/SecurityService.wsdl

C# Sample:


using System;
using SignInSample.Security;           // web service 
using SignInSample.Document;           // web service

namespace SignInSample
{
    class SignInSampleClass
    {
        [STAThread]
        static void Main(string[] args)
        {
            // login to the Vault and set up the document service
            SecurityService secSvc = new SecurityService();
            secSvc.Url = "http://localhost/AutodeskDM/Services/SecurityService.asmx";
            secSvc.SecurityHeaderValue = new SignInSample.Security.SecurityHeader();

            secSvc.SignIn("Administrator", "", "Vault");

            DocumentServiceWse docSvc = new DocumentServiceWse();
            docSvc.Url = "http://localhost/AutodeskDM/Services/DocumentService.asmx";
            docSvc.SecurityHeaderValue = new SignInSample.Document.SecurityHeader();
            docSvc.SecurityHeaderValue.Ticket = secSvc.SecurityHeaderValue.Ticket;
            docSvc.SecurityHeaderValue.UserId = secSvc.SecurityHeaderValue.UserId; 
        }
    }
}

The sample illustrates what I'd like to do. Notice how the secSvc instance has a SecurityHeaderValue member variable that is populated after a successful secSvc.SignIn() invocation.

Here's some relevant API documentation regarding the SignIn method:

Although there is no return value, a successful sign in will populate the SecurityHeaderValue of the security service. The SecurityHeaderValue information is then used for other web service calls.

© Stack Overflow or respective owner

Related posts about java

Related posts about soap