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 Brian Woo <br...@sjrb.ca> on 2005/11/22 23:02:09 UTC

setProperty UsernameToken failed...

Hi all,

I am trying to setup a SOAP client to send UsernameToken.  I am trying not to use the WSDD to setup the parameters:

    DummyServiceService locator = 
      new DummyServiceServiceLocator();
        
    try
    {
      Remote remote = locator.getPort(DummyService.class);
      Stub axisPort = (Stub) remote;
      
      axisPort._setProperty(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
      axisPort._setProperty(UsernameToken.PASSWORD_TYPE, WSConstants.PASSWORD_TEXT);
      axisPort._setProperty(WSHandlerConstants.USER, "wss4j1");
      
      ClientAuthenticationHandler pwCallback = new ClientAuthenticationHandler();
      axisPort._setProperty(WSHandlerConstants.PW_CALLBACK_REF, pwCallback);
  
      
      DummyService service = locator.getDummyService();
      boolean result = service.doSomething();
      
    }


But I am getting an AxisFault:
WSDoAllReceiver: Request does not contain required Security header.

The question is, am I missing a property in the code?

Using a WSDD to pass in the parameters is completely fine though.

Thanks very much.

Regards,

Brian

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


Re: setProperty UsernameToken failed...

Posted by Paul Jamason <pj...@gpsmail.ucsd.edu>.
Brian,

I used the code example shown below, from:

http://www.cetis.ac.uk/members/scott/blogview?entry=20050411063622

Is this what you're looking for?

Paul


private EngineConfiguration createClientConfig()
 	{
 		try{
 			SimpleProvider clientConfig=new 
SimpleProvider();
 			Handler securityHandler= (Handler)new 
WSDoAllSender();

securityHandler.setOption(WSHandlerConstants.ACTION,this.WSS_ACTION);

securityHandler.setOption(WSHandlerConstants.SIG_PROP_FILE,this.WSS_SIG_PROPERTIES);

securityHandler.setOption(WSHandlerConstants.USER, this.WSS_USER);

securityHandler.setOption(WSHandlerConstants.PW_CALLBACK_CLASS, 
this.WSS_CALLBACK);
 			SimpleChain reqHandler=new SimpleChain();
 			SimpleChain respHandler=new SimpleChain();
 			// add the handler to the request
 			reqHandler.addHandler(securityHandler);
 			// add the handler to the response
 			respHandler.addHandler(securityHandler);
 			Handler pivot=(Handler)new HTTPSender();
 			Handler transport=new 
SimpleTargetedChain(reqHandler, pivot, respHandler);

clientConfig.deployTransport(HTTPTransport.DEFAULT_TRANSPORT_NAME,transport);
 			return clientConfig;
 		} catch (Exception ex){
 			log.error("Couldn't create engine 
configuration",ex);
 			return null;
 		}
 	}


invoke service using:



SampleServiceLocator service=new SampleServiceLocator();
if (this.WSS_ACTION != null){
     EngineConfiguration clientConfig=createClientConfig();
     service.setEngineConfiguration(clientConfig);
     service.setEngine(new AxisClient(clientConfig));
}
SRWPort port=service.getSRW(this.target.getUrl());
SampleRequestType request=new SampleRequestType();


On Tue, 22 Nov 2005, Ron Reynolds wrote:

> i don't see any code that puts an instance of WSDoAllSender in the flow -
> there was a nearly identical question to this one on the axis-users list so if
> you find the answer please let me know. :)
>
>> Hi all,
>>
>> I am trying to setup a SOAP client to send UsernameToken.  I am trying not to
>> use the WSDD to setup the parameters:
>>
>>     DummyServiceService locator =
>>       new DummyServiceServiceLocator();
>>
>>     try
>>     {
>>       Remote remote = locator.getPort(DummyService.class);
>>       Stub axisPort = (Stub) remote;
>>
>>       axisPort._setProperty(WSHandlerConstants.ACTION,
>> WSHandlerConstants.USERNAME_TOKEN);
>>       axisPort._setProperty(UsernameToken.PASSWORD_TYPE,
>> WSConstants.PASSWORD_TEXT);
>>       axisPort._setProperty(WSHandlerConstants.USER, "wss4j1");
>>
>>       ClientAuthenticationHandler pwCallback = new
>> ClientAuthenticationHandler();
>>       axisPort._setProperty(WSHandlerConstants.PW_CALLBACK_REF, pwCallback);
>>
>>
>>       DummyService service = locator.getDummyService();
>>       boolean result = service.doSomething();
>>
>>     }
>>
>>
>> But I am getting an AxisFault:
>> WSDoAllReceiver: Request does not contain required Security header.
>>
>> The question is, am I missing a property in the code?
>>
>> Using a WSDD to pass in the parameters is completely fine though.
>>
>> Thanks very much.
>>
>> Regards,
>>
>> Brian
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
>> For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>

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


Re: setProperty UsernameToken failed...

Posted by Paul Jamason <pj...@gpsmail.ucsd.edu>.
Brian,

I used the code example shown below, from:

http://www.cetis.ac.uk/members/scott/blogview?entry=20050411063622

Is this what you're looking for?

Paul


private EngineConfiguration createClientConfig()
 	{
 		try{
 			SimpleProvider clientConfig=new 
SimpleProvider();
 			Handler securityHandler= (Handler)new 
WSDoAllSender();

securityHandler.setOption(WSHandlerConstants.ACTION,this.WSS_ACTION);

securityHandler.setOption(WSHandlerConstants.SIG_PROP_FILE,this.WSS_SIG_PROPERTIES);

securityHandler.setOption(WSHandlerConstants.USER, this.WSS_USER);

securityHandler.setOption(WSHandlerConstants.PW_CALLBACK_CLASS, 
this.WSS_CALLBACK);
 			SimpleChain reqHandler=new SimpleChain();
 			SimpleChain respHandler=new SimpleChain();
 			// add the handler to the request
 			reqHandler.addHandler(securityHandler);
 			// add the handler to the response
 			respHandler.addHandler(securityHandler);
 			Handler pivot=(Handler)new HTTPSender();
 			Handler transport=new 
SimpleTargetedChain(reqHandler, pivot, respHandler);

clientConfig.deployTransport(HTTPTransport.DEFAULT_TRANSPORT_NAME,transport);
 			return clientConfig;
 		} catch (Exception ex){
 			log.error("Couldn't create engine 
configuration",ex);
 			return null;
 		}
 	}


invoke service using:



SampleServiceLocator service=new SampleServiceLocator();
if (this.WSS_ACTION != null){
     EngineConfiguration clientConfig=createClientConfig();
     service.setEngineConfiguration(clientConfig);
     service.setEngine(new AxisClient(clientConfig));
}
SRWPort port=service.getSRW(this.target.getUrl());
SampleRequestType request=new SampleRequestType();


On Tue, 22 Nov 2005, Ron Reynolds wrote:

> i don't see any code that puts an instance of WSDoAllSender in the flow -
> there was a nearly identical question to this one on the axis-users list so if
> you find the answer please let me know. :)
>
>> Hi all,
>>
>> I am trying to setup a SOAP client to send UsernameToken.  I am trying not to
>> use the WSDD to setup the parameters:
>>
>>     DummyServiceService locator =
>>       new DummyServiceServiceLocator();
>>
>>     try
>>     {
>>       Remote remote = locator.getPort(DummyService.class);
>>       Stub axisPort = (Stub) remote;
>>
>>       axisPort._setProperty(WSHandlerConstants.ACTION,
>> WSHandlerConstants.USERNAME_TOKEN);
>>       axisPort._setProperty(UsernameToken.PASSWORD_TYPE,
>> WSConstants.PASSWORD_TEXT);
>>       axisPort._setProperty(WSHandlerConstants.USER, "wss4j1");
>>
>>       ClientAuthenticationHandler pwCallback = new
>> ClientAuthenticationHandler();
>>       axisPort._setProperty(WSHandlerConstants.PW_CALLBACK_REF, pwCallback);
>>
>>
>>       DummyService service = locator.getDummyService();
>>       boolean result = service.doSomething();
>>
>>     }
>>
>>
>> But I am getting an AxisFault:
>> WSDoAllReceiver: Request does not contain required Security header.
>>
>> The question is, am I missing a property in the code?
>>
>> Using a WSDD to pass in the parameters is completely fine though.
>>
>> Thanks very much.
>>
>> Regards,
>>
>> Brian
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
>> For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>

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


Re: setProperty UsernameToken failed...

Posted by Ron Reynolds <Ro...@RonReynolds.com>.
i don't see any code that puts an instance of WSDoAllSender in the flow -
there was a nearly identical question to this one on the axis-users list so if
you find the answer please let me know. :)

