axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Runo.Barrd...@tieto.com>
Subject RE: FW: No user value in rampart configuration policy
Date Sun, 27 May 2012 17:24:09 GMT
Dear Hasini:

Thankyou for your kind and quick response.
I have tried, sofar without full success, to follow the instructions provided in the reference
indicated below.

Please find enclosed my Client implementation.
In particular, note that I actually DO set user name in the serviceClient's options (opterions.setProperty(...).

I did, following instructions for client in the reference indicated, starting at section 6,
I entered the following section of code:
"

                     RampartConfig rampartConfig = new RampartConfig();
                     rampartConfig.setUser("marginalen");
                     rampartConfig.setPwCbClass("com.tieto.ws.axis2.callback.UsernameTokenCallbackManager");
// 2012-05-27, RunoB              options.setProperty(RampartConfig.RAMPART_CONFIG_LN, rampartConfig);

                     Policy policy = new Policy();
                     policy.addAssertion(rampartConfig);

//                   Policy rampartConfig = getRampartConfig();

                     serviceClient.getAxisService().getPolicyInclude().addPolicyElement(PolicyInclude.AXIS_SERVICE_POLICY,
policy);
//                   serviceClient.getAxisService().applyPolicy(policy);

"
The Statement "serviceClient.getAxisService().getPolicyInclude().addPolicyElement(PolicyInclude.AXIS_SERVICE_POLICY,
policy);
" contains deprecated methods - should it really be used?
As regards the method "getRampartConfig()", I have no access to its contents.

That did in fact remove the AxisFault "No user value in rampart configuration policy, but
on the other hand, it renedered 4 usernameToken entries in the soap message. (after I had
added  the following code snippet:
"
                     options.setProperty(RampartMessageData.KEY_CUSTOM_ISSUED_TOKEN, Boolean.TRUE);

                     options.setProperty(WSHandlerConstants.USER, "marginalen");   // 2012-04-28,
RunoB: Required for UsernameToken
                     options.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS, "com.tieto.ws.axis2.callback.UsernameTokenCallbackManager");

"

It was not necessary in axis2-1.4.1 to programmatically ad a RamprtConfig to Policy, etc.
I do not find any full manual how to set up UsernameToken in all its details, in order to
make it work properly.

Med vänlig hälsning, / Best Regards,

Runo Barrdahl, civ ing, tekn lic

Tieto Sweden AB, Financial Services

From: Hasini Gunasinghe [mailto:hasi7786@gmail.com]
Sent: den 27 maj 2012 14:26
To: java-dev@axis.apache.org
Subject: Re: FW: No user value in rampart configuration policy

Hi Runo,

The error you have reported occur if the user name is not found either in service client's
options or in rampart config at the time of creating User name token.

According to your description, you have used code generated client stub from the wsdl file
which embeds the security policy.
In that case you need to programetically add rampart configuration to the policy.

Please refer step 6 (Setting the Rampart specific configuration details) at http://wso2.org/library/3415#securing_the_client
for the correct steps to add rampart config at the client side.

HTH & let us know if you encounter further issues.

Thanks,
Hasini.
On Sun, May 27, 2012 at 2:22 AM, <Runo.Barrdahl@tieto.com<mailto:Runo.Barrdahl@tieto.com>>
wrote:


Med vänlig hälsning, / Best Regards,

Runo Barrdahl, civ ing, tekn lic

Tieto Sweden AB, Financial Services

From: Barrdahl Runo
Sent: den 26 maj 2012 18:12
To: 'java-dev@axis.apache.org<mailto:java-dev@axis.apache.org>'
Subject: No user value in rampart configuration policy

Dear Axis2 Specialist:

I have a problem with an axis2-1.6.2 client using UsernameToken and Addressing.
In no way can I avoid an AxisFault to be thrown in the Stub "No user value in the rampart
configuration policy".

First, I have added a policy according to the literature in the wsdl file, see enclosed file,
and added in the client axis2.xml the following section at the top:
"
<axisconfig name="AxisJava2.0">

       <module ref="rampart"/>
       <module ref="metadataExchange" />

       <parameter name="OutflowSecurity">
              <action>
                     <items>UsernameToken</items>
                     <passwordType>PasswordText</passwordType>
              </action>
       </parameter>
"
I use adb binding, but have also tried xmlbeans, see the Java code generation command:
"
@SET JAVA_HOME=C:\IBM\WAS61\WebSphere\AppServer\java
@SET AXIS2_HOME=C:\axis2-1.6.2
@SET PATH=%JAVA_HOME%\bin;%PATH%


@REM xmlBeans, new WSDL: Axis2-1.6.2
@REM @C:\axis2-1.6.2\bin\wsdl2java.bat -uri ./wsdl/CustomerCreationService.wsdl -o ./ -p com.tieto.ws.axis2.customercreation.service
-ss -sd -or -d xmlbeans -g -u -S ./src -R ./resourcesCustomerCreation


