Modified: incubator/woden/branches/WODEN-40/src/org/apache/woden/internal/util/ComponentModelBuilder.java URL: http://svn.apache.org/viewvc/incubator/woden/branches/WODEN-40/src/org/apache/woden/internal/util/ComponentModelBuilder.java?rev=419889&r1=419888&r2=419889&view=diff ============================================================================== --- incubator/woden/branches/WODEN-40/src/org/apache/woden/internal/util/ComponentModelBuilder.java (original) +++ incubator/woden/branches/WODEN-40/src/org/apache/woden/internal/util/ComponentModelBuilder.java Fri Jul 7 06:39:51 2006 @@ -39,6 +39,7 @@ import org.apache.woden.internal.wsdl20.TypeDefinitionImpl; import org.apache.woden.internal.wsdl20.TypesImpl; import org.apache.woden.internal.wsdl20.extensions.ComponentExtensionsImpl; +import org.apache.woden.internal.wsdl20.extensions.rpc.RPCConstants; import org.apache.woden.wsdl20.Binding; import org.apache.woden.wsdl20.BindingFault; import org.apache.woden.wsdl20.BindingFaultReference; @@ -94,7 +95,11 @@ private List fBindingsDone = new Vector(); private List fServicesDone = new Vector(); - + + private URI fBindingType = null; + + private boolean fIsSoapUnderlyingProtocolHttp = false; + public ComponentModelBuilder(DescriptionImpl desc) { fDesc = desc; // TODO fErrorRpt = errorRpt; see todo in buildElementDeclarations() @@ -262,14 +267,15 @@ } private void buildInterfaceOperationExtensions(InterfaceOperationImpl oper) { + + /* + * Create a ComponentExtensions object for each registered extension + * namespace used within this operation by extension elements or attributes. + */ ExtensionRegistry er = fDesc.getExtensionRegistry(); URI[] extNamespaces = er .queryComponentExtensionNamespaces(InterfaceOperation.class); - /* - * Create a ComponentExtensions object for each registered extension - * namespace used with this binding operation. - */ for (int i = 0; i < extNamespaces.length; i++) { URI extNS = extNamespaces[i]; if (oper.hasExtensionAttributesForNamespace(extNS)) { @@ -278,9 +284,47 @@ oper.setComponentExtensions(extNS, compExt); } } - - // TODO: apply component model default rules if these extensions are - // absent in the XML infoset + + /* + * {safety} is a REQUIRED extension property on interface operation + * so if an InterfaceOperationExtensions object has not already been + * created, create one now. + */ + if (oper.getComponentExtensionsForNamespace( + ComponentExtensions.URI_NS_EXTENSIONS) == null) { + ComponentExtensions compExt = createComponentExtensions( + InterfaceOperation.class, oper, + ComponentExtensions.URI_NS_EXTENSIONS); + oper.setComponentExtensions( + ComponentExtensions.URI_NS_EXTENSIONS, compExt); + } + + /* + * If interface operation style includes RPC then if an + * RPCInterfaceOperationExtensions object has not already been + * created, create one now. + */ + boolean isRPCStyle = false; + URI[] style = oper.getStyle(); + for(int i=0; i<style.length; i++) + { + URI temp = style[i]; + if(RPCConstants.URI_STYLE_RPC.equals(temp)) { + isRPCStyle = true; + break; + } + } + + if(isRPCStyle) { + if (oper.getComponentExtensionsForNamespace( + ComponentExtensions.URI_NS_RPC) == null) { + ComponentExtensions compExt = createComponentExtensions( + InterfaceOperation.class, oper, + ComponentExtensions.URI_NS_RPC); + oper.setComponentExtensions( + ComponentExtensions.URI_NS_RPC, compExt); + } + } } /*************************************************************************** @@ -296,9 +340,9 @@ for (int i = 0; i < bindingEls.length; i++) { BindingImpl bindImpl = (BindingImpl) bindingEls[i]; if (!fBindingsDone.contains(bindImpl)) { + buildBindingExtensions(bindImpl); buildBindingFaults(bindImpl); buildBindingOperations(bindImpl); - buildBindingExtensions(bindImpl); fBindingsDone.add(bindImpl); } } @@ -345,14 +389,15 @@ } private void buildBindingExtensions(BindingImpl binding) { + + /* + * Create a ComponentExtensions object for each registered extension + * namespace used within this binding by extension elements or attributes. + */ ExtensionRegistry er = fDesc.getExtensionRegistry(); URI[] extNamespaces = er .queryComponentExtensionNamespaces(Binding.class); - /* - * First, create a ComponentExtensions object for each registered - * extension namespace used with this binding. - */ for (int i = 0; i < extNamespaces.length; i++) { URI extNS = extNamespaces[i]; if (binding.hasExtensionAttributesForNamespace(extNS) @@ -374,10 +419,12 @@ * interpreted here at run time. */ if (ComponentExtensions.URI_NS_SOAP.equals(binding.getType())) { + + fBindingType = ComponentExtensions.URI_NS_SOAP; + /* - * If the binding type is SOAP, the {soap version} property defaults - * to "1.2" so if a a SOAPBindingExtensions object has not already - * been created, create one now to handle this default value. + * If the binding type is SOAP and a SOAPBindingExtensions object has + * not already been created, create one now. */ if (binding .getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_SOAP) == null) { @@ -392,12 +439,13 @@ if (ComponentExtensions.URI_NS_HTTP.equals(sbe .getSoapUnderlyingProtocol())) { + + fIsSoapUnderlyingProtocolHttp = true; + /* - * If the binding type is SOAP and the {soap underlying - * protocol} property is HTTP, then the {http version} property - * defaults to "1.1" so if an HTTPBindingExtensions object has - * not already been created, create one now to handle this - * default value. + * If the binding type is SOAP and the {soap underlying protocol} + * property is HTTP, then if an HTTPBindingExtensions object has + * not already been created, create one now. */ if (binding .getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_HTTP) == null) { @@ -411,11 +459,12 @@ } if (ComponentExtensions.URI_NS_HTTP.equals(binding.getType())) { + + fBindingType = ComponentExtensions.URI_NS_HTTP; + /* - * If the binding type is HTTP, the Binding extension properties - * {http query parameter separator default} and {http cookies} are - * REQUIRED so if an HTTPBindingExtensions object has not already - * been created, create one now to handle their default values. + * If the binding type is HTTP, then if an HTTPBindingExtensions + * object has not already been created, create one now. */ if (binding .getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_HTTP) == null) { @@ -429,14 +478,16 @@ } private void buildBindingFaultExtensions(BindingFaultImpl bindFault) { + + /* + * Create a ComponentExtensions object for each registered extension + * namespace used within this binding fault by extension elements + * or attributes. + */ ExtensionRegistry er = fDesc.getExtensionRegistry(); URI[] extNamespaces = er .queryComponentExtensionNamespaces(BindingFault.class); - /* - * First, create a ComponentExtensions object for each registered - * extension namespace used with this binding fault. - */ for (int i = 0; i < extNamespaces.length; i++) { URI extNS = extNamespaces[i]; if (bindFault.hasExtensionAttributesForNamespace(extNS) @@ -457,14 +508,10 @@ * HTTP or user-defined extensions can be registered in some way and * interpreted here at run time. */ - URI bindingType = ((BindingElement) bindFault.getParentElement()) - .getType(); - if (ComponentExtensions.URI_NS_SOAP.equals(bindingType)) { + if (ComponentExtensions.URI_NS_SOAP.equals(fBindingType)) { /* - * If the binding type is SOAP, the {soap fault code} and {soap - * fault subcodes} properties default to xs:token "#any", so if a - * SOAPBindingFaultExtensions object has not already been created, - * create one now to handle these default values. + * If the binding type is SOAP and a SOAPBindingFaultExtensions object + * has not already been created, create one now. */ if (bindFault .getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_SOAP) == null) { @@ -474,16 +521,28 @@ bindFault.setComponentExtensions( ComponentExtensions.URI_NS_SOAP, compExt); } + + if (fIsSoapUnderlyingProtocolHttp) { + /* + * If the binding type is SOAP and the {soap underlying protocol} + * property is HTTP, then if an HTTPBindingFaultExtensions object + * has not already been created, create one now. + */ + if (bindFault + .getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_HTTP) == null) { + ComponentExtensions compExt = createComponentExtensions( + BindingFault.class, bindFault, + ComponentExtensions.URI_NS_HTTP); + bindFault.setComponentExtensions( + ComponentExtensions.URI_NS_HTTP, compExt); + } + } } - if (ComponentExtensions.URI_NS_HTTP.equals(bindingType)) { + if (ComponentExtensions.URI_NS_HTTP.equals(fBindingType)) { /* - * If the binding type is HTTP, the BindingFault extension property - * {http error status code}, {http output serialization}, {http - * fault serialization} and {http location ignore uncited} are - * REQUIRED so if an HTTPBindingFaultExtensions object has not - * already been created, create one now to handle their default - * values. + * If the binding type is HTTP and an HTTPBindingFaultExtensions object + * has not already been created, create one now. */ if (bindFault .getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_HTTP) == null) { @@ -498,14 +557,16 @@ } private void buildBindingOperationExtensions(BindingOperationImpl bindOper) { + + /* + * Create a ComponentExtensions object for each registered extension + * namespace used within this binding operation by extension elements + * or attributes. + */ ExtensionRegistry er = fDesc.getExtensionRegistry(); URI[] extNamespaces = er .queryComponentExtensionNamespaces(BindingOperation.class); - /* - * First, create a ComponentExtensions object for each registered - * extension namespace used with this binding operation. - */ for (int i = 0; i < extNamespaces.length; i++) { URI extNS = extNamespaces[i]; if (bindOper.hasExtensionAttributesForNamespace(extNS) @@ -526,16 +587,41 @@ * HTTP or user-defined extensions can be registered in some way and * interpreted here at run time. */ - URI bindingType = ((BindingElement) bindOper.getParentElement()) - .getType(); - if (ComponentExtensions.URI_NS_HTTP.equals(bindingType)) { + if (ComponentExtensions.URI_NS_SOAP.equals(fBindingType)) { + /* + * If the binding type is SOAP and a SOAPBindingOperationExtensions object + * has not already been created, create one now. + */ + if (bindOper + .getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_SOAP) == null) { + ComponentExtensions compExt = createComponentExtensions( + BindingOperation.class, bindOper, + ComponentExtensions.URI_NS_SOAP); + bindOper.setComponentExtensions( + ComponentExtensions.URI_NS_SOAP, compExt); + } + + if (fIsSoapUnderlyingProtocolHttp) { + /* + * If the binding type is SOAP and the {soap underlying protocol} + * property is HTTP, then if an HTTPBindingOperationExtensions object + * has not already been created, create one now. + */ + if (bindOper + .getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_HTTP) == null) { + ComponentExtensions compExt = createComponentExtensions( + BindingOperation.class, bindOper, + ComponentExtensions.URI_NS_HTTP); + bindOper.setComponentExtensions( + ComponentExtensions.URI_NS_HTTP, compExt); + } + } + } + + if (ComponentExtensions.URI_NS_HTTP.equals(fBindingType)) { /* - * If the binding type is HTTP, the BindingOperation extension - * properties {http input serialization}, {http output - * serialization}, {http fault serialization} and {http location - * ignore uncited} are REQUIRED so if an - * HTTPBindingOperationExtensions object has not already been - * created, create one now to handle their default values. + * If the binding type is HTTP and an HTTPBindingOperationExtensions + * object has not already been created, create one now. */ if (bindOper .getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_HTTP) == null) { @@ -550,19 +636,16 @@ private void buildBindingMessageReferenceExtensions( BindingMessageReferenceImpl bindMsgRef) { + + /* + * Create a ComponentExtensions object for each registered extension + * namespace used within this binding message reference by extension + * elements or attributes. + */ ExtensionRegistry er = fDesc.getExtensionRegistry(); URI[] extNamespaces = er .queryComponentExtensionNamespaces(BindingMessageReference.class); - /* - * Create a ComponentExtensions object for each registered - * extension namespace used with this binding message reference. - * - * This component does not have any REQUIRED extension properties, - * so no ComponentExtensions will be created automatically (i.e. to - * handle default values where REQUIRED extensions are omitted from - * the WSDL) - */ for (int i = 0; i < extNamespaces.length; i++) { URI extNS = extNamespaces[i]; if (bindMsgRef.hasExtensionAttributesForNamespace(extNS) @@ -572,10 +655,62 @@ bindMsgRef.setComponentExtensions(extNS, compExt); } } + + if (ComponentExtensions.URI_NS_SOAP.equals(fBindingType)) { + /* + * If the binding type is SOAP and a SOAPBindingMessageReferenceExtensions + * object has not already been created, create one now. + */ + if (bindMsgRef + .getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_SOAP) == null) { + ComponentExtensions compExt = createComponentExtensions( + BindingMessageReference.class, bindMsgRef, + ComponentExtensions.URI_NS_SOAP); + bindMsgRef.setComponentExtensions( + ComponentExtensions.URI_NS_SOAP, compExt); + } + + if (fIsSoapUnderlyingProtocolHttp) { + /* + * If the binding type is SOAP and the {soap underlying protocol} + * property is HTTP, then if an HTTPBindingMessageReferenceExtensions + * object has not already been created, create one now. + */ + if (bindMsgRef + .getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_HTTP) == null) { + ComponentExtensions compExt = createComponentExtensions( + BindingMessageReference.class, bindMsgRef, + ComponentExtensions.URI_NS_HTTP); + bindMsgRef.setComponentExtensions( + ComponentExtensions.URI_NS_HTTP, compExt); + } + } + } + + if (ComponentExtensions.URI_NS_HTTP.equals(fBindingType)) { + /* + * If the binding type is HTTP and an HTTPBindingMessageReferenceExtensions + * object has not already been created, create one now. + */ + if (bindMsgRef + .getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_HTTP) == null) { + ComponentExtensions compExt = createComponentExtensions( + BindingMessageReference.class, bindMsgRef, + ComponentExtensions.URI_NS_HTTP); + bindMsgRef.setComponentExtensions( + ComponentExtensions.URI_NS_HTTP, compExt); + } + } } private void buildBindingFaultReferenceExtensions( BindingFaultReferenceImpl bindFaultRef) { + + /* + * Create a ComponentExtensions object for each registered extension + * namespace used within this binding message reference by extension + * elements or attributes. + */ ExtensionRegistry er = fDesc.getExtensionRegistry(); URI[] extNamespaces = er .queryComponentExtensionNamespaces(BindingFaultReference.class); @@ -589,6 +724,21 @@ bindFaultRef.setComponentExtensions(extNS, compExt); } } + + if (ComponentExtensions.URI_NS_SOAP.equals(fBindingType)) { + /* + * If the binding type is SOAP and a SOAPBindingFaultReferenceExtensions + * object has not already been created, create one now. + */ + if (bindFaultRef + .getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_SOAP) == null) { + ComponentExtensions compExt = createComponentExtensions( + BindingFaultReference.class, bindFaultRef, + ComponentExtensions.URI_NS_SOAP); + bindFaultRef.setComponentExtensions( + ComponentExtensions.URI_NS_SOAP, compExt); + } + } } private void buildServices(DescriptionImpl desc) { @@ -614,14 +764,15 @@ private void buildEndpointExtensions(EndpointImpl endpoint) { + /* + * Create a ComponentExtensions object for each registered extension + * namespace used within this endpoint by extension + * elements or attributes. + */ ExtensionRegistry er = fDesc.getExtensionRegistry(); URI[] extNamespaces = er .queryComponentExtensionNamespaces(Endpoint.class); - /* - * Create a ComponentExtensions object for each registered - * extension namespace used with this endpoint. - */ for (int i = 0; i < extNamespaces.length; i++) { URI extNS = extNamespaces[i]; if (endpoint.hasExtensionAttributesForNamespace(extNS) @@ -631,7 +782,27 @@ endpoint.setComponentExtensions(extNS, compExt); } } - + + if ((ComponentExtensions.URI_NS_SOAP.equals(fBindingType) && + fIsSoapUnderlyingProtocolHttp) + || + ComponentExtensions.URI_NS_HTTP.equals(fBindingType)) { + + /* + * If the binding type is SOAP and the {soap underlying protocol} + * property is HTTP or if the binding type is HTTP, then if an + * HTTPEndpointExtensions object has not already been created, + * create one now. + */ + if (endpoint + .getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_HTTP) == null) { + ComponentExtensions compExt = createComponentExtensions( + Endpoint.class, endpoint, + ComponentExtensions.URI_NS_HTTP); + endpoint.setComponentExtensions( + ComponentExtensions.URI_NS_HTTP, compExt); + } + } } /*
Modified: incubator/woden/branches/WODEN-40/src/org/apache/woden/internal/wsdl20/extensions/http/HTTPBindingOperationExtensionsImpl.java URL: http://svn.apache.org/viewvc/incubator/woden/branches/WODEN-40/src/org/apache/woden/internal/wsdl20/extensions/http/HTTPBindingOperationExtensionsImpl.java?rev=419889&r1=419888&r2=419889&view=diff ============================================================================== --- incubator/woden/branches/WODEN-40/src/org/apache/woden/internal/wsdl20/extensions/http/HTTPBindingOperationExtensionsImpl.java (original) +++ incubator/woden/branches/WODEN-40/src/org/apache/woden/internal/wsdl20/extensions/http/HTTPBindingOperationExtensionsImpl.java Fri Jul 7 06:39:51 2006 @@ -204,21 +204,7 @@ StringAttr separator = (StringAttr) ((WSDLElement) fParent) .getExtensionAttribute(HTTPConstants.Q_ATTR_QUERY_PARAMETER_SEPARATOR); - if (separator != null) { - return separator.getString(); - } - - //As per Part 2, 6.7.2.2.1 Construction of the query string, the - //default is Binding {http query parameter separator default}. - - Binding binding = (Binding) ((BindingOperation) fParent).getParent(); - - HTTPBindingExtensions httpBindExts = (HTTPBindingExtensions) binding - .getComponentExtensionsForNamespace(HTTPConstants.NS_URI_HTTP); - - //No need for null check on httpBindExts because it has REQUIRED - //properties, so it must be present. - return httpBindExts.getHttpQueryParameterSeparatorDefault(); + return separator != null ? separator.getString() : null; } /* Modified: incubator/woden/branches/WODEN-40/src/org/apache/woden/internal/wsdl20/extensions/rpc/RPCConstants.java URL: http://svn.apache.org/viewvc/incubator/woden/branches/WODEN-40/src/org/apache/woden/internal/wsdl20/extensions/rpc/RPCConstants.java?rev=419889&r1=419888&r2=419889&view=diff ============================================================================== --- incubator/woden/branches/WODEN-40/src/org/apache/woden/internal/wsdl20/extensions/rpc/RPCConstants.java (original) +++ incubator/woden/branches/WODEN-40/src/org/apache/woden/internal/wsdl20/extensions/rpc/RPCConstants.java Fri Jul 7 06:39:51 2006 @@ -16,6 +16,8 @@ package org.apache.woden.internal.wsdl20.extensions.rpc; +import java.net.URI; + import javax.xml.namespace.QName; /** @@ -32,6 +34,7 @@ // Style URI public static final String STYLE_URI_RPC = "http://www.w3.org/2006/01/wsdl/style/rpc"; + public static final URI URI_STYLE_RPC = URI.create("http://www.w3.org/2006/01/wsdl/style/rpc"); // Attribute name Modified: incubator/woden/branches/WODEN-40/test/org/apache/woden/wsdl20/extensions/http/HTTPBindingMessageReferenceExtensionsTest.java URL: http://svn.apache.org/viewvc/incubator/woden/branches/WODEN-40/test/org/apache/woden/wsdl20/extensions/http/HTTPBindingMessageReferenceExtensionsTest.java?rev=419889&r1=419888&r2=419889&view=diff ============================================================================== --- incubator/woden/branches/WODEN-40/test/org/apache/woden/wsdl20/extensions/http/HTTPBindingMessageReferenceExtensionsTest.java (original) +++ incubator/woden/branches/WODEN-40/test/org/apache/woden/wsdl20/extensions/http/HTTPBindingMessageReferenceExtensionsTest.java Fri Jul 7 06:39:51 2006 @@ -157,29 +157,4 @@ } - /** - * Test that an HTTPBindingMessageReferenceExtensions object is not created - * for a binding operation wsdl:input or wsdl:output message that does not - * contain any HTTP extension extension attributes or elements (i.e. the - * HTTP extension properties are OPTIONAL in the spec, so even though - * {http transfer coding} defaults to {http transfer coding default} in - * BindingOperation, it will not be present if the underlying message ref - * element has not HTTP extensions). - */ - public void testOptional() { - - BindingMessageReference[] bindMsgRefs = fBindOpers[1].getBindingMessageReferences(); - assertEquals("The second BindingOperation should contain 1 BindingMessageReference components.", 1, bindMsgRefs.length); - - BindingMessageReference inputMsg = bindMsgRefs[0]; - HTTPBindingMessageReferenceExtensions httpBindMsgRefExts = - (HTTPBindingMessageReferenceExtensions) inputMsg - .getComponentExtensionsForNamespace( - ComponentExtensions.URI_NS_HTTP); - - assertNull("The BindingMessageReference contained an " + - "HTTPBindingMessageReferenceExtensions object.", - httpBindMsgRefExts); - } - } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
