Search code examples
soapwsdlcxf

CXF: corrupted schemaLocation in xsd:import


I'm deploying a SOAP webservice using Apache CXF on different servers. The WSDL contains this line:

<xsd:import 
namespace="http://schemas.xxx.net/xsd/gameserver/types/types_v1_0"
schemaLocation="types_v1_0.xsd">

when a client accesses the WSDL, the schemaLocation is completed to form an absolute path:

<xsd:import 
namespace="http://schemas.xxx.net/xsd/gameserver/type/types_v1_0" 
schemaLocation="http://moss.xxx.local:8080/gameserver/webservices/base_v1?xsd=types_v1_0.xsd">

My problem: on some of the servers, this produces corrupt URLs:

<xsd:import 
namespace="http://schemas.xxx.net/xsd/gameserver/types/types_v1_0" 
schemaLocation="http://localhost8888gameserver/webservices/base_v1?xsd=types_v1_0.xsd">

or even

<xsd:import 
namespace="http://schemas.xxx.net/xsd/gameserver/types/types_v1_0" 
schemaLocation="jen.x.local8080gameserver/webservices/base_v1?xsd=types_v1_0.xsd">

Has anyone encountered this problem? What could cause it? It seems to have appeared suddenly today when deploying a current version of the application, but I cannot find any suspicious changes - specifically that WSDL was not changed at all.


Solution

  • Turns out the URL is derived from the publishedEndpointUrl attribute of the <jaxws:endpoint> element in cxf-context.xml, which was wrong on some servers due to problems in the Maven profiles.