You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by Edson Tavares de Camargo <ca...@stela.org.br> on 2006/11/29 14:53:42 UTC

usernametoken programmatically with a stub (rampart and Axis2)

Hi All!

I am sending this emai to wssj4 and axis list.

Please, I need help in this question. Seems a simple problem, but I 
really can't resolve it .
I want set a usernametoken programmatically in the client side. I am 
using axis2 and rampart module. This is the error:

Exception in thread "main" java.lang.NullPointerException
    at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:578)
    at 
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:328)
    at 
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:279)
    at org.apache.ws.axis2.ClientStub.getUpdate(ClientStub.java:118)
    at org.apache.ws.axis2.TestClient.main(TestClient.java:72)

I will very glad if someone could helpe me. The piece of my code client 
side is following:

//-----------------------
ConfigurationContext ctx = 
ConfigurationContextFactory.createConfigurationContextFromFileSystem(path/to/repository, 
"\\axis2.xml");
ClientStub stub = new ClientStub(ctx,target);

stub._getServiceClient().getOptions().setProperty("user", "teste"); // 
here I am setting the username
//-------------------

I tried the following too:

//-----------------
ConfigurationContext ctx = 
ConfigurationContextFactory.createConfigurationContextFromFileSystem(path/to/repository, 
"\\axis2.xml");
ClientStub stub = new ClientStub(ctx,target);
   
ServiceClient serviceClient = stub._getServiceClient();
Options options = serviceClient.getOptions();
       
options.setProperty("user", "teste");
serviceClient.setOptions(options);
stub._setServiceClient(serviceClient);
//----------------------

In the axis2.xml I am not using the "user" element. The piece of this 
file is following:

// -----------------
<axisconfig name="AxisJava2.0">

    <module ref="rampart" />
   
    <parameter name="OutflowSecurity">
        <action>
            <items>UsernameToken</items>
        <!--    <user>teste</user> -->
            
<passwordCallbackClass>org.apache.ws.axis2.PWCBHandler</passwordCallbackClass>
          </action>
    </parameter>
    <parameter name="hotdeployment" locked="false">true</parameter>
    <parameter name="hotupdate" locked="false">true</parameter>

    <messageReceiver mep="INOUT" 
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>

    <transportSender name="http" 
class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
        <parameter name="PROTOCOL" locked="false">HTTP/1.0</parameter>
    </transportSender>

   <phaseOrder type="inflow">
    <!--
         Continue
       --->
    //  ------------------------------------------

Please, Where is the problem? There are other way to set the 
usernametoken programmatically?

Thanks in advance,

Edson

-- 
Edson Tavares de Camargo - Instituto Stela
Florianópolis - SC - Brasil
(48) 3239 2572
camargo@stela.org.br


---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org


Re: usernametoken programmatically with a stub (rampart and Axis2)

Posted by Edson Tavares de Camargo <ca...@stela.org.br>.
Hi,

I already resolve the problem.  The error wasn't in the code.

Thanks!

Edson