> Hi all,
>
> I am trying to setup a SOAP client to send UsernameToken.  I am trying not to
> use the WSDD to setup the parameters:
>
>     DummyServiceService locator =
>       new DummyServiceServiceLocator();
>
>     try
>     {
>       Remote remote = locator.getPort(DummyService.class);
>       Stub axisPort = (Stub) remote;
>
>       axisPort._setProperty(WSHandlerConstants.ACTION,
> WSHandlerConstants.USERNAME_TOKEN);
>       axisPort._setProperty(UsernameToken.PASSWORD_TYPE,
> WSConstants.PASSWORD_TEXT);
>       axisPort._setProperty(WSHandlerConstants.USER, "wss4j1");
>
>       ClientAuthenticationHandler pwCallback = new
> ClientAuthenticationHandler();
>       axisPort._setProperty(WSHandlerConstants.PW_CALLBACK_REF, pwCallback);
>
>
>       DummyService service = locator.getDummyService();
>       boolean result = service.doSomething();
>
>     }
>
>
> But I am getting an AxisFault:
> WSDoAllReceiver: Request does not contain required Security header.
>
> The question is, am I missing a property in the code?
>
> Using a WSDD to pass in the parameters is completely fine though.
>
> Thanks very much.
>
> Regards,
>
> Brian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>
>



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


