FYI my PasswordHandler defined here:

outProperties.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS,
PasswordHandler.class.getName());

Is as follows:

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;

import org.apache.ws.security.WSPasswordCallback;
import org.codehaus.xfire.MessageContext;

public class PasswordHandler implements CallbackHandler { 

        private Map passwords = new HashMap();

        public PasswordHandler() {
                passwords.put("test", "test");
        }
           public void invoke(MessageContext context)
       throws Exception
   {
                   
                   System.out.println(context.getId());
                   
   }
           
        public String getPassword(){
                return "test";
        }
        
        
        public void handle(Callback[] callbacks) throws IOException,
                        UnsupportedCallbackException {
                
                WSPasswordCallback pc = (WSPasswordCallback)
callbacks[0];
                String id = pc.getIdentifer();
                pc.setPassword((String) passwords.get(id));

        }

}


The error does not appear to be occuring here:

I have been getting onvoke service error ever since I started created my
client using the generated stubs:


org.codehaus.xfire.XFireRuntimeException: Could not invoke service..
Nested exception is org.codehaus.xfire.fault.XFireFault: Service
specific exception:
com.gm.ciss.service.incentive.exception.CISSPublishingServiceException
org.codehaus.xfire.fault.XFireFault: Service specific exception:
com.gm.ciss.service.incentive.exception.CISSPublishingServiceException
        at
org.codehaus.xfire.fault.Soap11FaultSerializer.readMessage(Soap11FaultSe
rializer.java:31)
        at
org.codehaus.xfire.fault.SoapFaultSerializer.readMessage(SoapFaultSerial
izer.java:28)
        at
org.codehaus.xfire.soap.handler.ReadHeadersHandler.checkForFault(ReadHea
dersHandler.java:111)
        at
org.codehaus.xfire.soap.handler.ReadHeadersHandler.invoke(ReadHeadersHan
dler.java:67)
        at
org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:1
31)
        at org.codehaus.xfire.client.Client.onReceive(Client.java:406)
        at
org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.
java:139)
        at
org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
        at
org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java
:26)
        at
org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:1
31)
        at
org.codehaus.xfire.client.Invocation.invoke(Invocation.java:79)
        at
org.codehaus.xfire.client.Invocation.invoke(Invocation.java:114)
        at org.codehaus.xfire.client.Client.invoke(Client.java:336)
        at
org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
        at
org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
        at $Proxy12.getOffer(Unknown Source)
        at com.digitas.Test.main(Test.java:202)


Using this code to call the service:

