diff options
Diffstat (limited to 'sca-java-2.x')
3 files changed, 39 insertions, 10 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java b/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java index 7cb3b89d48..052a1ced74 100644 --- a/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java +++ b/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java @@ -53,6 +53,7 @@ import org.apache.tuscany.sca.common.xml.stax.StAXHelper; import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.ContributionReadException; import org.apache.tuscany.sca.contribution.processor.ContributionResolveException; +import org.apache.tuscany.sca.contribution.processor.ContributionRuntimeException; import org.apache.tuscany.sca.contribution.processor.ContributionWriteException; import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXAttributeProcessor; import org.apache.tuscany.sca.contribution.processor.ProcessorContext; @@ -135,6 +136,20 @@ public class WebServiceBindingProcessor extends BaseStAXArtifactProcessor implem monitor.problem(problem); } } + + /** + * Report an exception. + * + * @param problem + * @param model + * @param exception + */ + private void error(Monitor monitor, String message, Object model, Exception ex) { + if (monitor != null) { + Problem problem = monitor.createProblem(this.getClass().getName(), "binding-wsxml-validation-messages", Severity.ERROR, model, message, ex); + monitor.problem(problem); + } + } public WebServiceBinding read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException { Monitor monitor = context.getMonitor(); @@ -420,9 +435,16 @@ public class WebServiceBindingProcessor extends BaseStAXArtifactProcessor implem wsdlDefinition.setNameOfBindingToResolve(model.getBindingName()); wsdlDefinition.setNameOfServiceToResolve(model.getServiceName()); wsdlDefinition.getWsdliLocations().putAll(model.getWsdliLocations()); - WSDLDefinition resolved = resolver.resolveModel(WSDLDefinition.class, wsdlDefinition, context); - - if (!resolved.isUnresolved()) { + //WSDLDefinition resolved = resolver.resolveModel(WSDLDefinition.class, wsdlDefinition, context); + WSDLDefinition resolved = null; + try { + resolved = resolver.resolveModel(WSDLDefinition.class, wsdlDefinition, context); + } catch (ContributionRuntimeException e) { + ContributionResolveException ce = new ContributionResolveException(e.getCause()); + error(monitor, "ContributionResolveException", wsdlDefinition, ce); + } + + if (resolved != null && !resolved.isUnresolved()) { wsdlDefinition.setDefinition(resolved.getDefinition()); wsdlDefinition.setLocation(resolved.getLocation()); wsdlDefinition.setURI(resolved.getURI()); @@ -475,14 +497,14 @@ public class WebServiceBindingProcessor extends BaseStAXArtifactProcessor implem WSDLInterface wsdlInterface = null; try { wsdlInterface = wsdlFactory.createWSDLInterface(portType, wsdlDefinition, resolver, context.getMonitor()); - // save the wsdlDefinition that was used to generated the interface + // save the wsdlDefinition that was used to generate the interface wsdlInterface.setWsdlDefinition(wsdlDefinition); + interfaceContract.setInterface(wsdlInterface); + interfaceContract.setCallbackInterface(wsdlInterface.getCallbackInterface()); + model.setBindingInterfaceContract(interfaceContract); } catch (InvalidInterfaceException e) { warning(monitor, "InvalidInterfaceException", wsdlFactory, model.getName(), e.getMessage()); } - interfaceContract.setInterface(wsdlInterface); - interfaceContract.setCallbackInterface(wsdlInterface.getCallbackInterface()); - model.setBindingInterfaceContract(interfaceContract); } validateWSDL(context, model); diff --git a/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java b/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java index 3c550d9781..3baed00daf 100644 --- a/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java +++ b/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java @@ -36,6 +36,7 @@ import org.apache.tuscany.sca.contribution.Artifact; import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.ContributionReadException; import org.apache.tuscany.sca.contribution.processor.ContributionResolveException; +import org.apache.tuscany.sca.contribution.processor.ContributionRuntimeException; import org.apache.tuscany.sca.contribution.processor.ContributionWriteException; import org.apache.tuscany.sca.contribution.processor.ProcessorContext; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; @@ -263,8 +264,14 @@ public class WSDLInterfaceProcessor extends BaseStAXArtifactProcessor implements wsdlDefinition.setUnresolved(true); wsdlDefinition.setNamespace(wsdlInterface.getName().getNamespaceURI()); wsdlDefinition.setNameOfPortTypeToResolve(wsdlInterface.getName()); - WSDLDefinition resolved = resolver.resolveModel(WSDLDefinition.class, wsdlDefinition, context); - if (!resolved.isUnresolved()) { + WSDLDefinition resolved = null; + try { + resolved = resolver.resolveModel(WSDLDefinition.class, wsdlDefinition, context); + } catch (ContributionRuntimeException e) { + ContributionResolveException ce = new ContributionResolveException(e.getCause()); + error(monitor, "ContributionResolveException", wsdlDefinition, ce); + } + if (resolved != null && !resolved.isUnresolved()) { wsdlDefinition.setDefinition(resolved.getDefinition()); wsdlDefinition.setLocation(resolved.getLocation()); wsdlDefinition.setURI(resolved.getURI()); diff --git a/sca-java-2.x/trunk/modules/interface-wsdl/src/main/resources/interface-wsdlxml-validation-messages.properties b/sca-java-2.x/trunk/modules/interface-wsdl/src/main/resources/interface-wsdlxml-validation-messages.properties index 101d9de60c..64c4a1b13e 100644 --- a/sca-java-2.x/trunk/modules/interface-wsdl/src/main/resources/interface-wsdlxml-validation-messages.properties +++ b/sca-java-2.x/trunk/modules/interface-wsdl/src/main/resources/interface-wsdlxml-validation-messages.properties @@ -19,7 +19,7 @@ # # ContributionReadException = ContributionReadException occured due to : {0} -ContributionResolveException = ContributionResolveException occured due to : {0} +ContributionResolveException = Error in contribution : {0} InvalidWSDLInterfaceAttr = Invalid WSDL interface attribute: {0} WsdlInterfaceDoesNotMatch = The WSDL referenced by the interface.wsdl interface as ({0}) cannot be found in this contribution or in any imports that this contribution makes InvalidRemotableValue = The interface.wsdl interface {0} element can only have a remotable attribute with the value "true" as WSDL interface are assumed to be remotable by default. The value that was found is: {1}. |