summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk/modules')
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java38
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/WSDLHelper.java32
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java14
3 files changed, 71 insertions, 13 deletions
diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java
index 2989ba1445..df2afbefcc 100644
--- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java
+++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java
@@ -1021,11 +1021,10 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
this.uri = in.readUTF();
- this.xml = in.readUTF();
-/*
+ this.xml = in.readUTF();
this.wsdl = in.readUTF();
this.wsdlCallback = in.readUTF();
-*/
+
}
public void writeExternal(ObjectOutput out) throws IOException {
@@ -1039,8 +1038,7 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint
throw new IllegalStateException("No serializer is configured");
}
}
-
-/*
+
if (wsdl == null) {
wsdl = getWsdl();
}
@@ -1049,8 +1047,7 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint
if (wsdlCallback == null) {
wsdlCallback = getWsdlCallback();
}
- out.writeUTF(wsdlCallback);
-*/
+ out.writeUTF(wsdlCallback);
}
public String getAsXML() {
@@ -1065,7 +1062,16 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint
if (ic == null || ic.getInterface() == null || !ic.getInterface().isRemotable()) {
return "";
}
- WSDLInterfaceContract wsdlIC = (WSDLInterfaceContract)getGeneratedWSDLContract(ic);
+
+ WSDLInterfaceContract wsdlIC = null;
+ try {
+ wsdlIC = (WSDLInterfaceContract)getGeneratedWSDLContract(ic);
+ } catch (Exception ex){
+ // ignore WSDL generation errors as the service interface may have
+ // types that can't be converted to XML easily
+ return "";
+ }
+
if (wsdlIC == null) {
return "";
}
@@ -1091,7 +1097,16 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint
if (ic == null || ic.getCallbackInterface() == null || !ic.getCallbackInterface().isRemotable()) {
return "";
}
- WSDLInterfaceContract wsdlIC = (WSDLInterfaceContract)getGeneratedWSDLContract(ic);
+
+ WSDLInterfaceContract wsdlIC = null;
+ try {
+ wsdlIC = (WSDLInterfaceContract)getGeneratedWSDLContract(ic);
+ } catch (Exception ex){
+ // ignore WSDL generation errors as the service interface may have
+ // types that can't be converted to XML easily
+ return "";
+ }
+
if (wsdlIC == null) {
return "";
}
@@ -1139,13 +1154,16 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint
outStream.write(separator);
writer.writeWSDL(importedWSDLDefintion.getDefinition(), outStream);
}
+/* Exclude the XSD for the time being to see if we can get comparison working
+ * with the operation signatures but ignoring parameter types
for (XSDefinition xsdDefinition : wsdlDefinition.getXmlSchemas()){
// we store a reference to the schema schema. We don't need to write that out.
if (!xsdDefinition.getNamespace().equals("http://www.w3.org/2001/XMLSchema") &&
xsdDefinition.getSchema() != null){
writeSchema(outStream, xsdDefinition.getSchema());
}
- }
+ }
+*/
}
/**
diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/WSDLHelper.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/WSDLHelper.java
index 0dfaed6791..c677b99b93 100644
--- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/WSDLHelper.java
+++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/WSDLHelper.java
@@ -40,6 +40,9 @@ import javax.wsdl.Definition;
import javax.wsdl.PortType;
import javax.wsdl.Types;
import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.wsdl.extensions.schema.Schema;
import javax.wsdl.xml.WSDLLocator;
import javax.wsdl.xml.WSDLReader;
@@ -63,6 +66,8 @@ import org.apache.tuscany.sca.xsd.xml.XSDModelResolver;
import org.apache.ws.commons.schema.XmlSchema;
import org.apache.ws.commons.schema.XmlSchemaCollection;
import org.apache.ws.commons.schema.resolver.DefaultURIResolver;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
import org.xml.sax.InputSource;
public class WSDLHelper {
@@ -295,17 +300,38 @@ public class WSDLHelper {
// extract any in-line types in the Tuscany model
Types types = wsdlDefinition.getDefinition().getTypes();
- if ( types != null){
+ if ( types != null){
+/* read XSD from WSDL rather than from registry
for (int i=0; i < types.getExtensibilityElements().size(); i++){
+
String schemaName = xmlString.getBaseURI() + "#" + i++;
XSDInfo xsdInfo = (XSDInfo)xmlMap.get(getFilenameWithoutPath(schemaName));
if (xsdInfo != null){
wsdlDefinition.getXmlSchemas().add(xsdInfo.getXsdDefinition());
}
+*/
+ int index = 0;
+ for (Object ext : types.getExtensibilityElements()) {
+ ExtensibilityElement extElement = (ExtensibilityElement)ext;
+ Element element = null;
+ if (extElement instanceof Schema) {
+ element = ((Schema)extElement).getElement();
+ }
+ if (element != null) {
+ XSDefinition xsDefinition = xsdFactory.createXSDefinition();
+ xsDefinition.setUnresolved(true);
+ xsDefinition.setNamespace(element.getAttribute("targetNamespace"));
+ xsDefinition.setDocument(element.getOwnerDocument());
+ XmlSchema schema = schemaCollection.read(element, null);
+ xsDefinition.setSchema(schema);
+ xsDefinition.setLocation(URI.create(xmlString.getBaseURI() + "#" + index));
+ wsdlDefinition.getXmlSchemas().add(xsDefinition);
+ index++;
+ }
}
}
} else {
- // Schema should already be linked via the schema model
+ // TODO
}
}
@@ -484,5 +510,5 @@ public class WSDLHelper {
return filename.substring(wsdlIndex + 1);
}
// What happens with generated WSDL?
- }
+ }
}
diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
index a61b549489..2a3e466b60 100644
--- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
+++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
@@ -969,11 +969,25 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder {
return true;
}
+/* For testing this code turns off remote interface matching completely
if (endpoint.isRemote()){
matchAudit.append("Match because endpoint is remote");
matchAudit.appendSeperator();
return true;
}
+*/
+
+ // If the remote interface was not retrieved successfully from the registry for whatever reason
+ // then assume the interfaces match and leave the checking until runtime. We looking for an interface
+ // with no operations defined to tell us this.
+ if ((endpointContract.getInterface().getOperations().size() == 0 &&
+ endpointContract.getNormalizedWSDLContract() == null) ||
+ (endpointContract.getNormalizedWSDLContract() != null &&
+ endpointContract.getNormalizedWSDLContract().getInterface().getOperations().size() == 0)){
+ matchAudit.append("Match because the endpoint is remote and we don't have a copy of it's interface contract ");
+ matchAudit.appendSeperator();
+ return true;
+ }
// If the contracts are not of the same type use normailized interfaces
if (endpointReferenceContract.getClass() != endpointContract.getClass() ||