summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/interface-wsdl/src/main
diff options
context:
space:
mode:
authoredwardsmj <edwardsmj@13f79535-47bb-0310-9956-ffa450edef68>2009-05-13 06:17:24 +0000
committeredwardsmj <edwardsmj@13f79535-47bb-0310-9956-ffa450edef68>2009-05-13 06:17:24 +0000
commitf472733832389221175ea1947b52d9e4145b7af4 (patch)
tree049ee9ceb7c0b75b7244ffc5db937f8d4b0e751d /java/sca/modules/interface-wsdl/src/main
parent91a39531fc79bc5d4633294d9af814c59f1ee926 (diff)
Fixes for errors in the processing of <interface.wsdl/> elements, as described in TUSCANY-3019.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@774229 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/interface-wsdl/src/main')
-rw-r--r--java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java60
1 files changed, 47 insertions, 13 deletions
diff --git a/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java b/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java
index c88ec0ef32..cfba9f3519 100644
--- a/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java
+++ b/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java
@@ -101,10 +101,12 @@ public class WSDLInterfaceProcessor implements StAXArtifactProcessor<WSDLInterfa
/**
* Create a WSDL interface from a URI.
- * @param uri
- * @return
+ * @param uri - the URI in the form nameSpace#wsdl.interface(porttypeName) or nameSpace#wsdl.porttype(porttypeName)
+ * @return a WSDLInterface object
* @throws ContributionReadException
*/
+ private static String FRAGMENT_INTERFACE = "wsdl.interface";
+ private static String FRAGMENT_PORTTYPE = "wsdl.porttype";
private WSDLInterface createWSDLInterface(String uri) throws ContributionReadException {
WSDLInterface wsdlInterface = null;
@@ -116,17 +118,43 @@ public class WSDLInterfaceProcessor implements StAXArtifactProcessor<WSDLInterfa
error("InvalidWSDLInterfaceAttr", wsdlFactory, uri);
//throw new ContributionReadException("Invalid WSDL interface attribute: " + uri);
} else {
+ // Read the URI and extract namespace and fragment
+ String namespace = uri.substring(0, index);
+ String name = uri.substring(index + 1);
+ String porttype = null;
+ if( name.contains(FRAGMENT_INTERFACE)) {
+ // Deal with the case where #wsdl.interface is used
+ porttype = name.substring("wsdl.interface(".length(), name.length() - 1);
+ } // end if
+ if( name.contains(FRAGMENT_PORTTYPE)) {
+ // Deal with the case where #wsdl.porttype is used
+ porttype = name.substring("wsdl.porttype(".length(), name.length() - 1);
+ } // end if
+ if( porttype == null ) {
+ error("InvalidWSDLInterfaceAttr", wsdlFactory, uri);
+ return null;
+ } // end if
wsdlInterface = wsdlFactory.createWSDLInterface();
wsdlInterface.setUnresolved(true);
- String namespace = uri.substring(0, index);
- String name = uri.substring(index + 1);
- name = name.substring("wsdl.interface(".length(), name.length() - 1);
- wsdlInterface.setName(new QName(namespace, name));
- }
+ wsdlInterface.setName(new QName(namespace, porttype));
+ } // end if
return wsdlInterface;
- }
+ } // end method createWSDLInterface
+ /**
+ * Creates a WSDLInterfaceContract from a <interface.wsdl/> element in a SCDL file
+ *
+ * The form of the <interface.wsdl/> element is as follows:
+ *
+ * <interface.wsdl interface="http://sampleNamespace#wsdl.interface(porttypeName)"
+ * callbackInterface="http://sampleNamespace#wsdl.porttype(callbackPorttypeName)"/>
+ * where interface = URI pointing to the WSDL document containing a WSDL interface or porttype for the forward call interface
+ * callbackInterface = URI pointing to the WSDL document containing a WSDL interface or porttype for the callback interface
+ *
+ * @param reader - XMLStreamReader holding the <interface.wsdl/> element
+ * @return - the WSDLInterfaceContract
+ */
public WSDLInterfaceContract read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
// Read an <interface.wsdl>
WSDLInterfaceContract wsdlInterfaceContract = wsdlFactory.createWSDLInterfaceContract();
@@ -216,17 +244,23 @@ public class WSDLInterfaceProcessor implements StAXArtifactProcessor<WSDLInterfa
wsdlInterface.setWsdlDefinition(wsdlDefinition);
resolver.addModel(wsdlInterface);
} catch (InvalidInterfaceException e) {
- ContributionResolveException ce = new ContributionResolveException(e);
+ ContributionResolveException ce = new ContributionResolveException("Invalid interface when resolving " +
+ portType.toString(), e);
error("ContributionResolveException", wsdlFactory, ce);
//throw ce;
}
}
else {
warning("WsdlInterfaceDoesNotMatch", wsdlDefinition, wsdlInterface.getName());
- }
- }
- }
- }
+ } // end if
+ } else {
+ // If we get here, the WSDLDefinition is unresolved...
+ ContributionResolveException ce = new ContributionResolveException("WSDLDefinition unresolved " +
+ wsdlInterface.getName().getNamespaceURI() );
+ error("ContributionResolveException", wsdlFactory, ce);
+ }// end if
+ } // end if
+ } // end if
return wsdlInterface;
}