Description
When creating a client setting proxy config first and then endopoint address, we get Exception when Sending Message (this worked perfectly in CXF 3.0.2):
java.net.URISyntaxException: Invalid address. Endpoint address cannot be null. at index 0: <null>
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:307)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:516)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:425)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:326)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:279)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:138)
.............
.....................
Caused by: java.io.IOException: java.net.URISyntaxException: Invalid address. Endpoint address cannot be null. at index 0: <null>
at org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:490)
at org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:46)
... 16 more
Caused by: java.net.URISyntaxException: Invalid address. Endpoint address cannot be null. at index 0: <null>
at org.apache.cxf.transport.http.HTTPConduit.setAndGetDefaultAddress(HTTPConduit.java:732)
at org.apache.cxf.transport.http.HTTPConduit.setupAddress(HTTPConduit.java:677)
at org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:488)
... 17 more
Could not send Message.
javax.xml.ws.WebServiceException: Could not send Message.
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:149)
......
......
Caused by: java.io.IOException: java.net.URISyntaxException: Invalid address. Endpoint address cannot be null. at index 0: <null>
at org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:490)
at org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:46)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:516)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:425)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:326)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:279)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:138)
... 9 more
Caused by: java.net.URISyntaxException: Invalid address. Endpoint address cannot be null. at index 0: <null>
at org.apache.cxf.transport.http.HTTPConduit.setAndGetDefaultAddress(HTTPConduit.java:732)
at org.apache.cxf.transport.http.HTTPConduit.setupAddress(HTTPConduit.java:677)
at org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:488)
... 17 more
This is Client Creation:
Service service = HydraWebService.create(SERVICE_NAME);
port = service.getPort(HydraService.class);
Client client = ClientProxy.getClient(port);
client.getInInterceptors().add(new LoggingInInterceptor());
client.getOutInterceptors().add(new LoggingOutInterceptor());
HTTPConduit http = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setAllowChunking(false);
httpClientPolicy.setReceiveTimeout(0);
httpClientPolicy.setProxyServerType(ProxyServerType.HTTP);
httpClientPolicy.setProxyServer(ConnectorConfiguration.getProxyURL());
httpClientPolicy.setProxyServerPort(Integer.parseInt(ConnectorConfiguration.getProxyPort()));
http.setClient(httpClientPolicy);
BindingProvider provider = (BindingProvider) port;
provider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, wsdlURL.toString());