diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-12-14 13:11:02 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-12-14 13:11:02 +0000 |
commit | 37950aec04c2abce05e16d676ca97b4514ecff22 (patch) | |
tree | 20fe0a568527f6d1f995337065dc1eb6c0f8eaba /sca-java-2.x/trunk/modules/binding-ws/src | |
parent | c22ac2250370b95585d5b6c99a7f3eef1c2caede (diff) |
TUSCANY-2698 - merge changes from 1.x to 2.x. Only some of the changes merged as some affect error messages and cause otests to fail for only aesthetic reasons.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1214230 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-ws/src')
-rw-r--r-- | sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java | 36 |
1 files changed, 29 insertions, 7 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); |