diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-07-02 15:12:28 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-07-02 15:12:28 +0000 |
commit | fccdd6a87c4e9961153eb52e9b2b9f614ebb9724 (patch) | |
tree | a8a4640744c6babc2f54751ecd4e561c9b7b73c6 /sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingImpl.java | |
parent | 8a38be79d254e187d4313fe68692551b2f735e10 (diff) |
More changes to fix binding.s otests. Also change binding.ws model getter/setter to make it more explicit which of the WSDLs it stores are user defined.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@960020 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingImpl.java')
-rw-r--r-- | sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingImpl.java | 55 |
1 files changed, 45 insertions, 10 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingImpl.java b/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingImpl.java index 544e543c88..9cda2978d3 100644 --- a/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingImpl.java +++ b/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingImpl.java @@ -138,10 +138,9 @@ class WebServiceBindingImpl implements WebServiceBinding, PolicySubject, Extensi public Binding getBinding() { if (binding == null) { - if (getWSDLDefinition() != null && wsdlDefinition.getBinding() != null) { + if (getUserSpecifiedWSDLDefinition() != null && wsdlDefinition.getBinding() != null) { binding = wsdlDefinition.getBinding(); - setIsDocumentStyle(); - setIsLiteralEncoding(); + determineWSDLCharacteristics(); } } return binding; @@ -202,8 +201,7 @@ class WebServiceBindingImpl implements WebServiceBinding, PolicySubject, Extensi public void setBinding(Binding binding) { this.binding = binding; - setIsDocumentStyle(); - setIsLiteralEncoding(); + determineWSDLCharacteristics(); } public void setBindingName(QName bindingName) { @@ -246,7 +244,7 @@ class WebServiceBindingImpl implements WebServiceBinding, PolicySubject, Extensi this.serviceName = serviceName; } - public WSDLDefinition getWSDLDefinition() { + public WSDLDefinition getUserSpecifiedWSDLDefinition() { if (wsdlDefinition == null) { Interface iface = bindingInterfaceContract.getInterface(); if (iface instanceof WSDLInterface) { @@ -256,7 +254,7 @@ class WebServiceBindingImpl implements WebServiceBinding, PolicySubject, Extensi return wsdlDefinition; } - public void setDefinition(WSDLDefinition wsdlDefinition) { + public void setUserSpecifiedWSDLDefinition(WSDLDefinition wsdlDefinition) { this.wsdlDefinition = wsdlDefinition; } @@ -306,8 +304,7 @@ class WebServiceBindingImpl implements WebServiceBinding, PolicySubject, Extensi public void setGeneratedWSDLDocument(Definition definition) { this.generatedWSDLDocument = definition; - setIsDocumentStyle(); - setIsLiteralEncoding(); + determineWSDLCharacteristics(); } public QName getType() { @@ -335,6 +332,16 @@ class WebServiceBindingImpl implements WebServiceBinding, PolicySubject, Extensi public void setOperationSelector(OperationSelector operationSelector) { } + /** + * Some items get calculated and cached as they are used are runtime + * to decide what message processing is required + */ + protected void determineWSDLCharacteristics() { + setIsDocumentStyle(); + setIsLiteralEncoding(); + setIsMessageWrapped(); + } + protected void setIsDocumentStyle() { if (binding == null){ @@ -392,7 +399,9 @@ class WebServiceBindingImpl implements WebServiceBinding, PolicySubject, Extensi } protected void setIsMessageWrapped() { - isMessageWrapped = getBindingInterfaceContract().getInterface().getOperations().get(0).isWrapperStyle(); + if (getBindingInterfaceContract() != null){ + isMessageWrapped = getBindingInterfaceContract().getInterface().getOperations().get(0).isWrapperStyle(); + } } public boolean isRpcEncoded() { @@ -416,4 +425,30 @@ class WebServiceBindingImpl implements WebServiceBinding, PolicySubject, Extensi setIsMessageWrapped(); return (isDocumentStyle) && (isLiteralEncoding) &&(isMessageWrapped); } + + public boolean isDocLiteralBare() { + setIsMessageWrapped(); + return (isDocumentStyle) && (isLiteralEncoding); + } + + public boolean isHTTPTransport() { + return getBindingTransport().equals("http://schemas.xmlsoap.org/soap/http"); + } + + public boolean isJMSTransport() { + return getBindingTransport().equals("http://schemas.xmlsoap.org/soap/jms"); + } + + public String getBindingTransport() { + if (binding != null){ + for (Object ext : binding.getExtensibilityElements()){ + if (ext instanceof SOAPBinding){ + return ((SOAPBinding)ext).getTransportURI(); + } + } + } + + // if no binding is explicitly specified by the user then default to http + return "http://schemas.xmlsoap.org/soap/http"; + } } |