Creating a CXF client from a remote WSDL that references localhost

I use CXF to create a client to connect to a remote web service. I have no control over the web service or wsdl definition.

Webservice wsdl makes several links to localhost, for example:

<soap12:address location="http://localhost:8002/request" />
<wsa10:EndPointReference>
    <wsa10:Address>http://localhost:8002/request</wsa10:Address>
</wsa10:EndPointReference>

I am trying to create my client using the wsdl2java maven target, pointing to the remote wsdl:

...
<wsdlOptions>
<wsdlOption>
<wsdl>http://remotehost:8002/?wsdl</wsdl>
<wsdlOption>
<wsdlOptions>
...

When I try to create a client, the target fails due to links to localhost:

org.apache.cxf.wsd11.WSDLRuntimeException: Fail to create wsdl definition from :       http://remotehost:8002/?wsdl [ERROR] caused by : WSDLException (at  
/wsdldefinitions/wsdl:import) faultCode=PARSER_ERROR: Problem parsing  
'http://localhost:8002/?wsdl=wsdl0'.: java.net.ConnectionException: Connection refused: connect

Is there a way to make CXF understand that localhost links are related to the wsdl host and automatically replace them with the appropriate hostname when creating the client?

, wsdl localhost . , wsdl, . - , ? cxf 2.6.0

.

( , remotehost)

+3
1

, CXF , localhost wsdl, , - , WSDL WSDL , . , , .

, URL- WSDL , , .

-, URL- ( ) WSDL, . URL- - factory. , , WSDL.

+1

All Articles