WsdlDefinitionHandlerAdapter extends LocationTransformerObjectSupport implements HandlerAdapter, InitializingBean { protected void transformLocations(Document definitionDocument, HttpServletRequest request) throws Exception { transformLocations(locationXPathExpression, definitionDocument, request); }  void setLocationExpression(String locationExpression); void setSchemaLocationExpression(String schemaLocationExpression); void setTransformLocations(boolean transformLocations); void setTransformSchemaLocations(boolean transformSchemaLocations); @Override long getLastModified(HttpServletRequest request, Object handler); @Override ModelAndView handle(HttpServletRequest request, HttpServletResponse response, Object handler); @Override boolean supports(Object handler); @Override void afterPropertiesSet(); static final String DEFAULT_LOCATION_EXPRESSION; static final String DEFAULT_SCHEMA_LOCATION_EXPRESSION; }
@Test public void transformLocations() throws Exception { adapter.setTransformLocations(true); request.setMethod(HttpTransportConstants.METHOD_GET); request.setScheme("http"); request.setServerName("example.com"); request.setServerPort(8080); request.setContextPath("/context"); request.setServletPath("/service.wsdl"); request.setPathInfo(null); request.setRequestURI("/context/service.wsdl"); replay(definitionMock); DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactoryUtils.newInstance(); documentBuilderFactory.setNamespaceAware(true); DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); Document result = documentBuilder.parse(getClass().getResourceAsStream("wsdl11-input.wsdl")); adapter.transformLocations(result, request); Document expectedDocument = documentBuilder.parse(getClass().getResourceAsStream("wsdl11-expected.wsdl")); assertXMLEqual("Invalid result", expectedDocument, result); verify(definitionMock); }