Hi
I have implemented a web service using JAX_RPC.
I need to extract out the username and password as these need to be
validated against an existing legacy system.
I have managed to get the username ( although this only works if
authentication is in use , which kind of defeats the purpose as I dont want
to use the authentication provided...)
My code is as follows ( simplified for readability)
public class MyServiceImpl implements MyServiceIF, ServiceLifecycle {
ServletEndpointContext endpointContext = null;
public String sendMessage( ) {
MessageContext msgContext = endpointContext.getMessageContext();
HttpServletRequest request =
(HttpServletRequest)msgContext.getPropertyMessageContextProperties.HTTP_SERVLET_REQUEST);
String username = request.getRemoteUser() ;
SOAPMessageContext smc = (SOAPMessageContext) msgContext;
BufferedOutputStream out = new BufferedOutputStream( new
FileOutputStream ("Test File"));
SOAPMessage msg = smc.getMessage();
msg.writeTo(out);
}
public void init(Object object) throws ServiceException{
endpointContext = (ServletEndpointContext)object;
}
On the client code I set
stub._setProperty(javax.xml.rpc.Stub.USERNAME_PROPERTY,"any user");
stub._setProperty(javax.xml.rpc.Stub.PASSWORD_PROPERTY,"any password");
Is there any way of accessing these properties set on the stub ?
I could ask the client to send the username and password as parameters in
the method call.
Although, I would prefer to keep the client code as close to the standards
as possible
Note that the TestFile that gets created has all information that Im sending
through except for the username + password.
I have also parsed msg trying to get the headers which are null
Any help would be appreciated ...
Thanks
_________________________________________________________________
Your kids can now chat online in a safe, controlled environment!
http://messenger.msn.co.za/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net