@REM ADB - Axis2-1.6.2
@C:\axis2-1.6.2\bin\wsdl2java.bat -uri ./wsdl/CustomerCreationService.wsdl -o ./ -p com.tieto.ws.axis2.customercreation.service
-ss -sd -or -d adb -g -u -S ./src -R ./resourcesCustomerCreation
"

After that, I have, as alternatvies, tried to load the policy in the client, instantiating
a RampartConfig object in the client, and numerous other different ways to get rid of the
AxisFault in the client.

My laptop is Windows 7, 64 bit, and I can run the client in Eclipse, in Tomcat or in IBM WebSphere
6.1, with identical result. Whether the service is available or not does not affect the result,
i. e. the thrown AxisFault.

I have even run debug mode in Eclipse using Rampart and wss4j source code, only to find that
somewhere inside there a userMissing message is displayed.
I have tested using http and SSL, with identical result.
I have tried all possible combinations in the client Java to set user, and in all various
combinations, all with negative result:
"
// UsernameToken:
// 2012-05-21, RunoB              String policyPath    = new String("C:/IBM/WAS61/WebSphere/AppServer/profiles/AppSrv01/installedApps/WL2007481Node01Cell/marginalenAxis2WSClient_war.ear/marginalenAxis2WSClient-localhostWAS.war/WEB-INF/properties/clientPolicy.xml");
// 2012-05-21, RunoB              options.setProperty(RampartMessageData.KEY_RAMPART_POLICY,
loadPolicy(policyPath));

// 2012-05-23, RunoB        options.setUserName("marginalen");       // removing this, results
in: "No user value in the rampart configuration policy"
// 2012-05-23, RunoB:      options.setPassword("largimanen"); // 2012-05-23, RunoB: this one
causes: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'E' (code 69) in
prolog; expected '<' at [row,col {unknown-source}]: [1,1]

/* 2012-05-23, RunoB: no effect:
                     RampartConfig rampartConfig = new RampartConfig();
                     rampartConfig.setUser("marginalen");
                     rampartConfig.setPwCbClass("com.tieto.ws.axis2.callback.UsernameTokenCallbackManager");
                     options.setProperty(RampartConfig.RAMPART_CONFIG_LN, rampartConfig);
*/

                     options.setProperty(RampartMessageData.KEY_CUSTOM_ISSUED_TOKEN, Boolean.TRUE);

                     options.setProperty(WSHandlerConstants.USER, "marginalen");   // 2012-04-28,
RunoB: Required for UsernameToken
                     options.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS, "com.tieto.ws.axis2.callback.UsernameTokenCallbackManager");
//                   options.setProperty(Constants.Configuration.ENABLE_REST,Constants.VALUE_FALSE);
//                   options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);

"

The message never reaches the web service on the server, only if I configure the client erroneously,
it might arrive to the service, where some other configuration erros message is displayed,
telling me more explicitly that something is wrong. But, as soon as I have changed the client
to produce a "correct" soap message, the client throws the axisFault "No user value in the
rampart configuration policy"..

I have (for http) in all cases intercepted the final SOAP message in the client stub, just
after the AxisFault has been thrown, and and used it to execute it in soapUI with success!
This means that the generated soap message is OK. Nevertheless, the axis2 client throws an
AxisFault "No user value in the rampart configuration policy".

I have previously, a few years back, successfully implemented an axis2-1.4.1 client (but at
the time, I had to manually complement the policy statement in the stub to avoid errors).
Now, for my current problem, I have looked back to configure client and axis2.xml analogously,
without success.

I am at a loss as to what could possibly cause the error. Please find enclosed the wsdl file.

I hae seen reported on the web the same text error, but not found any conclusive solution
(In fact, there was some instruction, that I followed, but it did not resolve my problem).

In case you have experience from  this issue, please send me some advice.



Med vänlig hälsning, / Best Regards,

Runo Barrdahl, civ ing, tekn lic

Tieto Sweden AB, Financial Services
mail: runo.barrdahl@tieto.com<mailto:runo.barrdahl@tieto.com>
tel (direct): 0709-790 407 / +46-709 790 407<tel:%2B46-709%20790%20407>
tel (central): 010 481 00 00 / +46-10 481 00 00<tel:%2B46-10%20481%2000%2000>
fax: 08-86 30 56 / +46-8 86 30 56<tel:%2B46-8%2086%2030%2056>
web: www.tieto.com<http://www.tieto.com>



---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org<mailto:java-dev-unsubscribe@axis.apache.org>
For additional commands, e-mail: java-dev-help@axis.apache.org<mailto:java-dev-help@axis.apache.org>


Mime
View raw message