Re: setProperty UsernameToken failed...

Posted by Ron Reynolds <Ro...@RonReynolds.com>.
i don't see any code that puts an instance of WSDoAllSender in the flow -
there was a nearly identical question to this one on the axis-users list so if
you find the answer please let me know. :)

> Hi all,
>
> I am trying to setup a SOAP client to send UsernameToken.  I am trying not to
> use the WSDD to setup the parameters:
>
>     DummyServiceService locator =
>       new DummyServiceServiceLocator();
>
>     try
>     {
>       Remote remote = locator.getPort(DummyService.class);
>       Stub axisPort = (Stub) remote;
>
>       axisPort._setProperty(WSHandlerConstants.ACTION,
> WSHandlerConstants.USERNAME_TOKEN);
>       axisPort._setProperty(UsernameToken.PASSWORD_TYPE,
> WSConstants.PASSWORD_TEXT);
>       axisPort._setProperty(WSHandlerConstants.USER, "wss4j1");
>
>       ClientAuthenticationHandler pwCallback = new
> ClientAuthenticationHandler();
>       axisPort._setProperty(WSHandlerConstants.PW_CALLBACK_REF, pwCallback);
>
>
>       DummyService service = locator.getDummyService();
>       boolean result = service.doSomething();
>
>     }
>
>
> But I am getting an AxisFault:
> WSDoAllReceiver: Request does not contain required Security header.
>
> The question is, am I missing a property in the code?
>
> Using a WSDD to pass in the parameters is completely fine though.
>
> Thanks very much.
>
> Regards,
>
> Brian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>
>



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