tags:

views:

305

answers:

1

I am getting the following error [1] from the following code:

ClassLoader cl = Thread.currentThread().getContextClassLoader();
        URL WSDL_LOCATION=null;
        if ( null == cl ) cl = SQLService.class.getClassLoader();
         WSDL_LOCATION = cl.getResource( "SQLServiceSoap.wsdl" );

        QName SERVICE_NAME = new QName("http://localhost:8080/gateway/services/SQLServiceSoap?wsdl", "SQLService");
        Service service = Service.create(WSDL_LOCATION,SERVICE_NAME);
        SOAPport sqlService = service.getPort(SOAPport.class);
  Client client = org.apache.cxf.frontend.ClientProxy.getClient(sqlService);
  Endpoint cxfEndpoint = client.getEndpoint();
        Map<String, Object> outProps = new HashMap<String, Object>();
  outProps.put(WSHandlerConstants.ACTION,
    WSHandlerConstants.USERNAME_TOKEN);
  outProps.put(WSHandlerConstants.USER, soapUser);
  outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
  outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS,
    PasswordCallbackHandler.class.getName());
  outProps.put("password", soapPass);
  WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
  cxfEndpoint.getOutInterceptors().add(wssOut);

  String result = sqlService.ping("test");
  LOG.warn("PONG!: " + result);

My unfamiliarity with webservices continues to cause me grief.

[1]WARNING: Interceptor for {http://localhost:8080/gateway/services/SQLServiceSoap?wsdl}SQLService#{http://gateway.sf.net/sql}Ping 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 $Proxy37.ping(Unknown Source) at net.sf.gateway.client.base.sql.SQLClientBase.setSecurityHeaderTokens(SQLClientBase.java:255) at net.sf.gateway.client.base.sql.SQLClientBase.get(SQLClientBase.java:289) at net.sf.gateway.client.module.sql.SQLModule.getBatch(SQLModule.java:149) at net.sf.gateway.client.module.sql.SQLModule.getAndProcessSQL(SQLModule.java:110) at net.sf.gateway.client.module.sql.SQLModule.run(SQLModule.java:280) at net.sf.gateway.client.GatewayClient.exec(GatewayClient.java:399) at net.sf.gateway.client.GatewayClient.run(GatewayClient.java:174) at net.sf.gateway.client.GatewayClient.main(GatewayClient.java:166) 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:815) at org.apache.cxf.transport.http.HTTPConduit.setupURL(HTTPConduit.java:741) at org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:496) at org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:46)

A: 

End point was not setup at all, and CXF does not configure your End Point for you if it is different than what you have in your WSDL.

JohnC