I could be wrong but I think the 2 xml snippets are equivalent.  The namespaces 
are set differently but both are valid.
 
Perhaps the service is buggy instead of the client.  But of course that doesn't 
help does it?
 
Gavin
 
 

___________________________________________

Gavin Hogan
Programmer/Analyst
The State University of New York
State University Plaza
Albany, NY 12246
Phone 518-443-5481
fax 518-443-5809
e-mail [EMAIL PROTECTED] 

        -----Original Message-----
        From: Arian Rodrigo Pasquali [mailto:[EMAIL PROTECTED] 
        Sent: Friday, June 22, 2007 1:23 PM
        To: [email protected]
        Subject: [xfire-user] ws-security - usernametoken
        
        

        Now I can see what xfire is sending and I can compare with the soap 
message the server is expecting.

         

        My XFire Soap Envelope

        <?xml version="1.0" encoding="ISO-8859-1"?>

        <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";

            xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>

            <soap:Body xmlns:ns1="http://www.bbmnet.com.br/2006/01/seup/";>

                <ns1:ListarUnidades xsi:nil="true"/>

            </soap:Body>

        </soap:Envelope>

         

         

        What server expect

        <?xml version="1.0" encoding="utf-8"?>

        <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>

          <soap:Body>

            <ListarUnidades xmlns="http://www.bbmnet.com.br/2006/01/seup/"; />

          </soap:Body>

        </soap:Envelope>

         

        This soap request uses ws-security with usertoken (with password text, 
not digest), I fallow the samples at xfire distro and my code 

         

        Then I´ve made few changes at xfire-book sample. 

         

         

        Properties properties = new Properties();

        configureOutProperties(properties);

        client.addOutHandler(new WSS4JOutHandler(properties));

         

         

        At BookClientUTPP class

        System.out.println("Configure WS-Security");

                // Action to perform : user token

                config.setProperty(WSHandlerConstants.ACTION, 
WSHandlerConstants.USERNAME_TOKEN);

                // Password type : plain text

                config.setProperty(WSHandlerConstants.PASSWORD_TYPE, 
WSConstants.PW_TEXT);

                // for hashed password use:

                //properties.setProperty(WSHandlerConstants.PASSWORD_TYPE, 
WSConstants.PW_DIGEST);

                // User name to send

                config.setProperty(WSHandlerConstants.USER, "andre1");

                        

                // Callback used to retrive password for given user.

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

            }

         

        My PasswordHandler

        public class PasswordHandler implements CallbackHandler {

         

              private Map passwords = new HashMap();

         

              public PasswordHandler() {

                    passwords.put("andre1", "andre123");

                //passwords.put("client-344-839","client344Password");

         

              }

         

              public void handle(Callback[] callbacks) throws IOException,

                          UnsupportedCallbackException {

                    

                    WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];

                    String id = pc.getIdentifer();

                    pc.setPassword((String) passwords.get(id));

         

              }

         

        }

         

         

        But I still have got this error:

         

        22/06/2007 16:45:43 org.apache.commons.httpclient.HttpMethodBase 
writeRequest

        INFO: 100 (continue) read timeout. Resume sending the request

        Exception in thread "main" org.codehaus.xfire.fault.XFireFault: 
System.Web.Services.Protocols.SoapHeaderException: Server unavailable, please 
try later ---> System.ApplicationException: WSE841: An error occured processing 
an outgoing fault response. ---> 
System.Web.Services.Protocols.SoapHeaderException: Header 
http://schemas.xmlsoap.org/ws/2004/08/addressing:Action for ultimate recipient 
is required but not present in the message.

           --- End of inner exception stack trace ---

           --- End of inner exception stack trace ---

              at 
org.codehaus.xfire.fault.Soap11FaultSerializer.readMessage(Soap11FaultSerializer.java:31)

              at 
org.codehaus.xfire.fault.SoapFaultSerializer.readMessage(SoapFaultSerializer.java:28)

              at 
org.codehaus.xfire.soap.handler.ReadHeadersHandler.checkForFault(ReadHeadersHandler.java:111)

              at 
org.codehaus.xfire.soap.handler.ReadHeadersHandler.invoke(ReadHeadersHandler.java:67)

              at 
org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)

              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:131)

              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.BookClient.executeClient(BookClient.java:149)

              at 
org.codehaus.xfire.client.BookClientUTPP.main(BookClientUTPP.java:42)

         

         

        Is this a server error or I´m setting something wrong in my xfire 
client?

         

        
        
        Arian Rodrigo Pasquali
        Desenvolvimento
        [EMAIL PROTECTED]
        Tel. +55 (47) 3802-8446
        www.neogrid.com.br
        
        

         

Reply via email to