Axis2 SOAP信封头信息

5
我正在使用一个涉及IT技术的Web服务,该服务将身份验证令牌放置在SOAP信封头中。从WS WSDL提供的示例来看,如果在.NET中生成存根,则该头信息通过存根类中的成员变量公开。然而,当我使用WSDL2Java生成我的Axis2 Java存根时,它似乎没有任何公开的信息。
那么,从SOAP信封头中提取这些信息的正确方法是什么? WSDL:http://www.vbar.com/zangelo/SecurityService.wsdl C# 示例:

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; 
        }
    }
}

样例展示了我想要做的事情。请注意,secSvc 实例在成功调用 secSvc.SignIn() 后会有一个被填充的 SecurityHeaderValue 成员变量。
以下是关于 SignIn 方法的相关 API 文档: 虽然没有返回值,但成功登录将填充安全服务的 SecurityHeaderValue。然后,该 SecurityHeaderValue 信息用于其他 Web 服务调用。

你能给一个例子,发布WSDL,或者任何具体的东西吗? - skaffman
1个回答

2

我相信你要找的调用是:

MessageContext.getCurrentMessageContext().getEnvelope().getHeader()


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接