Hi,

I know I can not set Message Context directly on the client side.
My issue is: 

I wrote on the client side:
/**
         * Proxy setting in runtime
         */
        HttpTransportProperties.ProxyProperties proxyproperties = new
HttpTransportProperties().new ProxyProperties();
        proxyproperties.setProxyName("localhost");
        proxyproperties.setProxyPort(8080);
        proxyproperties.setPassWord("user1");
        proxyproperties.setUserName("user1");

        Options options = new Options();
        options.setProperty(HTTPConstants.PROXY, proxyproperties);
        options.setTo(targetEPR);
        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
        ServiceClient sender = new ServiceClient();
        sender.setOptions(options);

        OMElement result = sender.sendReceive(payload);

And I wrote handler on service side:

public class AcegiBridgeAuthenticationHandler extends AbstractHandler {

public void invoke(MessageContext msgContext) throws AxisFault {
        
           Options options = msgContext.getOptions();
        HttpTransportProperties.ProxyProperties proxyproperties = 
 
(HttpTransportProperties.ProxyProperties)msgContext.getProperty(HTTPCons
tants.PROXY);
        HttpTransportProperties.ProxyProperties proxyproperties = 
 
(HttpTransportProperties.ProxyProperties)propertyMap.get(HTTPConstants.P
ROXY);
        String user = proxyproperties.getUserName();
        String pass = proxyproperties.getPassWord();


 
But I get error in two last lines: my user name and password is null

What is wrong?
I try to download nightly build, but resource is not available today. 


Best regards,Natalya Smirnova.
MERA NN /EMA/custom software


-----Original Message-----
From: Eran Chinthaka [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 24, 2006 8:31 AM
To: axis-user@ws.apache.org
Subject: Re: [Axis2]MessageContext

Options you set to message context in the client side will not be
available to you in the server side. But if you can get hold to some of
the HTTP transport properties, by retrieving them from the options.

If you wanna send some props from client side, you might wanna consider
putting them as headers in the request SOAP message.

-- Chinthaka

Smirnova, Natalya wrote:
> Hi, 
> Thank you for your advance. 
> But my MessageContext in my handler is still empty :-(. 
> I simple add some property to Options object on client side, set this
> option to sender and send.
> MessageContext does not contain my property. 
> 
> 
> Best regards,Natalya Smirnova.
> MERA NN /EMA/custom software
> 
> 
> -----Original Message-----
> From: robert lazarski [mailto:[EMAIL PROTECTED] 
> Sent: Saturday, October 21, 2006 12:21 AM
> To: axis-user@ws.apache.org
> Subject: Re: [Axis2]MessageContext
> 
> First of all, try a nightly as the new release is almost ready, as
> there were problems here since fixed:
> 
> http://people.apache.org/dist/axis2/nightly/axis2-1.1-SNAPSHOT.war
> http://people.apache.org/dist/axis2/nightly/axis2-1.1-SNAPSHOT.zip
> 
> Looks like the current way the client sends out basic auth info is the
> following - change to match your env:
> 
> OMElement payload = TestingUtils.createDummyOMElement();
>         /**
>          * Proxy setting in runtime
>          */
>         HttpTransportProperties.ProxyProperties proxyproperties = new
> HttpTransportProperties.ProxyProperties();
>         proxyproperties.setProxyName("localhost");
>         proxyproperties.setProxyPort(5555);
>         proxyproperties.setDomain("anonymous");
>         proxyproperties.setPassWord("anonymous");
>         proxyproperties.setUserName("anonymous");
> 
>         Options options = new Options();
>         options.setProperty(HTTPConstants.PROXY, proxyproperties);
>         options.setTo(targetEPR);
>         options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
>         ServiceClient sender = new ServiceClient();
>         sender.setOptions(options);
> 
>         OMElement result = sender.sendReceive(payload);
> 
> Since these params are probably in the http headers, you'll probably
> need a handler to access them. The following code example is from axis
> 1.x but is close enough to start with -
> HTTPConstants.HEADER_AUTHORIZATION is still there, for example:
> 
>
http://koders.com/java/fidDCB769581B5FB55A16B0B191DEB229F79B8CB9E2.aspx
> 
> See the migration guide for getting the above handler to work in
axis2:
> 
>
http://svn.apache.org/repos/asf/webservices/axis2/trunk/java/xdocs/1_1/m
> igration.html
> 
> HTH,
> Robert
> 
> On 10/20/06, Smirnova, Natalya <[EMAIL PROTECTED]> wrote:
>>
>>
>>
>> Hi,
>>
>>
>>
>> How I can get user name and password from MessageContext class
object?
>>
>> I use Axis2 release 1.0.  I write custom module and handler. It work
>> correctly.
>>
>> On client side I set username and password into options properties
and
> send.
>>
>>
>> Options options = new Options();
>>
>> options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
>>
>>
>>
>>             HttpTransportProperties.ProxyProperties
>> basicAuthentication = new HttpTransportProperties().new
> ProxyProperties();
>>             basicAuthentication.setUserName("admin");
>>
>>             basicAuthentication.setPassWord("axis2");
>>
>>
>>
>
options.setProperty(org.apache.axis2.transport.http.HTTPConstants.PROXY,
>> basicAuthentication);
>>
>>             options.setTo(targetEPR);
>>
>>
>>
>>             ServiceClient serviceClient = new ServiceClient();
>>
>>             serviceClient.setOptions(options);
>>
>>
>>
>>
>>
>>
>>
>> But on service side in handler my message context is empty.
>>
>>
>>
>> Thank you
>>
>>
>>
>>
>>
>> Best regards,Natalya Smirnova.
>>
>> MERA NN /EMA/custom software
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to