Hi Sanjay,
Can you please post the services.xml you used ? Error message
says "Message Receiver not found for AxisOperation: echo". It is
thrown by the AxisEngine when the message receiver is null.
thanks,
/nandana
On Mon, Mar 3, 2008 at 10:05 PM, Sanjay Vivek
<[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I've a policy based service that returns the UsernameToken information
> of the authenticated user. However, I wish to obtain the UsenameToken
> information from a separate class as shown below:
>
> public class PolicyEchoService {
>
> public String echo() {
>
> AuthUser authuser = new AuthUser();
> String user = authuser.getAuth();
>
> return("The authenticated user was" + user);
>
> }
> }//end of PolicyEchoService
>
>
> Where AuthUser.java:
>
>
> public class AuthUser {
>
> public String getAuth() {
>
> //user variable
> String user=null;
>
>
> MessageContext msgCtx =
> MessageContext.getCurrentMessageContext();
> Vector results = null;
> if ((results = (Vector) msgCtx
> .getProperty(WSHandlerConstants.RECV_RESULTS)) == null)
> {
> System.out.println("No security results!!");
> throw new RuntimeException("No security results!!");
> } else {
> System.out.println("Number of results: " + results.size());
> for (int i = 0; i < results.size(); i++) {
> WSHandlerResult rResult = (WSHandlerResult)
> results.get(i);
> Vector wsSecEngineResults = rResult.getResults();
>
> for (int j = 0; j < wsSecEngineResults.size(); j++) {
> WSSecurityEngineResult wser =
> (WSSecurityEngineResult) wsSecEngineResults.get(j);
> if (wser.getAction() == WSConstants.UT
> && wser.getPrincipal() != null) {
>
> //Extract the principal
> WSUsernameTokenPrincipal principal =
> (WSUsernameTokenPrincipal)wser.getPrincipal();
>
> //Get user/pass
> user = principal.getName();
>
> }
> }
> }
>
> return user;
> }
>
> }
>
> }// end of AuthUser
>
>
> So basically my PolicyEchoService.aar is:
>
> +META-INF
> -services.xml
>
> +policy
> - PolicyEchoService.class
> - AuthUser.class
> - PWHandler.class
>
>
> However, when I try to call the service with my client, I get the
> exceptions shown below. What am I doing wrong? Can I invoke Rampart
> methods from a different class or is this not allowed? Any pointers will
> be very helpful. Cheers.
>
>
>
> Exception in thread "main" org.apache.axis2.AxisFault: Message Receiver
> not found for AxisOperation: echo
> at
> org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java
> :486)
> at
> org.apache.axis2.description.OutInAxisOperationClient.handleResponse(Out
> InAxisOperation.java:343)
> at
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOper
> ation.java:389)
> at
> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInA
> xisOperation.java:211)
> at
> org.apache.axis2.client.OperationClient.execute(OperationClient.java:163
> )
> at
> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:528
> )
> at
> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:508
> )
> at
> org.apache.rampart.altpolicy.CommandLineClient.main(CommandLineClient.ja
> va:66)
>
>
> Regards
> --------------
> Sanjay Vivek
> Web Analyst
> Middleware Team
> ISS
> University of Newcastle Upon Tyne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
http://nandana83.blogspot.com/
http://nandanasm.wordpress.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]