I am trying to set property setendpointmapping of object UriEndpointmapping with a hashmap with the followings values:
UriEndpointMapping uriEndpointMapping = new UriEndpointMapping();
Map<String,Object> endpointMap = new HashMap<>();
endpointMap.put("/miservicio/cliente", gateway);
endpointMap.put("/miservicio/cliente.wsdl", wsdlDefinition());
uriEndpointMapping.setEndpointMap(endpointMap);
Where: gateway is an bean of type int-ws:inbound-gateway and wsdlDefinition is a method to return DefaultWsdl11Definition
So, When I call from of browser localhost:8080/miservicio/cliente.wsdl, I don't get a response. Thus, How should I work it?
You misunderstood the UriEndpointMapping
logic a bit:
* Implementation of the {@code EndpointMapping} interface to map from the full request URI or request URI path to
* endpoint beans.
The WSDL definition logic is a bit different and it is done like a part of the MessageDispatcherServlet
startup logic:
private void initWsdlDefinitions(ApplicationContext context) {
wsdlDefinitions = BeanFactoryUtils
.beansOfTypeIncludingAncestors(context, WsdlDefinition.class, true, false);
The WSDL selection logic from there by the incoming request is like this:
protected WsdlDefinition getWsdlDefinition(HttpServletRequest request) {
if (HttpTransportConstants.METHOD_GET.equals(request.getMethod()) &&
request.getRequestURI().endsWith(WSDL_SUFFIX_NAME)) {
String fileName = WebUtils.extractFilenameFromUrlPath(request.getRequestURI());
return wsdlDefinitions.get(fileName);
}
else {
return null;
}
}
And let's take some sample from the Spring WS documentation:
<sws:dynamic-wsdl id="holiday"
portTypeName="HumanResource"
locationUri="/holidayService/"
targetNamespace="http://mycompany.com/hr/definitions">
<sws:xsd location="/WEB-INF/hr.xsd"/>
</sws:dynamic-wsdl>
and this quote:
The id determines the URL where the WSDL can be retrieved. In this case, the id is holiday, which means that the WSDL can be retrieved as holiday.wsdl in the servlet context. The full URL will typically be http://localhost:8080/holidayService/holiday.wsdl