cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Renuka Pathak <reshu...@gmail.com>
Subject Error in java webservice client CXF: org.apache.cxf.interceptor.Fault: Could not send Message.
Date Mon, 05 Apr 2010 16:15:19 GMT
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.class.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:DSML: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(MessageSenderInterceptor.java:48)
    at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.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(MessageSenderInterceptor.java:46)

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message