@WebService(serviceName = "incentiveService", targetNamespace =
"http://ciss.gm.com/service/incentive";, endpointInterface =
"com.gm.ciss.service.incentive.incentiveServiceSOAPSOAP11Document_vims_i
ncentiveService")
public class Test {

        public static void main(String[] args) {

                try {

                        incentiveServiceClient c = new
incentiveServiceClient();
                        
        
incentiveServiceSOAPSOAP11Document_vims_incentiveService service =
c.getincentiveServiceSOAPSOAP11Document_vims_incentiveService("https://g
mservices.gm.com:443/vims/incentiveService");

                
                        Client client = Client.getInstance(service);
                
                        client.addOutHandler(new DOMOutHandler());
                        Properties outProperties = new Properties();


Thanks any help would be much appreciated, it is just weird that in
soapui it works in eclipse na dnot xfire cxf in eclipse as stubs,
definetely has to do with the authentication tho since when I take it
out of the soapui "Request Properties" it stops wowrking:

Now the "Request Properties" I set in the soapui are required or it
doesn't work and those are these:

<con:call name="Request 1" wssPasswordType="PasswordText"
id="1f521535-ebd4-4870-a2c5-acc644f22292"><con:settings/><con:encoding>U
TF-8</con:encoding><con:endpoint>https://gmservices.gm.com:443/vims/ince
ntiveService</con:endpoint><con:request>

Thanks again much appreciated!

-----Original Message-----
From: Menachem Glazer [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 21, 2008 9:26 AM
To: [email protected]
Subject: RE: CXF support for wsse:Nonce (client side)

I get a multiple header error when using that for passwordType plain
text - works in soap ui not with the cxf/xfire code.
The exact java stack trace error;

Jul 21, 2008 9:21:20 AM org.apache.commons.httpclient.HttpMethodBase
getResponseContentLength
WARNING: Multiple content-length headers detected

org.codehaus.xfire.XFireRuntimeException: Could not invoke service..
Nested exception is org.codehaus.xfire.fault.XFireFault: Service
specific exception:
com.gm.ciss.service.incentive.exception.CISSPublishingServiceException

org.codehaus.xfire.fault.XFireFault: Service specific exception:
com.gm.ciss.service.incentive.exception.CISSPublishingServiceException
        at
org.codehaus.xfire.fault.Soap11FaultSerializer.readMessage(Soap11FaultSe
rializer.java:31)
        at
org.codehaus.xfire.fault.SoapFaultSerializer.readMessage(SoapFaultSerial
izer.java:28)
        at
org.codehaus.xfire.soap.handler.ReadHeadersHandler.checkForFault(ReadHea
dersHandler.java:111)
        at
org.codehaus.xfire.soap.handler.ReadHeadersHandler.invoke(ReadHeadersHan
dler.java:67)
        at
org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:1
31)
        at org.codehaus.xfire.client.Client.onReceive(Client.java:406)
        at
org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.
java:139)
        at
org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
        at
org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java
:26)
        at
org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:1
31)
        at
org.codehaus.xfire.client.Invocation.invoke(Invocation.java:79)
        at
org.codehaus.xfire.client.Invocation.invoke(Invocation.java:114)
        at org.codehaus.xfire.client.Client.invoke(Client.java:336)
        at
org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
        at
org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
        at $Proxy12.getOffer(Unknown Source)
        at com.digitas.Test.main(Test.java:201)


Before adding the authentication code I would get a 'Forbidden' error
then the above error when I added this code:

Client client = Client.getInstance(service);
                
client.addOutHandler(new DOMOutHandler()); Properties outProperties =
new Properties();
                        // CONFIGURE OUTGOING SECURITY HERE
(outProperties) <--


outProperties.setProperty(WSHandlerConstants.ACTION,
WSHandlerConstants.USERNAME_TOKEN);
                    // Password type : plain text
outProperties.setProperty(WSHandlerConstants.PASSWORD_TYPE,
WSConstants.PW_TEXT);

outProperties.setProperty(WSHandlerConstants.USER, "dbclick");

outProperties.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS,
PasswordHandler.class.getName());

                        
client.addOutHandler(new WSS4JOutHandler(outProperties));
                        

If anyone has had experience and gotten this to work I would be forever
grateful. I can send all my code 'Test.java' code and the password
handler code ('PasswordHandler.java.' and anything else requested.
Getting this to work for many would prove very nice.

Thanks. 

-----Original Message-----
From: Maciej Kwiecien [mailto:[EMAIL PROTECTED]
Sent: Monday, July 21, 2008 9:01 AM
To: [email protected]
Subject: Re: CXF support for wsse:Nonce (client side)

Thanks Colm for information.

I'd like to check one more thing: Does CXF generate nonces when
PasswordText is used instead of Password digest?

Regards,
Maciej

On Mon, Jul 21, 2008 at 1:12 PM, O hEigeartaigh, Colm <
[EMAIL PROTECTED]> wrote:

>
> On the client side, a nonce is automatically created and inserted into

> the Username Token when password digest is used. CXF currently has no 
> support on the server side for caching/processing nonces.
>
> Colm.
>
> -----Original Message-----
> From: Maciej Kwiecien [mailto:[EMAIL PROTECTED]
> Sent: 21 July 2008 12:09
> To: [email protected]
> Subject: CXF support for wsse:Nonce (client side)
>
> Hello All,
>
> I am working on client who is supposed to invoke web service requiring

> UserNameToken authentication and wsse:Nonce.
> Please let me know if CXF framework provides support for that feature.
>
> I am little confused because I found on CXF project site information 
> that it is not supported by CXF 2.0 
> http://cwiki.apache.org/confluence/display/CXF20DOC/WS-Security
>
> but on the other hand there is tutorial available:
> http://www.jroller.com/gmazza/entry/using_cxf_and_wss4j_to
>
> where wsse:Nonce is present in reqeust header content...
>
> Any clarification would be appreciated.
>
> Regards,
> Maciej
>
> ----------------------------
> IONA Technologies PLC (registered in Ireland) Registered Number: 
> 171387 Registered Address: The IONA Building, Shelbourne Road, Dublin 
> 4, Ireland
>

Reply via email to