You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2006/04/04 21:53:56 UTC
svn commit: r391392 -
/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/EndpointRegistry.java
Author: gnodet
Date: Tue Apr 4 12:53:53 2006
New Revision: 391392
URL: http://svn.apache.org/viewcvs?rev=391392&view=rev
Log:
SM-377: Ability to handle endpoint WSDL descriptions containing only a PortType
Modified:
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/EndpointRegistry.java
Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/EndpointRegistry.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/EndpointRegistry.java?rev=391392&r1=391391&r2=391392&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/EndpointRegistry.java (original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/EndpointRegistry.java Tue Apr 4 12:53:53 2006
@@ -29,6 +29,7 @@
import javax.management.ObjectName;
import javax.wsdl.Definition;
import javax.wsdl.Port;
+import javax.wsdl.PortType;
import javax.wsdl.Service;
import javax.wsdl.factory.WSDLFactory;
import javax.xml.namespace.QName;
@@ -231,29 +232,42 @@
return;
}
Definition definition = WSDLFactory.newInstance().newWSDLReader().readWSDL(null, document);
- Service service = definition.getService(serviceEndpoint.getServiceName());
- if (service == null) {
- logger.info("Endpoint " + serviceEndpoint + " has a service description, but no matching service found in " + definition.getServices().keySet());
- return;
- }
- Port port = service.getPort(serviceEndpoint.getEndpointName());
- if (port == null) {
- logger.info("Endpoint " + serviceEndpoint + " has a service description, but no matching endpoint found in " + service.getPorts().keySet());
- return;
- }
- if (port.getBinding() == null) {
- logger.info("Endpoint " + serviceEndpoint + " has a service description, but no binding found");
- return;
- }
- if (port.getBinding().getPortType() == null) {
- logger.info("Endpoint " + serviceEndpoint + " has a service description, but no port type found");
- return;
- }
- QName interfaceName = port.getBinding().getPortType().getQName();
- if (logger.isDebugEnabled()) {
- logger.debug("Endpoint " + serviceEndpoint + " implements interface " + interfaceName);
+ // Check if the wsdl is only a port type
+ // In these cases, only the port type is used, as the service name and endpoint name
+ // are provided on the jbi endpoint
+ if (definition.getPortTypes().keySet().size() == 1 &&
+ definition.getServices().keySet().size() == 0) {
+ PortType portType = (PortType) definition.getPortTypes().values().iterator().next();
+ QName interfaceName = portType.getQName();
+ if (logger.isDebugEnabled()) {
+ logger.debug("Endpoint " + serviceEndpoint + " implements interface " + interfaceName);
+ }
+ serviceEndpoint.addInterface(interfaceName);
+ } else {
+ Service service = definition.getService(serviceEndpoint.getServiceName());
+ if (service == null) {
+ logger.info("Endpoint " + serviceEndpoint + " has a service description, but no matching service found in " + definition.getServices().keySet());
+ return;
+ }
+ Port port = service.getPort(serviceEndpoint.getEndpointName());
+ if (port == null) {
+ logger.info("Endpoint " + serviceEndpoint + " has a service description, but no matching endpoint found in " + service.getPorts().keySet());
+ return;
+ }
+ if (port.getBinding() == null) {
+ logger.info("Endpoint " + serviceEndpoint + " has a service description, but no binding found");
+ return;
+ }
+ if (port.getBinding().getPortType() == null) {
+ logger.info("Endpoint " + serviceEndpoint + " has a service description, but no port type found");
+ return;
+ }
+ QName interfaceName = port.getBinding().getPortType().getQName();
+ if (logger.isDebugEnabled()) {
+ logger.debug("Endpoint " + serviceEndpoint + " implements interface " + interfaceName);
+ }
+ serviceEndpoint.addInterface(interfaceName);
}
- serviceEndpoint.addInterface(interfaceName);
} catch (Exception e) {
logger.warn("Error retrieving interfaces from service description: " + e.getMessage());
if (logger.isDebugEnabled()) {