Hi
You have to engaged the rampart module one way is to do it like this
ServiceClient serviceClient = stub._getServiceClient();
serviceClient.engageModule("rampart");
Where stubis the generated client stub from the WSDL
Then you can set your username and password like this
Options options = serviceClient.getOptions();
options.setUserName("testunser");
options.setPassword("pass");
serviceClient.setOptions(options);
Hope this helps quickstart[1] for rampart aslo can help you, and the samples
hope this helps
cheers. Håkon
[1] http://ws.apache.org/rampart/quick-start.html
2009/4/24 ericcho <[email protected]>
> Hi all,
>
> I have created a web service client using the axis 2 codegen wizard plugin
> for eclipse.
>
> The web service that is being consumed requires a time sensitive username
> token.
>
> I have looked at the rampart samples but I'm receiving the following
> exception when performing the call:
>
> 4/24/09 12:27:30:321 MDT] 00000061 SystemErr R
> org.apache.axis2.AxisFault: WSDoAllReceiver: Incoming message does not
> contain required Security header
> [4/24/09 12:27:30:321 MDT] 00000061 SystemErr R at
> org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(*
> Utils.java:512*)
> [4/24/09 12:27:30:321 MDT] 00000061 SystemErr R at
> org.apache.axis2.description.OutInAxisOperationClient.handleResponse(*
> OutInAxisOperation.java:370*)
> [4/24/09 12:27:30:321 MDT] 00000061 SystemErr R at
> org.apache.axis2.description.OutInAxisOperationClient.send(*
> OutInAxisOperation.java:416*)
> [4/24/09 12:27:30:321 MDT] 00000061 SystemErr R at
> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(*
> OutInAxisOperation.java:228*)
>
>
> I have the following in my axis2.xml
>
> <parameter name=*"OutflowSecurity"*>
> <action>
> <items>UsernameToken</items>
> <user>bob</user>
> <passwordCallbackClass>*ca*.*ab*.abc.def.handlers.PasswordHandler
> </passwordCallbackClass>
> <passwordType>PasswordText</passwordType>
> </action>
> </parameter>
>
>
> And the code that performs the request is as follows....
>
> 1 ConfigurationContext ctx = ConfigurationContextFactory.*
> createConfigurationContextFromFileSystem*(
> "C:\\workspaces\\abc\\myabcCommon\\");
>
> 2 UserProfileServiceStub.GetUserAccessAssignmentsByUserId userId =
> *new*UserProfileServiceStub.GetUserAccessAssignmentsByUserId();
> 3 userId.setUserId("aUserId");
>
> 4 UserProfileServiceStub stub = *new* UserProfileServiceStub(ctx);
>
> 5 GetUserAccessAssignmentsByUserIdResponse response =
> stub.getUserAccessAssignmentsByUserId(userId);
>
> 6 AccessAssignment[] *accessAssignments* = response.get_return();
>
>
> And the exception occurs at line 5 I've also verified through a packet
> sniffer that the request doesn't have the username token in the soap header
> and a debug point in the PasswordHandler is never hit.
>
> Note: Rampart 1.3 with Axis2 - 1.4.1
>
> Any help is appreciated.
>
> Thanks,
> Eric
>
>
>
>
>
>
>
>
>
> ------------------------------
> View this message in context: username token using codegen
> stub<http://www.nabble.com/username-token-using-codegen-stub-tp23223433p23223433.html>
> Sent from the Axis - User mailing list
> archive<http://www.nabble.com/Axis---User-f232.html>at Nabble.com.
>
--
Håkon Sagehaug, Scientific Programmer
Parallab, Bergen Center for Computational Science (BCCS)
UNIFOB AS (University of Bergen Research Company)