我正在使用一个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;
}
}
} …Run Code Online (Sandbox Code Playgroud)