On Monday 05 April 2010 2:17:40 pm Renuka Pathak wrote:
> Thanks Glen, Your tutorials are very useful. I tied using BindingProvider
> in code but now I am getting following error.
> 
> org.apache.cxf.interceptor.Fault: Could not send Message.
>       at
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInt
> erceptor.handleMessage(MessageSenderInterceptor.java:64) at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorCha
> in.java:243) at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:484) at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:310) at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:262) at
> org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73) at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124) at
> $Proxy62.directoryRequest(Unknown Source)
>       at
> main.java.gov.osc.enrollment.webserviceSFS.util.names.tc.dsml._2._0.core.D
> smlSoap_DsmlSoapQuery_Client.main(DsmlSoap_DsmlSoapQuery_Client.java:116)
> *Caused by: java.net.HttpRetryException: cannot retry due to server
> authentication, in streaming mode*

This usually means the username/password for basic auth was either not 
provided correctly or was wrong.   Basically, the server sent back a "please 
authorize" request, but since we are in streaming mode, not something we could 
support.

Definitely doublecheck the name/password combination and that it expects basic 
auth an not digest auth or similar.

Dan


> 
> On Mon, Apr 5, 2010 at 12:53 PM, Glen Mazza <[email protected]> wrote:
> > I believe you're mistaking the UsernameToken profile (message-level
> > security)
> > with the transport-layer security required by SSL.  (You shouldn't need
> > to configure the USERNAME_TOKEN and PASSWORD constants that you're
> > using.) Perhaps my ssl[1] and soap client[2] tutorials can be of help to
> > you.
> > 
> > HTH,
> > Glen
> > 
> > [1] http://www.jroller.com/gmazza/entry/setting_up_ssl_and_basic (Look at
> > #7
> > in particular for how transport-layer usernames and passwords are given)
> > 
> > [2] http://www.jroller.com/gmazza/entry/soap_client_tutorial
> > 
> > Renuka Pathak wrote:
> > > Hi CXF Team,
> > > 
> > > I am new to CXF.  I have generated java webservice client using CXF
> > > wsdl2Java utility. I am accesing a https webservice. I am setting
> > > Authentication parameters also in the java client. But when I run the
> > > client
> > > I get org.apache.cxf.interceptor.Fault: Could not send Message error.
> > > Could
> > > you please let me know what am I doing wrong? I am not sure if i am
> > > using authentication mechanism correct or not?  I am using a non
> > > spring plain java
> > > client.  Following is the code & error I am getting.
> > > 
> > >  private static void setAuthParameter(DsmlSoap port)
> > >  
> > >     {
> > >     
> > >         org.apache.cxf.endpoint.Client client =
> > > 
> > > org.apache.cxf.frontend.ClientProxy.getClient(port);
> > > 
> > > System.out.println("org.apache.cxf.frontend.ClientProxy.getClient(port)
> > > :" +
> > > org.apache.cxf.frontend.ClientProxy.getClient(port));
> > > 
> > >         org.apache.cxf.endpoint.Endpoint cxfEndpoint =
> > > 
> > > client.getEndpoint();
> > > 
> > >         System.out.println("client.getEndPoint: " + cxfEndpoint);
> > >         Map<String,Object> outProps= new HashMap<String,Object>();
> > 
> > outProps.put(WSHandlerConstants.ACTION,WSHandlerConstants.USERNAME_TOKEN)
> > ;
> > 
> > >         outProps.put(WSHandlerConstants.PASSWORD_TYPE,
> > > 
> > > WSConstants.PW_TEXT);
> > > 
> > >         outProps.put(WSHandlerConstants.USER, "endUser");
> > 
> > outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS,ClientPasswordHandler.c
> > lass.getName());
> > 
> > >         WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
> > >         
> > >         cxfEndpoint.getOutInterceptors().add(wssOut);
> > >         
> > >         cxfEndpoint.getOutInterceptors().add(new SAAJOutInterceptor());
> > >     
> > >     }
> > > 
> > > Note: ClientPasswordHandler has also been impemented & I set the
> > > password in
> > > it.
> > > 
> > > Client code which is calling above method:
> > >  public static void main(String args[]) throws Exception {
> > >  
> > >         URL wsdlURL = DsmlQueryService.WSDL_LOCATION;
> > >         System.out.println("ds: " + wsdlURL);
> > >         if (args.length > 0) {
> > >         
> > >             File wsdlFile = new File(args[0]);
> > >             try {
> > >             
> > >                 if (wsdlFile.exists()) {
> > >                 
> > >                     wsdlURL = wsdlFile.toURI().toURL();
> > >                 
> > >                 } else {
> > >                 
> > >                     wsdlURL = new URL(args[0]);
> > >                 
> > >                 }
> > >             
> > >             } catch (MalformedURLException e) {
> > >             
> > >                 e.printStackTrace();
> > >             
> > >             }
> > >         
> > >         }
> > >         
> > >         DsmlQueryService ss = new DsmlQueryService(wsdlURL,
> > 
> > SERVICE_NAME);
> > 
> > >         System.out.println("Invoking directoryRequest.22222.." + ss);
> > >         
> > >         DsmlSoap port = ss.getDsmlSoapQuery();
> > >         
> > >         setAuthParameter(port);
> > >         DsmlSoap_DsmlSoapQuery_Client  dsmlClient = new
> > > 
> > > DsmlSoap_DsmlSoapQuery_Client();
> > > 
> > >      BatchRequest _directoryRequest_batchRequest=
> > > 
> > > dsmlClient.callSearchRequest();
> > > 
> > >       BatchResponse _directoryRequest__return =
> > > 
> > > port.directoryRequest(_directoryRequest_batchRequest);
> > > 
> > > }
> > > 
> > > Error:
> > > Interceptor for
> > 
> > {urn:oasis:names:tc:DSML:2:0:core}dsmlQueryService#{urn:oasis:names:tc:DS
> > ML:2:0:core}directoryRequest
> > 
> > > has thrown exception, unwinding now
> > > org.apache.cxf.interceptor.Fault: Could not send Message.
> > > 
> > >     at
> > 
> > org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(Message
> > SenderInterceptor.java:48)
> > 
> > >     at
> > 
> > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorCh
> > ain.java:243)
> > 
> > >     at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:484)
> > >     at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:310)
> > >     at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:262)
> > >     at
> > 
> > org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
> > 
> > >     at
> > > 
> > > org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
> > > 
> > >     at $Proxy62.directoryRequest(Unknown Source)
> > >     at
> > 
> > main.java.gov.osc.enrollment.webserviceSFS.client.DsmlSoap_DsmlSoapQuery_
> > Client.main(DsmlSoap_DsmlSoapQuery_Client.java:122)
> > 
> > > Caused by: java.net.MalformedURLException: Invalid address. Endpoint
> > > address
> > > cannot be null.
> > > 
> > >     at
> > > 
> > > org.apache.cxf.transport.http.HTTPConduit.getURL(HTTPConduit.java:833)
> > > 
> > >     at
> > > 
> > > org.apache.cxf.transport.http.HTTPConduit.getURL(HTTPConduit.java:818)
> > > 
> > >     at
> > > 
> > > org.apache.cxf.transport.http.HTTPConduit.setupURL(HTTPConduit.java:745
> > > )
> > > 
> > >     at
> > > 
> > > org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:494)
> > > 
> > >     at
> > 
> > org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(Message
> > SenderInterceptor.java:46)
> > 
> > 
> > 
> > --
> > View this message in context:
> > http://old.nabble.com/Error-in-java-webservice-client-CXF%3A-org.apache.c
> > xf.interceptor.Fault%3A--Could-not-send-Message.-tp28141672p28142020.html
> > Sent from the cxf-user mailing list archive at Nabble.com.

-- 
Daniel Kulp
[email protected]
http://dankulp.com/blog

Reply via email to