Edson Tavares de Camargo escreveu:
> Hi All!
>
> I am sending this emai to wssj4 and axis list.
>
> Please, I need help in this question. Seems a simple problem, but I 
> really can't resolve it .
> I want set a usernametoken programmatically in the client side. I am 
> using axis2 and rampart module. This is the error:
>
> Exception in thread "main" java.lang.NullPointerException
>    at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:578)
>    at 
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:328) 
>
>    at 
> org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:279) 
>
>    at org.apache.ws.axis2.ClientStub.getUpdate(ClientStub.java:118)
>    at org.apache.ws.axis2.TestClient.main(TestClient.java:72)
>
> I will very glad if someone could helpe me. The piece of my code 
> client side is following:
>
> //-----------------------
> ConfigurationContext ctx = 
> ConfigurationContextFactory.createConfigurationContextFromFileSystem(path/to/repository, 
> "\\axis2.xml");
> ClientStub stub = new ClientStub(ctx,target);
>
> stub._getServiceClient().getOptions().setProperty("user", "teste"); // 
> here I am setting the username
> //-------------------
>
> I tried the following too:
>
> //-----------------
> ConfigurationContext ctx = 
> ConfigurationContextFactory.createConfigurationContextFromFileSystem(path/to/repository, 
> "\\axis2.xml");
> ClientStub stub = new ClientStub(ctx,target);
>   ServiceClient serviceClient = stub._getServiceClient();
> Options options = serviceClient.getOptions();
>       options.setProperty("user", "teste");
> serviceClient.setOptions(options);
> stub._setServiceClient(serviceClient);
> //----------------------
>
> In the axis2.xml I am not using the "user" element. The piece of this 
> file is following:
>
> // -----------------
> <axisconfig name="AxisJava2.0">
>
>    <module ref="rampart" />
>      <parameter name="OutflowSecurity">
>        <action>
>            <items>UsernameToken</items>
>        <!--    <user>teste</user> -->
>            
> <passwordCallbackClass>org.apache.ws.axis2.PWCBHandler</passwordCallbackClass> 
>
>          </action>
>    </parameter>
>    <parameter name="hotdeployment" locked="false">true</parameter>
>    <parameter name="hotupdate" locked="false">true</parameter>
>
>    <messageReceiver mep="INOUT" 
> class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
>
>    <transportSender name="http" 
> class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
>        <parameter name="PROTOCOL" locked="false">HTTP/1.0</parameter>
>    </transportSender>
>
>   <phaseOrder type="inflow">
>    <!--
>         Continue
>       --->
>    //  ------------------------------------------
>
> Please, Where is the problem? There are other way to set the 
> usernametoken programmatically?
>
> Thanks in advance,
>
> Edson
>


-- 
Edson Tavares de Camargo - Instituto Stela
Florianópolis - SC - Brasil
(48) 3239 2572
camargo@stela.org.br


---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org


Re: usernametoken programmatically with a stub (rampart and Axis2)

Posted by Edson Tavares de Camargo <ca...@stela.org.br>.
Hi,

I already resolve the problem.  The error wasn't in the code.

Thanks!

Edson

Edson Tavares de Camargo escreveu:
> Hi All!
>
> I am sending this emai to wssj4 and axis list.
>
> Please, I need help in this question. Seems a simple problem, but I 
> really can't resolve it .
> I want set a usernametoken programmatically in the client side. I am 
> using axis2 and rampart module. This is the error:
>
> Exception in thread "main" java.lang.NullPointerException
>    at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:578)
>    at 
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:328) 
>
>    at 
> org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:279) 
>
>    at org.apache.ws.axis2.ClientStub.getUpdate(ClientStub.java:118)
>    at org.apache.ws.axis2.TestClient.main(TestClient.java:72)
>
> I will very glad if someone could helpe me. The piece of my code 
> client side is following:
>
> //-----------------------
> ConfigurationContext ctx = 
> ConfigurationContextFactory.createConfigurationContextFromFileSystem(path/to/repository, 
> "\\axis2.xml");
> ClientStub stub = new ClientStub(ctx,target);
>
> stub._getServiceClient().getOptions().setProperty("user", "teste"); // 
> here I am setting the username
> //-------------------
>
> I tried the following too:
>
> //-----------------
> ConfigurationContext ctx = 
> ConfigurationContextFactory.createConfigurationContextFromFileSystem(path/to/repository, 
> "\\axis2.xml");
> ClientStub stub = new ClientStub(ctx,target);
>   ServiceClient serviceClient = stub._getServiceClient();
> Options options = serviceClient.getOptions();
>       options.setProperty("user", "teste");
> serviceClient.setOptions(options);
> stub._setServiceClient(serviceClient);
> //----------------------
>
> In the axis2.xml I am not using the "user" element. The piece of this 
> file is following:
>
> // -----------------
> <axisconfig name="AxisJava2.0">
>
>    <module ref="rampart" />
>      <parameter name="OutflowSecurity">
>        <action>
>            <items>UsernameToken</items>
>        <!--    <user>teste</user> -->
>            
> <passwordCallbackClass>org.apache.ws.axis2.PWCBHandler</passwordCallbackClass> 
>
>          </action>
>    </parameter>
>    <parameter name="hotdeployment" locked="false">true</parameter>
>    <parameter name="hotupdate" locked="false">true</parameter>
>
>    <messageReceiver mep="INOUT" 
> class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
>
>    <transportSender name="http" 
> class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
>        <parameter name="PROTOCOL" locked="false">HTTP/1.0</parameter>
>    </transportSender>
>
>   <phaseOrder type="inflow">
>    <!--
>         Continue
>       --->
>    //  ------------------------------------------
>
> Please, Where is the problem? There are other way to set the 
> usernametoken programmatically?
>
> Thanks in advance,
>
> Edson
>


