Author: heiko.braun(a)jboss.com
Date: 2009-11-25 08:56:46 -0500 (Wed, 25 Nov 2009)
New Revision: 331
Modified:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/JAXWSBindingContext.java
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java
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/Runner.java
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WSDLParser.java
Log:
Fix RIFTSAW-120: Failed to find doclit operation on nested imports
Modified:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/JAXWSBindingContext.java
===================================================================
---
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/JAXWSBindingContext.java 2009-11-25
13:26:21 UTC (rev 330)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/JAXWSBindingContext.java 2009-11-25
13:56:46 UTC (rev 331)
@@ -111,7 +111,7 @@
{
WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
Definition def = wsdlReader.readWSDL(f.toURL().toExternalForm());
- URL url = WSDLParser.getServiceLocationURL(def, myRoleEndpoint.serviceName,
myRoleEndpoint.portName);
+ URL url = new WSDLParser(def).getServiceLocationURL(myRoleEndpoint.serviceName,
myRoleEndpoint.portName);
if(url!=null)
{
targetWsdlFile = f;
Modified:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java
===================================================================
---
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java 2009-11-25
13:26:21 UTC (rev 330)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java 2009-11-25
13:56:46 UTC (rev 331)
@@ -129,8 +129,8 @@
else
{
QName elementName = new QName(payload.getNamespaceURI(), payload.getLocalName());
- Operation op = WSDLParser.getDocLitOperation(
- this.serviceQName, getPortName(), elementName , wsdlDefinition
+ Operation op = new WSDLParser(wsdlDefinition).getDocLitOperation(
+ this.serviceQName, getPortName(), elementName
);
return op.getName();
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 2009-11-25
13:26:21 UTC (rev 330)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/EndpointManager.java 2009-11-25
13:56:46 UTC (rev 331)
@@ -108,7 +108,7 @@
ClassLoaderFactory clf = new DelegatingClassLoaderFactory(classLoader);
// WebMetaData
- URL serviceUrl = WSDLParser.getServiceLocationURL(wsdlRef.getDefinition(),
metaData.getServiceName(), metaData.getPortName());
+ URL serviceUrl = new
WSDLParser(wsdlRef.getDefinition()).getServiceLocationURL(metaData.getServiceName(),
metaData.getPortName());
String[] webContext = deriveWebContextFromServiceUrl(serviceUrl);
WebMetaDataFactory wmdFactory = new WebMetaDataFactory(
Modified: trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/Runner.java
===================================================================
---
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/Runner.java 2009-11-25
13:26:21 UTC (rev 330)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/Runner.java 2009-11-25
13:56:46 UTC (rev 331)
@@ -37,20 +37,27 @@
// HelloWorldProcessRequest
WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
- Definition wsdlDefinition =
wsdlReader.readWSDL("file:///Users/hbraun/Downloads/HelloWorldProcessArtifacts.wsdl");
+ Definition wsdlDefinition = wsdlReader.readWSDL(
+
"file:///Users/hbraun/dev/env/riftsaw-distro/jbossesb-4.6/samples/quickstarts/webservice_esb_bpel/bpel/wsdl/BPELRetailer.wsdl"
+ );
- service = new
QName("http://jboss.com/bpel/helloWorld",
"HelloWorldProcessService");
- port = "HelloWorldProcessServicePort";
+ service = new
QName("http://www.jboss.org/samples/bpel/Retailer.wsdl",
"RetailerService");
+ port = "RetailerPort";
SOAPMessageAdapter soapAdapter =new SOAPMessageAdapter(wsdlDefinition, service,
port);
System.out.println("RPC ? "+soapAdapter.isRPC());
- Operation op = WSDLParser.getDocLitOperation(
- service, port, new
QName("http://jboss.com/bpel/helloWorld",
"HelloWorldProcessRequest"), wsdlDefinition
+ WSDLParser parser = new WSDLParser(wsdlDefinition);
+ Operation op = parser.getDocLitOperation(
+ service, port, new
QName("http://www.jboss.org/samples/bpel/CustomerOrder.xsd",
"customerOrder")
);
System.out.println("operation: "+op.getName());
+
+ System.out.println(
+ "URL: " + parser.getServiceLocationURL(service, port)
+ );
}
}
Modified:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WSDLParser.java
===================================================================
---
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WSDLParser.java 2009-11-25
13:26:21 UTC (rev 330)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WSDLParser.java 2009-11-25
13:56:46 UTC (rev 331)
@@ -31,10 +31,57 @@
/**
* WSDL helper class
*/
-public class WSDLParser
+public final class WSDLParser
{
- public static Operation getDocLitOperation(QName service, String port, QName
payloadName, Definition wsdl)
+
+ private Definition wsdlDefinition;
+ private int dfsDepth = 0;
+
+ public WSDLParser(Definition wsdlDefinition)
{
+ this.wsdlDefinition = wsdlDefinition;
+ }
+
+ public void reset()
+ {
+ dfsDepth = 0;
+ }
+
+ public Operation getDocLitOperation(QName service, String port, QName payloadName)
+ {
+ reset();
+ return _getDocLitOperation(this.wsdlDefinition, service, port, payloadName);
+ }
+
+ private Operation _getDocLitOperation(Definition wsdl, QName service, String port,
QName payloadName)
+ {
+ Operation match = null;
+ dfsDepth++;
+
+ if(dfsDepth>50) // easier then retaining references
+ throw new IllegalStateException("Recursive loop detected. DFS depth reached
limit");
+
+ // namespace / java.util.List of imports
+ Map<String, List<Import>> imports = wsdl.getImports();
+ for(String ns : imports.keySet())
+ {
+ List<Import> importNS = imports.get(ns);
+ for(Import wsdlImport : importNS)
+ {
+ Operation result = _getDocLitOperation(wsdlImport.getDefinition(), service, port,
payloadName);
+ if(result!=null)
+ {
+ match = result;
+ break;
+ }
+ }
+
+ if(match!=null) break;
+ }
+
+ if(match!=null) // DFS results
+ return match;
+
// resolve wsdl:message
Map<QName, Message> messages = wsdl.getMessages();
QName relatedMessage = null;
@@ -80,10 +127,41 @@
return relatedOperation;
}
- public static URL getServiceLocationURL(Definition wsdl, QName serviceQName, String
portName)
+ public URL getServiceLocationURL(QName serviceQName, String portName)
{
- URL url = null;
+ reset();
+ return _getServiceLocationURL(this.wsdlDefinition, serviceQName, portName);
+ }
+ public URL _getServiceLocationURL(Definition wsdl, QName serviceQName, String
portName)
+ {
+ URL match = null;
+ dfsDepth++;
+
+ if(dfsDepth>50) // easier then retaining references
+ throw new IllegalStateException("Recursive loop detected. DFS depth reached
limit");
+
+ // namespace / java.util.List of imports
+ Map<String, List<Import>> imports = wsdl.getImports();
+ for(String ns : imports.keySet())
+ {
+ List<Import> importNS = imports.get(ns);
+ for(Import wsdlImport : importNS)
+ {
+ URL result = _getServiceLocationURL(wsdlImport.getDefinition(), serviceQName,
portName);
+ if(result!=null)
+ {
+ match = result;
+ break;
+ }
+ }
+
+ if(match!=null) break;
+ }
+
+ if(match!=null) // DFS results
+ return match;
+
try
{
Service service = wsdl.getService(serviceQName);
@@ -111,13 +189,13 @@
// --
if(soapAddress!=null)
- url = new URL(soapAddress.getLocationURI());
+ match = new URL(soapAddress.getLocationURI());
}
catch (Exception e)
{
throw new RuntimeException("Failed to parse " + wsdl, e);
}
- return url;
+ return match;
}
}