Axis2
  1. Axis2
  2. AXIS2-4952

JAX-WS dynamic ports should be scoped to the service instance the created them

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.6.1, 1.7.0
    • Component/s: jaxws
    • Labels:
      None

      Description

      When a JAX-WS dynamic port is added via addPort(...), it should be scoped to the instance of the service that created it. Currently dynamic ports are scoped in the runtime by (PortQName, Binding ID, Endpoint Address) across all services on a given configuration context. That means that different services will share the same dynamic ports based only on (PortQName, Binding ID, Endpoint Address), even if those services are entirely different (i.e. different service QNames).

      A flag needs to be provided to revert the behavior to share the dynamic ports across services.

        Activity

        Hide
        Hudson added a comment -

        Integrated in axis2-1.6 #66 (See https://builds.apache.org/job/axis2-1.6/66/)
        Merged a bunch of changes to the 1.6 branch as requested by the Geronimo project:

        Revision: 1068985
        AXIS2-4952
        Scope dynamic ports to the instance of the service that did the addPort(...). Add TDD Unit test and flag to revert to previous behavior of sharing dynamic ports across services.

        Revision: 1069659
        Message:
        AXIS2-4938
        Patch submitted by Katherine Sanders. BindingProvider.getEndpointReference should put reference parameters from WSDL in returned EPR.

        Revision: 1069898
        AXIS2-4948
        Patch contributed by Katherine Sanders. Wrong WSDL location returned by BindingProvider; was using the local filesystem path instead of the endpoint URL.

        Revision: 1075057
        Prevent index out of bounds exception, or any exception, from attempting to log. Add TDD/UT for same.

        Revision: 1096530
        On JAX-WS Client, treat local exceptions (e.g. ConnectException) as a SOAPFault, driving the JAX-WS handler handleFault methods and throwing a SOAPFAultException back through the client invocation. Also provide a property to revert to previous behavior of creating an empty message, driving the JAX-WS handler handleMessage methods, and throwing a WebServiceException back through the client invocation.

        Revision: 1096557
        Two changes in JAX-WS Endpoint implementation (1) Override setEndpointContext method, (2) Add logic to throw an exception if endpoint publishing is disabled by a property (publishing is enabled by default); per JSR-109 5.3.3 dynamically publishing endpoints in a server environment is non portable and should be disabled. A server runtime can use the property to disabled dynamically publishing JAX-WS endpoints via Endpoint.publish methods.

        Revision: 1103336
        AXIS2-5021: Committed patch provided by Ivan (xuhaihong).

        Revision: 1136177
        AXIS2-5067: Committed patch provided by Ivan (xuhaihong), with minor changes. This implements the saveChanges method and calculates the correct content type for a SOAPMessage.

        veithen :
        Files :

        • /axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java
        • /axis/axis2/java/core/branches/1_6/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/resourceinjection/sei/ResourceInjectionService.java
        • /axis/axis2/java/core/branches/1_6/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler3.java
        • /axis/axis2/java/core/branches/1_6/modules/jaxws/test/org/apache/axis2/jaxws/WebServiceExceptionLoggerTests.java
        • /axis/axis2/java/core/branches/1_6/modules/jaxws-integration/test-resources/wsdl/resourceinjection.wsdl
        • /axis/axis2/java/core/branches/1_6/modules/jaxws/test/org/apache/axis2/jaxws/client/dispatch/DynamicPortCachingTests.java
        • /axis/axis2/java/core/branches/1_6
        • /axis/axis2/java/core/branches/1_6/modules/metadata/src/org/apache/axis2/jaxws/description/builder/MDQConstants.java
        • /axis/axis2/java/core/branches/1_6/modules/metadata/src/org/apache/axis2/jaxws/ExceptionFactory.java
        • /axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java
        • /axis/axis2/java/core/branches/1_6/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java
        • /axis/axis2/java/core/branches/1_6/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/resourceinjection/sei/ResourceInjectionPortType.java
        • /axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/jaxws/WebServiceExceptionLogger.java
        • /axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/impl/Axis2EndpointReferenceFactoryImpl.java
        • /axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/impl/AxisInvocationController.java
        • /axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/EndpointImpl.java
        • /axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java
        • /axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java
        • /axis/axis2/java/core/branches/1_6/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
        • /axis/axis2/java/core/branches/1_6/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/ResourceInjectionTests.java
        • /axis/axis2/java/core/branches/1_6/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/resourceinjection/ResourceInjectionPortTypeImpl.java
        • /axis/axis2/java/core/branches/1_6/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java
        • /axis/axis2/java/core/branches/1_6/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/resourceinjection/META-INF/resourceinjection.wsdl
        • /axis/axis2/java/core/branches/1_6/modules/jaxws/test/org/apache/axis2/jaxws/client/ReleaseServiceTests.java
        • /axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java
        • /axis/axis2/java/core/branches/1_6/modules/saaj/test/org/apache/axis2/saaj/SOAPMessageTest.java
        • /axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java
        • /axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/jaxws/Constants.java
        • /axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/jaxws/context/WebServiceContextImpl.java
        Show
        Hudson added a comment - Integrated in axis2-1.6 #66 (See https://builds.apache.org/job/axis2-1.6/66/ ) Merged a bunch of changes to the 1.6 branch as requested by the Geronimo project: Revision: 1068985 AXIS2-4952 Scope dynamic ports to the instance of the service that did the addPort(...). Add TDD Unit test and flag to revert to previous behavior of sharing dynamic ports across services. Revision: 1069659 Message: AXIS2-4938 Patch submitted by Katherine Sanders. BindingProvider.getEndpointReference should put reference parameters from WSDL in returned EPR. Revision: 1069898 AXIS2-4948 Patch contributed by Katherine Sanders. Wrong WSDL location returned by BindingProvider; was using the local filesystem path instead of the endpoint URL. Revision: 1075057 Prevent index out of bounds exception, or any exception, from attempting to log. Add TDD/UT for same. Revision: 1096530 On JAX-WS Client, treat local exceptions (e.g. ConnectException) as a SOAPFault, driving the JAX-WS handler handleFault methods and throwing a SOAPFAultException back through the client invocation. Also provide a property to revert to previous behavior of creating an empty message, driving the JAX-WS handler handleMessage methods, and throwing a WebServiceException back through the client invocation. Revision: 1096557 Two changes in JAX-WS Endpoint implementation (1) Override setEndpointContext method, (2) Add logic to throw an exception if endpoint publishing is disabled by a property (publishing is enabled by default); per JSR-109 5.3.3 dynamically publishing endpoints in a server environment is non portable and should be disabled. A server runtime can use the property to disabled dynamically publishing JAX-WS endpoints via Endpoint.publish methods. Revision: 1103336 AXIS2-5021 : Committed patch provided by Ivan (xuhaihong). Revision: 1136177 AXIS2-5067 : Committed patch provided by Ivan (xuhaihong), with minor changes. This implements the saveChanges method and calculates the correct content type for a SOAPMessage. veithen : Files : /axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java /axis/axis2/java/core/branches/1_6/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/resourceinjection/sei/ResourceInjectionService.java /axis/axis2/java/core/branches/1_6/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler3.java /axis/axis2/java/core/branches/1_6/modules/jaxws/test/org/apache/axis2/jaxws/WebServiceExceptionLoggerTests.java /axis/axis2/java/core/branches/1_6/modules/jaxws-integration/test-resources/wsdl/resourceinjection.wsdl /axis/axis2/java/core/branches/1_6/modules/jaxws/test/org/apache/axis2/jaxws/client/dispatch/DynamicPortCachingTests.java /axis/axis2/java/core/branches/1_6 /axis/axis2/java/core/branches/1_6/modules/metadata/src/org/apache/axis2/jaxws/description/builder/MDQConstants.java /axis/axis2/java/core/branches/1_6/modules/metadata/src/org/apache/axis2/jaxws/ExceptionFactory.java /axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java /axis/axis2/java/core/branches/1_6/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java /axis/axis2/java/core/branches/1_6/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/resourceinjection/sei/ResourceInjectionPortType.java /axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/jaxws/WebServiceExceptionLogger.java /axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/impl/Axis2EndpointReferenceFactoryImpl.java /axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/impl/AxisInvocationController.java /axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/EndpointImpl.java /axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java /axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java /axis/axis2/java/core/branches/1_6/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java /axis/axis2/java/core/branches/1_6/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/ResourceInjectionTests.java /axis/axis2/java/core/branches/1_6/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/resourceinjection/ResourceInjectionPortTypeImpl.java /axis/axis2/java/core/branches/1_6/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java /axis/axis2/java/core/branches/1_6/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/resourceinjection/META-INF/resourceinjection.wsdl /axis/axis2/java/core/branches/1_6/modules/jaxws/test/org/apache/axis2/jaxws/client/ReleaseServiceTests.java /axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java /axis/axis2/java/core/branches/1_6/modules/saaj/test/org/apache/axis2/saaj/SOAPMessageTest.java /axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java /axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/jaxws/Constants.java /axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/jaxws/context/WebServiceContextImpl.java
        Hide
        Andreas Veithen added a comment -

        Temporarily reopen the issue to update the fix version (this is not possible on closed issues).

        Show
        Andreas Veithen added a comment - Temporarily reopen the issue to update the fix version (this is not possible on closed issues).
        Hide
        Jeff Barrett added a comment -

        Committed revision 1068985

        Show
        Jeff Barrett added a comment - Committed revision 1068985
        Hide
        Jeff Barrett added a comment -

        Committed revision 1068985

        Show
        Jeff Barrett added a comment - Committed revision 1068985
        Hide
        Jeff Barrett added a comment -

        I have a fix for this Jira. Here are some notes on the fix:

        The flag to revert the behavior to sharing dynamic ports across services is public static final String SHARE_DYNAMIC_PORTS_ACROSS_SERVICES = "jaxws.share.dynamic.ports.enable"; declared in modules/metadata/src/org/apache/axis2/jaxws/description/builder/MDQConstants.java. A value of "true" will revert the behavior; the default value is null which is interpreted as "false". See the javadoc on the field for more information.

        Note that when the dynamic ports are scoped to the instance of the service that created them, it will increase the memory usage, since each dynamic port across different service instances will have context and metadata objects associated with it. Those resources will be released for garbage collection when the service instance goes out of scope. In order to force the release and not rely on finalization of the service instance, there is a non-standard static method that can be called: org.apache.axis2.jaxws.spi.ServiceDelegate.releaseService(Service). See the javadoc of that method for more information. Note that this method has been there for a while; it was not added as part of the fix for this Jira.

        The fix contains TDD Unit Tests to validate the new behavior and that the flag reverts to the old behavior.

        Show
        Jeff Barrett added a comment - I have a fix for this Jira. Here are some notes on the fix: The flag to revert the behavior to sharing dynamic ports across services is public static final String SHARE_DYNAMIC_PORTS_ACROSS_SERVICES = "jaxws.share.dynamic.ports.enable"; declared in modules/metadata/src/org/apache/axis2/jaxws/description/builder/MDQConstants.java. A value of "true" will revert the behavior; the default value is null which is interpreted as "false". See the javadoc on the field for more information. Note that when the dynamic ports are scoped to the instance of the service that created them, it will increase the memory usage, since each dynamic port across different service instances will have context and metadata objects associated with it. Those resources will be released for garbage collection when the service instance goes out of scope. In order to force the release and not rely on finalization of the service instance, there is a non-standard static method that can be called: org.apache.axis2.jaxws.spi.ServiceDelegate.releaseService(Service). See the javadoc of that method for more information. Note that this method has been there for a while; it was not added as part of the fix for this Jira. The fix contains TDD Unit Tests to validate the new behavior and that the flag reverts to the old behavior.

          People

          • Assignee:
            Jeff Barrett
            Reporter:
            Jeff Barrett
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development