axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Håkon Sagehaug <Hakon.Sageh...@bccs.uib.no>
Subject Re: username token using codegen stub
Date Tue, 28 Apr 2009 07:00:20 GMT
Hi Eric,

How does your policy look like and are you sure that the security is added
to your soap header, could use tcpmon to look at the messages on the wire.

What I normally do for a simple secured ws is
1.Construct the wsdl and add some policy to a operation/porttype etc
2.Generate the code with axis2 wsdl2code
3.Add the policy to the services.xml usually in a operation element  and
engaging rampart as a module for the service.
4. make the client program, using the stub created. This client will then
also have the policy from the wsdl embedded in the generated code, you can
see this I you have access to the source code of the stub you are using. And
add username/password and explaned in a earlier mail.

I'm not an expert, but have made some mistakes and hopefully learned from
them.

Hope it helps

cheers, Håkon
2009/4/27 ericcho <eric@kryos.com>

>
> Thanks again Hakon....
>
> My code is as follows:
>
>
> String userid = "aUserId";
> ConfigurationContext ctx =
>
> ConfigurationContextFactory.createConfigurationContextFromFileSystem("C:\\dir1\\dir2\\dir3\\");
> UserProfileStub stub = new UserProfileStub (ctx );
> ServiceClient serviceClient = stub._getServiceClient();
> serviceClient.engageModule("rampart");
>
> Options options = serviceClient.getOptions();
> options.setUserName("myUserName");
> options.setPassword("myPassword");
>
> serviceClient.setOptions(options);
>
> AccessAssignment[] aa =
> stub.getUserAccessAssignmentsByUserId(userId).get_return();
>
>
> The following exception is thrown on the last line of code.   I'm guessing
> it is because the web service being consumed is time sensitive.  Are there
> any other options i should be setting for this?   Or something else I have
> to add to the axis2.xml?
>
> [4/27/09 14:49:00:515 MDT] 00000063 SystemErr     R
> org.apache.axis2.AxisFault: WSDoAllReceiver: Incoming message does not
> contain required Security header
> [4/27/09 14:49:00:515 MDT] 00000063 SystemErr     R     at
>
> org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:512)
> [4/27/09 14:49:00:515 MDT] 00000063 SystemErr     R     at
>
> org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:370)
> [4/27/09 14:49:00:515 MDT] 00000063 SystemErr     R     at
>
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:416)
> [4/27/09 14:49:00:515 MDT] 00000063 SystemErr     R     at
>
> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
> [4/27/09 14:49:00:515 MDT] 00000063 SystemErr     R     at
> org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
>
> Thanks,
> Eric
> --
> View this message in context:
> http://www.nabble.com/username-token-using-codegen-stub-tp23223433p23265276.html
> Sent from the Axis - User mailing list archive at Nabble.com.
>
>


-- 
Håkon Sagehaug, Scientific Programmer
Parallab, Bergen Center for Computational Science (BCCS)
UNIFOB AS (University of Bergen Research Company)

Mime
View raw message