Hi
The below source[1] is for secure axis2 service client implementation.
please refer [1] and This may help to resolve your issue

[1]
https://svn.wso2.org/repos/wso2/carbon/platform/branches/turing/platform-integration/test-automation-framework/4.2.6/org.wso2.carbon.automation.utils/src/main/java/org/wso2/carbon/automation/utils/axis2client/SecureAxisServiceClient.java

Thanks,
Nuwanw

On Wed, Sep 10, 2014 at 9:56 AM, Asok Perera <[email protected]> wrote:

> Hi,
>
> I have the same question and please check below how I tried to implement
> this.
>
> ------------------------------
>
>
> System.setProperty("javax.net.ssl.trustStore",
> "/Users/asok/Documents/wso2esb-4.8.1/repository/resources/security/client-truststore.jks"
> );
> System.setProperty("javax.net.ssl.trustStorePassword", "wso2carbon");
> options = new Options();
> try {
> options.setProperty(RampartMessageData.KEY_RAMPART_POLICY, loadPolicy(
> "chb_policy_1.xml"));
>     options.setUserName("admin");
>     options.setPassword("admin");
> } catch (Exception e1) {
> e1.printStackTrace();
>
> }
>
> -----------------------------
>
> Im getting following error, even though I have put the chb_policy_1.xml
> file.
> org.apache.axis2.AxisFault: *Unable to engage module : rampart*
> at org.apache.axis2.client.ServiceClient.engageModule(
> ServiceClient.java:363)
> at client_AXIOM.Client.<init>(Client.java:54)
> at client_AXIOM.Client.main(Client.java:120)
>
> org.apache.axis2.AxisFault: Address information does not exist in the
> Endpoint Reference (EPR).The system cannot infer the transport mechanism.
>
> Can anyone point out how to implement this as AXIOM client ?
>
> BR
>
>
> *Asok Aravinda Perera*
> Software Engineer
> WSO2, Inc.;http://wso2.com/
> <http://www.google.com/url?q=http%3A%2F%2Fwso2.com%2F&sa=D&sntz=1&usg=AFQjCNGJuLRux6KkJwXKVUCYOtEsNCmIAQ>
> lean.enterprise.middleware
>
> Mobile: +94722241032
>
> On Tue, Sep 9, 2014 at 8:46 PM, Vimalanathan Rajeevan <[email protected]>
> wrote:
>
>> Hi Lahiru,
>>
>> Can I know what kind of error you are getting when using AXIOM client and
>> passing credentials in the above way?
>>
>> Best Regards,
>> V.Rajeevan
>> Software Engineer,
>> WSO2 Inc. :http://wso2.com
>>
>> Mobile : +94 773090875
>> Email : [email protected]
>>
>> On Tue, Sep 9, 2014 at 5:45 PM, Lahiru Cooray <[email protected]> wrote:
>>
>>> Hi,
>>>
>>> I have created a non secured web service and secured it using ESB.
>>> When I invoke the service using an ADB client it worked properly.
>>> I used the below code to pass the credentials
>>>
>>>
>>>
>>> ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
>>> HttpTransportProperties.Authenticator authenticator = new
>>> HttpTransportProperties.Authenticator();
>>> authenticator.setUsername("admin");
>>> authenticator.setPassword("admin");
>>>
>>> stub._getServiceClient().getOptions()
>>> .setProperty(HTTPConstants.AUTHENTICATE, authenticator);
>>> stub
>>> ._getServiceClient()
>>> .getOptions()
>>> .setProperty(Constants.Configuration.ENABLE_REST,
>>> Constants.VALUE_TRUE);
>>>
>>>
>>> ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
>>>
>>> *And I'm facing a problem when I try to do the same using an AXIOM
>>> client. I need to know how to pass credentials when using an AXIOM client?*
>>>
>>>
>>> --
>>> *Lahiru Cooray*
>>> Software Engineer
>>> WSO2, Inc.;http://wso2.com/
>>> lean.enterprise.middleware
>>>
>>> Mobile: +94 715 654154
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> [email protected]
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Nuwan Wimalasekara
Senior Software Engineer - Test Automation
WSO2, Inc.: http://wso2.com
lean. enterprise. middleware

phone: +94 71 668 4620
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to