2016-12-06 3 views
2

Ich versuche, mit den folgenden Werten mit einer hashmap Eigenschaft setendpointmapping des Objekts UriEndpointmapping einzustellen:UriEndpointmapping arbeitet mit dem Attribut setendpointmapping - Frühling Integration ws

UriEndpointMapping uriEndpointMapping = new UriEndpointMapping(); 
Map<String,Object> endpointMap = new HashMap<>(); 
endpointMap.put("/miservicio/cliente", gateway); 
endpointMap.put("/miservicio/cliente.wsdl", wsdlDefinition()); 
uriEndpointMapping.setEndpointMap(endpointMap); 

Wo: Gateway eine Bohne vom Typ int-ws ist: Inbound -gateway und wsdlDefinition ist eine Methode zum Zurückgeben von DefaultWsdl11Definition

So, wenn ich vom Browser localhost aufrufen: 8080/miservicio/cliente.wsdl, bekomme ich keine Antwort. Also, wie soll ich es machen?

Antwort

1

Sie mißverstanden die UriEndpointMapping Logik ein wenig:

* Implementation of the {@code EndpointMapping} interface to map from the full request URI or request URI path to 
* endpoint beans. 

Die WSDL-Definition-Logik ist ein bisschen anders, und es ist wie ein Teil der MessageDispatcherServlet Startlogik getan:

private void initWsdlDefinitions(ApplicationContext context) { 
    wsdlDefinitions = BeanFactoryUtils 
      .beansOfTypeIncludingAncestors(context, WsdlDefinition.class, true, false); 

Die WSDL-Auswahl Logik von dort durch die eingehende Anfrage ist wie folgt:

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; 
    } 
} 

Und lassen Sie uns einige Beispiele aus der Frühjahr WS Dokumentation nehmen:

<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> 

und dieses Zitat:

Die ID der URL bestimmt, wo die WSDL abgerufen werden können. In diesem Fall ist die ID Feiertag, was bedeutet, dass die WSDL im Kontext des Servlets als holiday.wsdl abgerufen werden kann. Die vollständige URL lautet normalerweise http://localhost:8080/holidayService/holiday.wsdl

Verwandte Themen