Author: kurtstam
Date: 2010-03-23 21:52:50 -0400 (Tue, 23 Mar 2010)
New Revision: 595
Modified:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/UDDIRegistration.java
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/EndpointManager.java
trunk/runtime/uddi/src/main/java/org/jboss/soa/bpel/uddi/UDDIRegistrationImpl.java
trunk/runtime/uddi300/src/main/java/org/jboss/soa/bpel/uddi300/UDDI300RegistrationImpl.java
Log:
RIFTSAW-158, simplifying API, correcting serviceName
Modified:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/UDDIRegistration.java
===================================================================
---
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/UDDIRegistration.java 2010-03-23
18:51:21 UTC (rev 594)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/UDDIRegistration.java 2010-03-24
01:52:50 UTC (rev 595)
@@ -21,9 +21,10 @@
*/
package org.jboss.soa.bpel.runtime.engine.ode;
+import java.net.URL;
+
import javax.xml.namespace.QName;
-import org.jboss.soa.bpel.runtime.ws.EndpointMetaData;
import org.jboss.soa.bpel.runtime.ws.WSDLReference;
/**
@@ -40,7 +41,7 @@
* @param metaData
* @param wsdlRef
*/
- public void registerEPR(EndpointMetaData metaData, WSDLReference wsdlRef);
+ public void registerEPR(String serviceName, String portName, URL accessUrl);
/**
* UnRegisters the binding from the UDDI Registry.
* @param QName of the service
Modified:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/EndpointManager.java
===================================================================
---
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/EndpointManager.java 2010-03-23
18:51:21 UTC (rev 594)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/EndpointManager.java 2010-03-24
01:52:50 UTC (rev 595)
@@ -150,7 +150,7 @@
ref
);
if (uddiRegistration!=null) {
- uddiRegistration.registerEPR(metaData, wsdlRef);
+ uddiRegistration.registerEPR(metaData.getServiceName().getLocalPart(),
metaData.getPortName(), serviceUrl);
}
return ref;
Modified:
trunk/runtime/uddi/src/main/java/org/jboss/soa/bpel/uddi/UDDIRegistrationImpl.java
===================================================================
---
trunk/runtime/uddi/src/main/java/org/jboss/soa/bpel/uddi/UDDIRegistrationImpl.java 2010-03-23
18:51:21 UTC (rev 594)
+++
trunk/runtime/uddi/src/main/java/org/jboss/soa/bpel/uddi/UDDIRegistrationImpl.java 2010-03-24
01:52:50 UTC (rev 595)
@@ -25,7 +25,6 @@
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
-import java.net.MalformedURLException;
import java.net.URL;
import java.rmi.RemoteException;
import java.util.List;
@@ -50,8 +49,6 @@
import org.apache.juddi.v3.client.transport.TransportException;
import org.jboss.soa.bpel.runtime.engine.ode.JAXWSBindingContext;
import org.jboss.soa.bpel.runtime.engine.ode.UDDIRegistration;
-import org.jboss.soa.bpel.runtime.ws.EndpointMetaData;
-import org.jboss.soa.bpel.runtime.ws.WSDLParser;
import org.jboss.soa.bpel.runtime.ws.WSDLReference;
import org.uddi.api_v3.AccessPoint;
import org.uddi.api_v3.BindingTemplate;
@@ -136,10 +133,6 @@
return (properties.getProperty(BPEL_UDDI_CLERK, DEFAULT_BPEL_UDDI_CLERK));
}
- private String getWebserviceBaseUrl() {
- return (properties.getProperty(JAXWSBindingContext.BPEL_WEBSERVICE_BASEURL,
"http://localhost:8080"));
- }
-
private UDDIClerk getBPELClerk() throws ConfigurationException {
if (bpelClerk==null) {
UDDIClerkManager clerkManager =
UDDIClientContainer.getUDDIClerkManager(getClerkManagerName());
@@ -160,7 +153,7 @@
* @param metaData
* @param wsdlRef
*/
- public void registerEPR(EndpointMetaData metaData, WSDLReference wsdlRef) {
+ public void registerEPR(String serviceName, String portName, URL accessUrl) {
boolean selfRegister = false;
try {
UDDIClerkManager clerkManager =
UDDIClientContainer.getUDDIClerkManager(getClerkManagerName());
@@ -170,13 +163,13 @@
UDDIClerk bpelClerk = clerks.get(getClerkName());
if (bpelClerk!=null) {
try {
- BusinessService service = createBusinessService(bpelClerk, metaData, wsdlRef);
+ BusinessService service = createBusinessService(bpelClerk, serviceName, portName,
accessUrl);
bpelClerk.register(service, bpelClerk.getUDDINode().getApiNode());
} catch (Exception e) {
- log.error("Unable to register service " + metaData.getServiceName()
+ log.error("Unable to register service " + serviceName
+ " ." + e.getMessage(),e);
} catch (Throwable t) {
- log.error("Unable to register service " + metaData.getServiceName()
+ log.error("Unable to register service " + serviceName
+ " ." + t.getMessage(),t);
}
} else {
@@ -246,22 +239,22 @@
}
private BusinessService createBusinessService(UDDIClerk clerk,
- EndpointMetaData metaData, WSDLReference wsdlRef)
+ String serviceName, String portName, URL accessUrl)
throws DispositionReportFaultMessage, RemoteException, ConfigurationException,
TransportException {
Properties properties = clerk.getUDDINode().getProperties();
//Constructing the serviceKey
- String serviceKey = TokenResolver.replaceTokens(DEFAULT_SERVICE_KEY_FORMAT +
metaData.getServiceName().getLocalPart(), properties);
+ String serviceKey = TokenResolver.replaceTokens(DEFAULT_SERVICE_KEY_FORMAT +
serviceName, properties);
if (properties.containsKey(SERVICE_KEY_FORMAT)) {
- serviceKey = TokenResolver.replaceTokens((String)properties.get(SERVICE_KEY_FORMAT) +
metaData.getServiceName(), properties);
+ serviceKey = TokenResolver.replaceTokens((String)properties.get(SERVICE_KEY_FORMAT) +
serviceName, properties);
}
BusinessService service = null;
try {
//Checking if this serviceKey already exist
service = clerk.findService(serviceKey, clerk.getUDDINode().getApiNode());
- log.debug("Service " + metaData.getServiceName() + " already present in
the UDDI Registry");
+ log.debug("Service " + serviceName + " already present in the UDDI
Registry");
} catch (Exception e) {
//If it does not exist construct service information
- log.debug("Constructing Service UDDI Information for " +
metaData.getServiceName());
+ log.debug("Constructing Service UDDI Information for " + serviceName);
service = new BusinessService();
service.setBusinessKey(TokenResolver.replaceTokens("uddi:${keyDomain}:${businessKey}",
properties));
service.setServiceKey(serviceKey);
@@ -271,10 +264,10 @@
if (properties.containsKey(LANG)) lang = properties.getProperty(LANG);
description.setLang(lang);
description.setValue(properties.getProperty(SERVICE_DESCRIPTION));
- Name serviceName = new Name();
- serviceName.setLang(lang);
- serviceName.setValue(metaData.getServiceName().getLocalPart());
- service.getName().add(serviceName);
+ Name sName = new Name();
+ sName.setLang(lang);
+ sName.setValue(serviceName);
+ service.getName().add(sName);
service.getDescription().add(description);
}
//default categoryBag on the binding
@@ -286,7 +279,7 @@
}
}
//Construct bindingTemplate
- BindingTemplate binding = createBindingTemplate(clerk, metaData, wsdlRef);
+ BindingTemplate binding = createBindingTemplate(clerk, serviceName, portName,
accessUrl);
//Add the bindingTemplate on the service
if (service.getBindingTemplates()==null) {
BindingTemplates bindingTemplates = new BindingTemplates();
@@ -297,16 +290,16 @@
}
private BindingTemplate createBindingTemplate(UDDIClerk clerk,
- EndpointMetaData metaData, WSDLReference wsdlRef) {
+ String serviceName, String portName, URL accessURL) {
Properties properties = clerk.getUDDINode().getProperties();
BindingTemplate bindingTemplate = new BindingTemplate();
//Constructing the bindingKey
- String bindingKey = TokenResolver.replaceTokens(DEFAULT_BINDING_KEY_FORMAT +
metaData.getServiceName().getLocalPart() + "-"
- + metaData.getPortName(), properties);
+ String bindingKey = TokenResolver.replaceTokens(DEFAULT_BINDING_KEY_FORMAT +
serviceName + "-"
+ + portName, properties);
if (properties.containsKey(BINDING_KEY_FORMAT)) {
- bindingKey = TokenResolver.replaceTokens((String)properties.get(BINDING_KEY_FORMAT) +
metaData.getServiceName().getLocalPart() + "-"
- + metaData.getPortName(), properties);
+ bindingKey = TokenResolver.replaceTokens((String)properties.get(BINDING_KEY_FORMAT) +
serviceName + "-"
+ + portName, properties);
}
bindingTemplate.setBindingKey(bindingKey);
@@ -322,13 +315,8 @@
AccessPoint accessPoint = new AccessPoint();
accessPoint.setUseType(AccessPointType.WSDL_DEPLOYMENT.toString());
- URL accessUrl = new
WSDLParser(wsdlRef.getDefinition()).getServiceLocationURL(metaData.getServiceName(),
metaData.getPortName());
- try {
- accessUrl = rewriteWSDLURL(accessUrl);
- } catch (MalformedURLException e) {
- log.error(e.getMessage(),e);
- }
- accessPoint.setValue(accessUrl.toExternalForm());
+ accessURL = rewriteWSDLURL(accessURL);
+ accessPoint.setValue(accessURL.toExternalForm());
bindingTemplate.setAccessPoint(accessPoint);
//default tModelKeys on the binding
@@ -388,39 +376,47 @@
List<ServiceInfo> serviceInfos =
serviceList.getServiceInfos().getServiceInfo();
for (ServiceInfo serviceInfo : serviceInfos) {
String serviceKey = serviceInfo.getServiceKey();
- log.info("Found service " + serviceQName.getLocalPart()
- + " with serviceKey '" + serviceInfo.getServiceKey() +
"'");
+
BusinessService service = bpelClerk.findService(serviceKey,
bpelClerk.getUDDINode().getApiNode());
- BindingTemplates bindingservices = service.getBindingTemplates();
- //Loop over all bindingTemplates found
- for (BindingTemplate bindingTemplate : bindingservices.getBindingTemplate()) {
- AccessPoint accessPoint = bindingTemplate.getAccessPoint();
- if (AccessPointType.WSDL_DEPLOYMENT.toString().equals(accessPoint.getUseType())) {
- URL url = null;
- try {
- url = new URL(accessPoint.getValue());
- log.info("wsdlUrl for service " + serviceQName.getLocalPart() +
" is " + url);
- WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
- Definition def = wsdlReader.readWSDL(url.toExternalForm());
- if (log.isDebugEnabled()) {
- log.debug(getWSDL(url));
- }
- //Checking if this WSDL contains the right port name.
- Port port = def.getService(serviceQName).getPort(portName);
- if (port!=null) {
- //Current policy: "FirstSuccess" :)
- return new WSDLReference(def, url.toURI());
- } else {
- log.info("PortName " + portName + " could not be found in
WSDL");
- }
- } catch (Exception e) {
- log.warn("Unable to obtain WSDL from " + url + ". " +
e.getMessage(),e);
- }
- } else {
- log.debug("This accessPoint is of type " + accessPoint.getUseType() +
" only "
- + AccessPointType.WSDL_DEPLOYMENT + " is supported at the
moment.");
- }
- }
+ BindingTemplates bindingTemplates = service.getBindingTemplates();
+ if (bindingTemplates==null) {
+ log.warn("Found service " + serviceQName.getLocalPart()
+ + " with serviceKey '" + serviceInfo.getServiceKey() +
"'"
+ + " but no EPRs");
+ } else {
+ log.info("Found service " + serviceQName.getLocalPart()
+ + " with serviceKey '" + serviceInfo.getServiceKey() +
"'"
+ + " and " + bindingTemplates.getBindingTemplate().size() + "
EPRs");
+ //Loop over all bindingTemplates found
+ for (BindingTemplate bindingTemplate : bindingTemplates.getBindingTemplate()) {
+ AccessPoint accessPoint = bindingTemplate.getAccessPoint();
+ if (AccessPointType.WSDL_DEPLOYMENT.toString().equals(accessPoint.getUseType()))
{
+ URL url = null;
+ try {
+ url = new URL(accessPoint.getValue());
+ log.info("wsdlUrl for service " + serviceQName.getLocalPart() +
" is " + url);
+ WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
+ Definition def = wsdlReader.readWSDL(url.toExternalForm());
+ if (log.isDebugEnabled()) {
+ log.debug(getWSDL(url));
+ }
+ //Checking if this WSDL contains the right port name.
+ Port port = def.getService(serviceQName).getPort(portName);
+ if (port!=null) {
+ //Current policy: "FirstSuccess" :)
+ return new WSDLReference(def, url.toURI());
+ } else {
+ log.info("PortName " + portName + " could not be found in
WSDL");
+ }
+ } catch (Exception e) {
+ log.warn("Unable to obtain WSDL from " + url + ". " +
e.getMessage(),e);
+ }
+ } else {
+ log.debug("This accessPoint is of type " + accessPoint.getUseType()
+ " only "
+ + AccessPointType.WSDL_DEPLOYMENT + " is supported at the
moment.");
+ }
+ }
+ }
}
} else {
log.info("No Service by the name " + serviceQName.getLocalPart() + "
was found in the registry.");
@@ -470,17 +466,26 @@
in.close();
return buffer.toString();
}
-
-
/**
+ *
* @param urlIn
* @return
- * @throws MalformedURLException
*/
- public URL rewriteWSDLURL(URL urlIn) throws MalformedURLException {
-
- String urlString = getWebserviceBaseUrl() + urlIn.getFile() + "?wsdl";
- URL outUrl = new URL(urlString);
+ public URL rewriteWSDLURL(URL urlIn) {
+ URL outUrl = urlIn;
+ try {
+ String urlString = getWebserviceBaseUrl() + urlIn.getFile() + "?wsdl";
+ outUrl = new URL(urlString);
+ } catch (Exception e) {
+ log.error(e.getMessage(),e);
+ }
return outUrl;
}
+ /**
+ *
+ * @return
+ */
+ private String getWebserviceBaseUrl() {
+ return (properties.getProperty(JAXWSBindingContext.BPEL_WEBSERVICE_BASEURL,
"http://localhost:8080"));
+ }
}
Modified:
trunk/runtime/uddi300/src/main/java/org/jboss/soa/bpel/uddi300/UDDI300RegistrationImpl.java
===================================================================
---
trunk/runtime/uddi300/src/main/java/org/jboss/soa/bpel/uddi300/UDDI300RegistrationImpl.java 2010-03-23
18:51:21 UTC (rev 594)
+++
trunk/runtime/uddi300/src/main/java/org/jboss/soa/bpel/uddi300/UDDI300RegistrationImpl.java 2010-03-24
01:52:50 UTC (rev 595)
@@ -25,7 +25,6 @@
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
-import java.net.MalformedURLException;
import java.net.URL;
import java.rmi.RemoteException;
import java.util.List;
@@ -49,8 +48,6 @@
import org.apache.juddi.v3.client.transport.TransportException;
import org.jboss.soa.bpel.runtime.engine.ode.JAXWSBindingContext;
import org.jboss.soa.bpel.runtime.engine.ode.UDDIRegistration;
-import org.jboss.soa.bpel.runtime.ws.EndpointMetaData;
-import org.jboss.soa.bpel.runtime.ws.WSDLParser;
import org.jboss.soa.bpel.runtime.ws.WSDLReference;
import org.uddi.api_v3.AccessPoint;
import org.uddi.api_v3.BindingTemplate;
@@ -101,10 +98,6 @@
return (properties.getProperty(BPEL_UDDI_CLERK, DEFAULT_BPEL_UDDI_CLERK));
}
- private String getWebserviceBaseUrl() {
- return (properties.getProperty(JAXWSBindingContext.BPEL_WEBSERVICE_BASEURL,
"http://localhost:8080"));
- }
-
private UDDIClerk getBPELClerk() throws ConfigurationException {
if (bpelClerk==null) {
Map<String,UDDIClerk> clerks =
UDDIClerkManager.getClientConfig().getUDDIClerks();
@@ -123,20 +116,20 @@
* @param metaData
* @param wsdlRef
*/
- public void registerEPR(EndpointMetaData metaData, WSDLReference wsdlRef) {
+ public void registerEPR(String serviceName, String portName, URL accessUrl) {
boolean selfRegister = false;
try {
selfRegister = UDDIClerkManager.getClientConfig().isRegisterOnStartup();
if (selfRegister) {
UDDIClerk bpelClerk = getBPELClerk();
try {
- BusinessService service = createBusinessService(bpelClerk, metaData, wsdlRef);
+ BusinessService service = createBusinessService(bpelClerk, serviceName, portName,
accessUrl);
bpelClerk.register(service, bpelClerk.getUDDINode().getApiNode());
} catch (Exception e) {
- log.error("Unable to register service " + metaData.getServiceName()
+ log.error("Unable to register service " + serviceName
+ " ." + e.getMessage(),e);
} catch (Throwable t) {
- log.error("Unable to register service " + metaData.getServiceName()
+ log.error("Unable to register service " + serviceName
+ " ." + t.getMessage(),t);
}
}
@@ -202,22 +195,22 @@
}
private BusinessService createBusinessService(UDDIClerk clerk,
- EndpointMetaData metaData, WSDLReference wsdlRef)
+ String serviceName, String portName, URL accessUrl)
throws DispositionReportFaultMessage, RemoteException, ConfigurationException,
TransportException {
Properties properties = clerk.getUDDINode().getProperties();
//Constructing the serviceKey
- String serviceKey = TokenResolver.replaceTokens(DEFAULT_SERVICE_KEY_FORMAT +
metaData.getServiceName().getLocalPart(), properties);
+ String serviceKey = TokenResolver.replaceTokens(DEFAULT_SERVICE_KEY_FORMAT +
serviceName, properties);
if (properties.containsKey(SERVICE_KEY_FORMAT)) {
- serviceKey = TokenResolver.replaceTokens((String)properties.get(SERVICE_KEY_FORMAT) +
metaData.getServiceName(), properties);
+ serviceKey = TokenResolver.replaceTokens((String)properties.get(SERVICE_KEY_FORMAT) +
serviceName, properties);
}
BusinessService service = null;
try {
//Checking if this serviceKey already exist
service = clerk.findService(serviceKey, clerk.getUDDINode().getApiNode());
- log.debug("Service " + metaData.getServiceName() + " already present in
the UDDI Registry");
+ log.debug("Service " + serviceName + " already present in the UDDI
Registry");
} catch (Exception e) {
//If it does not exist construct service information
- log.debug("Constructing Service UDDI Information for " +
metaData.getServiceName());
+ log.debug("Constructing Service UDDI Information for " + serviceName);
service = new BusinessService();
service.setBusinessKey(TokenResolver.replaceTokens("uddi:${keyDomain}:${businessKey}",
properties));
service.setServiceKey(serviceKey);
@@ -227,10 +220,10 @@
if (properties.containsKey(LANG)) lang = properties.getProperty(LANG);
description.setLang(lang);
description.setValue(properties.getProperty(SERVICE_DESCRIPTION));
- Name serviceName = new Name();
- serviceName.setLang(lang);
- serviceName.setValue(metaData.getServiceName().getLocalPart());
- service.getName().add(serviceName);
+ Name sName = new Name();
+ sName.setLang(lang);
+ sName.setValue(serviceName);
+ service.getName().add(sName);
service.getDescription().add(description);
}
//default categoryBag on the binding
@@ -242,7 +235,7 @@
}
}
//Construct bindingTemplate
- BindingTemplate binding = createBindingTemplate(clerk, metaData, wsdlRef);
+ BindingTemplate binding = createBindingTemplate(clerk, serviceName, portName,
accessUrl);
//Add the bindingTemplate on the service
if (service.getBindingTemplates()==null) {
BindingTemplates bindingTemplates = new BindingTemplates();
@@ -253,16 +246,16 @@
}
private BindingTemplate createBindingTemplate(UDDIClerk clerk,
- EndpointMetaData metaData, WSDLReference wsdlRef) {
+ String serviceName, String portName, URL accessURL) {
Properties properties = clerk.getUDDINode().getProperties();
BindingTemplate bindingTemplate = new BindingTemplate();
//Constructing the bindingKey
- String bindingKey = TokenResolver.replaceTokens(DEFAULT_BINDING_KEY_FORMAT +
metaData.getServiceName().getLocalPart() + "-"
- + metaData.getPortName(), properties);
+ String bindingKey = TokenResolver.replaceTokens(DEFAULT_BINDING_KEY_FORMAT +
serviceName + "-"
+ + portName, properties);
if (properties.containsKey(BINDING_KEY_FORMAT)) {
- bindingKey = TokenResolver.replaceTokens((String)properties.get(BINDING_KEY_FORMAT) +
metaData.getServiceName().getLocalPart() + "-"
- + metaData.getPortName(), properties);
+ bindingKey = TokenResolver.replaceTokens((String)properties.get(BINDING_KEY_FORMAT) +
serviceName + "-"
+ + portName, properties);
}
bindingTemplate.setBindingKey(bindingKey);
@@ -278,13 +271,8 @@
AccessPoint accessPoint = new AccessPoint();
accessPoint.setUseType(AccessPointType.WSDL_DEPLOYMENT.toString());
- URL accessUrl = new
WSDLParser(wsdlRef.getDefinition()).getServiceLocationURL(metaData.getServiceName(),
metaData.getPortName());
- try {
- accessUrl = rewriteWSDLURL(accessUrl);
- } catch (MalformedURLException e) {
- log.error(e.getMessage(),e);
- }
- accessPoint.setValue(accessUrl.toExternalForm());
+ accessURL = rewriteWSDLURL(accessURL);
+ accessPoint.setValue(accessURL.toExternalForm());
bindingTemplate.setAccessPoint(accessPoint);
//default tModelKeys on the binding
@@ -310,6 +298,7 @@
return bindingTemplate;
}
+
/**
* Looks up the WSDL for the requested service and portName. The BPELClerk
* is used to lookup the service in the UDDI Registry by ServiceName. For
@@ -343,39 +332,47 @@
List<ServiceInfo> serviceInfos =
serviceList.getServiceInfos().getServiceInfo();
for (ServiceInfo serviceInfo : serviceInfos) {
String serviceKey = serviceInfo.getServiceKey();
- log.info("Found service " + serviceQName.getLocalPart()
- + " with serviceKey '" + serviceInfo.getServiceKey() +
"'");
+
BusinessService service = bpelClerk.findService(serviceKey,
bpelClerk.getUDDINode().getApiNode());
- BindingTemplates bindingservices = service.getBindingTemplates();
- //Loop over all bindingTemplates found
- for (BindingTemplate bindingTemplate : bindingservices.getBindingTemplate()) {
- AccessPoint accessPoint = bindingTemplate.getAccessPoint();
- if (AccessPointType.WSDL_DEPLOYMENT.toString().equals(accessPoint.getUseType())) {
- URL url = null;
- try {
- url = new URL(accessPoint.getValue());
- log.info("wsdlUrl for service " + serviceQName.getLocalPart() +
" is " + url);
- WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
- Definition def = wsdlReader.readWSDL(url.toExternalForm());
- if (log.isDebugEnabled()) {
- log.debug(getWSDL(url));
- }
- //Checking if this WSDL contains the right port name.
- Port port = def.getService(serviceQName).getPort(portName);
- if (port!=null) {
- //Current policy: "FirstSuccess" :)
- return new WSDLReference(def, url.toURI());
- } else {
- log.info("PortName " + portName + " could not be found in
WSDL");
- }
- } catch (Exception e) {
- log.warn("Unable to obtain WSDL from " + url + ". " +
e.getMessage(),e);
- }
- } else {
- log.debug("This accessPoint is of type " + accessPoint.getUseType() +
" only "
- + AccessPointType.WSDL_DEPLOYMENT + " is supported at the
moment.");
- }
- }
+ BindingTemplates bindingTemplates = service.getBindingTemplates();
+ if (bindingTemplates==null) {
+ log.warn("Found service " + serviceQName.getLocalPart()
+ + " with serviceKey '" + serviceInfo.getServiceKey() +
"'"
+ + " but no EPRs");
+ } else {
+ log.info("Found service " + serviceQName.getLocalPart()
+ + " with serviceKey '" + serviceInfo.getServiceKey() +
"'"
+ + " and " + bindingTemplates.getBindingTemplate().size() + "
EPRs");
+ //Loop over all bindingTemplates found
+ for (BindingTemplate bindingTemplate : bindingTemplates.getBindingTemplate()) {
+ AccessPoint accessPoint = bindingTemplate.getAccessPoint();
+ if (AccessPointType.WSDL_DEPLOYMENT.toString().equals(accessPoint.getUseType()))
{
+ URL url = null;
+ try {
+ url = new URL(accessPoint.getValue());
+ log.info("wsdlUrl for service " + serviceQName.getLocalPart() +
" is " + url);
+ WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
+ Definition def = wsdlReader.readWSDL(url.toExternalForm());
+ if (log.isDebugEnabled()) {
+ log.debug(getWSDL(url));
+ }
+ //Checking if this WSDL contains the right port name.
+ Port port = def.getService(serviceQName).getPort(portName);
+ if (port!=null) {
+ //Current policy: "FirstSuccess" :)
+ return new WSDLReference(def, url.toURI());
+ } else {
+ log.info("PortName " + portName + " could not be found in
WSDL");
+ }
+ } catch (Exception e) {
+ log.warn("Unable to obtain WSDL from " + url + ". " +
e.getMessage(),e);
+ }
+ } else {
+ log.debug("This accessPoint is of type " + accessPoint.getUseType()
+ " only "
+ + AccessPointType.WSDL_DEPLOYMENT + " is supported at the
moment.");
+ }
+ }
+ }
}
} else {
log.info("No Service by the name " + serviceQName.getLocalPart() + "
was found in the registry.");
@@ -387,7 +384,7 @@
log.info("No WSDL could be obtained using the UDDI Registry Lookup.");
return null;
}
- /**
+ /**
* Obtains an authToken for this clerk.
*
* @param clerk
@@ -425,17 +422,26 @@
in.close();
return buffer.toString();
}
-
/**
*
* @param urlIn
* @return
- * @throws MalformedURLException
*/
- public URL rewriteWSDLURL(URL urlIn) throws MalformedURLException {
-
- String urlString = getWebserviceBaseUrl() + urlIn.getFile() + "?wsdl";
- URL outUrl = new URL(urlString);
+ public URL rewriteWSDLURL(URL urlIn) {
+ URL outUrl = urlIn;
+ try {
+ String urlString = getWebserviceBaseUrl() + urlIn.getFile() + "?wsdl";
+ outUrl = new URL(urlString);
+ } catch (Exception e) {
+ log.error(e.getMessage(),e);
+ }
return outUrl;
}
+ /**
+ *
+ * @return
+ */
+ private String getWebserviceBaseUrl() {
+ return (properties.getProperty(JAXWSBindingContext.BPEL_WEBSERVICE_BASEURL,
"http://localhost:8080"));
+ }
}