-- 
Edson Tavares de Camargo - Instituto Stela
Florianópolis - SC - Brasil
(48) 3239 2572
camargo@stela.org.br


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: usernametoken programmatically with a stub (rampart and Axis2)

Posted by Edson Tavares de Camargo <ca...@stela.org.br>.
Hi,

I already resolve the problem.  The error wasn't in the code.

Thanks!

Edson

Edson Tavares de Camargo escreveu:
> Hi All!
>
> I am sending this emai to wssj4 and axis list.
>
> Please, I need help in this question. Seems a simple problem, but I 
> really can't resolve it .
> I want set a usernametoken programmatically in the client side. I am 
> using axis2 and rampart module. This is the error:
>
> Exception in thread "main" java.lang.NullPointerException
>    at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:578)
>    at 
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:328) 
>
>    at 
> org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:279) 
>
>    at org.apache.ws.axis2.ClientStub.getUpdate(ClientStub.java:118)
>    at org.apache.ws.axis2.TestClient.main(TestClient.java:72)
>
> I will very glad if someone could helpe me. The piece of my code 
> client side is following:
>
> //-----------------------
> ConfigurationContext ctx = 
> ConfigurationContextFactory.createConfigurationContextFromFileSystem(path/to/repository, 
> "\\axis2.xml");
> ClientStub stub = new ClientStub(ctx,target);
>
> stub._getServiceClient().getOptions().setProperty("user", "teste"); // 
> here I am setting the username
> //-------------------
>
> I tried the following too:
>
> //-----------------
> ConfigurationContext ctx = 
> ConfigurationContextFactory.createConfigurationContextFromFileSystem(path/to/repository, 
> "\\axis2.xml");
> ClientStub stub = new ClientStub(ctx,target);
>   ServiceClient serviceClient = stub._getServiceClient();
> Options options = serviceClient.getOptions();
>       options.setProperty("user", "teste");
> serviceClient.setOptions(options);
> stub._setServiceClient(serviceClient);
> //----------------------
>
> In the axis2.xml I am not using the "user" element. The piece of this 
> file is following:
>
> // -----------------
> <axisconfig name="AxisJava2.0">
>
>    <module ref="rampart" />
>      <parameter name="OutflowSecurity">
>        <action>
>            <items>UsernameToken</items>
>        <!--    <user>teste</user> -->
>            
> <passwordCallbackClass>org.apache.ws.axis2.PWCBHandler</passwordCallbackClass> 
>
>          </action>
>    </parameter>
>    <parameter name="hotdeployment" locked="false">true</parameter>
>    <parameter name="hotupdate" locked="false">true</parameter>
>
>    <messageReceiver mep="INOUT" 
> class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
>
>    <transportSender name="http" 
> class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
>        <parameter name="PROTOCOL" locked="false">HTTP/1.0</parameter>
>    </transportSender>
>
>   <phaseOrder type="inflow">
>    <!--
>         Continue
>       --->
>    //  ------------------------------------------
>
> Please, Where is the problem? There are other way to set the 
> usernametoken programmatically?
>
> Thanks in advance,
>
> Edson
>


-- 
Edson Tavares de Camargo - Instituto Stela
Florianópolis - SC - Brasil
(48) 3239 2572
camargo@stela.org.br


---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org