From bdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a Mon Sep 17 00:00:00 2001 From: dims Date: Tue, 17 Jun 2008 00:23:01 +0000 Subject: Move Tuscany from Incubator to top level. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/1.0/modules/binding-ws-axis2/DISCLAIMER | 8 + tags/java/sca/1.0/modules/binding-ws-axis2/LICENSE | 205 ++++++++ tags/java/sca/1.0/modules/binding-ws-axis2/NOTICE | 6 + tags/java/sca/1.0/modules/binding-ws-axis2/pom.xml | 310 ++++++++++++ .../sca/binding/ws/axis2/Axis2BindingInvoker.java | 188 ++++++++ .../ws/axis2/Axis2BindingProviderFactory.java | 63 +++ .../ws/axis2/Axis2OneWayBindingInvoker.java | 59 +++ .../ws/axis2/Axis2ReferenceBindingProvider.java | 81 ++++ .../ws/axis2/Axis2ServiceBindingProvider.java | 77 +++ .../sca/binding/ws/axis2/Axis2ServiceClient.java | 350 ++++++++++++++ .../ws/axis2/Axis2ServiceInMessageReceiver.java | 61 +++ .../Axis2ServiceInOutSyncMessageReceiver.java | 86 ++++ .../sca/binding/ws/axis2/Axis2ServiceProvider.java | 537 +++++++++++++++++++++ .../sca/binding/ws/axis2/Axis2ServiceServlet.java | 297 ++++++++++++ .../sca/binding/ws/axis2/Java2WSDLHelper.java | 384 +++++++++++++++ .../binding/ws/axis2/TuscanyAxisConfigurator.java | 173 +++++++ .../sca/binding/ws/axis2/TuscanyDispatcher.java | 103 ++++ .../sca/binding/ws/axis2/TuscanyListingAgent.java | 411 ++++++++++++++++ ...che.tuscany.sca.provider.BindingProviderFactory | 19 + .../sca/binding/ws/axis2/engine/config/axis2.xml | 478 ++++++++++++++++++ .../ws/axis2/engine/config/modules/modules.list | 1 + .../ws/axis2/engine/config/modules/rampart-1.3.mar | Bin 0 -> 2704 bytes .../ws/axis2/engine/config/services/services.list | 0 .../binding/ws/axis2/Axis2ReferenceTestCase.java | 83 ++++ .../sca/binding/ws/axis2/Axis2ServiceTestCase.java | 104 ++++ .../tuscany/sca/binding/ws/axis2/Greeter.java | 31 ++ .../sca/binding/ws/axis2/GreetingCallback.java | 24 + .../binding/ws/axis2/Java2WSDLHelperTestCase.java | 75 +++ .../tuscany/sca/binding/ws/axis2/itests/Bar.java | 58 +++ .../tuscany/sca/binding/ws/axis2/itests/Echo.java | 29 ++ .../sca/binding/ws/axis2/itests/EchoComponent.java | 33 ++ .../sca/binding/ws/axis2/itests/EchoImpl.java | 29 ++ .../tuscany/sca/binding/ws/axis2/itests/Foo.java | 36 ++ .../sca/binding/ws/axis2/itests/HelloWorld.java | 29 ++ .../ws/axis2/itests/HelloWorldComponent.java | 33 ++ .../ws/axis2/itests/HelloWorldMultiService.java | 51 ++ .../ws/axis2/itests/HelloWorldNoWSDLTestCase.java | 77 +++ .../sca/binding/ws/axis2/itests/HelloWorldOM.java | 30 ++ .../sca/binding/ws/axis2/itests/HelloWorldOM2.java | 30 ++ .../ws/axis2/itests/HelloWorldOMComponent.java | 34 ++ .../ws/axis2/itests/HelloWorldOMService.java | 40 ++ .../ws/axis2/itests/HelloWorldOMTestCase.java | 58 +++ .../binding/ws/axis2/itests/HelloWorldService.java | 28 ++ .../ws/axis2/itests/HelloWorldTestCase.java | 46 ++ .../itests/HelloWorldWSDLMergedTestCaseFIXME.java | 58 +++ .../ws/axis2/itests/QuestionMarkWSDLTestCase.java | 100 ++++ .../endpoints/AbstractHelloWorldOMTestCase.java | 64 +++ .../endpoints/DefaultMultiServiceTestCase.java | 24 + .../endpoints/DefaultSingleServiceTestCase.java | 24 + .../itests/endpoints/WSDLExplicitURITestCase.java | 24 + .../itests/endpoints/WSDLRelativeURITestCase.java | 24 + .../ws/axis2/itests/epr/HelloWorldTestCase.java | 47 ++ .../policy/AbstractHelloWorldOMTestCase.java | 64 +++ .../ws/axis2/itests/policy/ClientPWCBHandler.java | 43 ++ .../axis2/itests/policy/IntegrityPWCBHandler.java | 43 ++ .../ws/axis2/itests/policy/ServerPWCBHandler.java | 43 ++ .../policy/WSSecurityAuthenticationTestCase.java | 24 + ...onfidentialityTestCaseFIXBouncyCastleIssue.java | 42 ++ .../itests/policy/WSSecurityIntegrityTestCase.java | 24 + .../itests/soap12/HelloWorldSOAP12TestCase.java | 58 +++ .../itests/soap12/QuestionMarkWSDLTestCase.java | 121 +++++ .../src/test/resources/definitions.xml | 152 ++++++ .../binding/ws/axis2/itests/HelloWorld.composite | 50 ++ .../ws/axis2/itests/HelloWorldNoWSDL.composite | 60 +++ .../itests/endpoints/DefaultMultiService.composite | 51 ++ .../endpoints/DefaultSingleService.composite | 51 ++ .../itests/endpoints/WSDLExplicitURI.composite | 49 ++ .../itests/endpoints/WSDLRelativeURI.composite | 49 ++ .../endpoints/helloworld-om-relative-uri.wsdl | 78 +++ .../ws/axis2/itests/epr/HelloWorld.composite | 50 ++ .../ws/axis2/itests/helloworld-om-binding.wsdl | 45 ++ .../ws/axis2/itests/helloworld-om-merged.composite | 43 ++ .../ws/axis2/itests/helloworld-om-porttype.wsdl | 59 +++ .../binding/ws/axis2/itests/helloworld-om-uri.wsdl | 78 +++ .../ws/axis2/itests/helloworld-om.composite | 44 ++ .../sca/binding/ws/axis2/itests/helloworld-om.wsdl | 78 +++ .../sca/binding/ws/axis2/itests/helloworld.wsdl | 80 +++ .../policy/WSSecurityAuthentication.composite | 49 ++ .../policy/WSSecurityConfidentiality.composite | 49 ++ .../itests/policy/WSSecurityIntegrity.composite | 49 ++ .../ws/axis2/itests/policy/security.properties | 4 + .../binding/ws/axis2/itests/policy/tuscanyKeys.jks | Bin 0 -> 1365 bytes .../ws/axis2/itests/questionmark-wsdl.composite | 36 ++ .../axis2/itests/soap12/HelloWorldSOAP12.composite | 71 +++ .../itests/soap12/questionmark-wsdl.composite | 40 ++ 85 files changed, 6997 insertions(+) create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/DISCLAIMER create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/LICENSE create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/NOTICE create mode 100755 tags/java/sca/1.0/modules/binding-ws-axis2/pom.xml create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingProviderFactory.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2OneWayBindingInvoker.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceBindingProvider.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInMessageReceiver.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInOutSyncMessageReceiver.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceServlet.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Java2WSDLHelper.java create mode 100755 tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyAxisConfigurator.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyDispatcher.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyListingAgent.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory create mode 100755 tags/java/sca/1.0/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/modules.list create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/rampart-1.3.mar create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/services/services.list create mode 100755 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceTestCase.java create mode 100755 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceTestCase.java create mode 100755 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Greeter.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/GreetingCallback.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Java2WSDLHelperTestCase.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Bar.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Echo.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/EchoComponent.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/EchoImpl.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Foo.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldComponent.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldMultiService.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDLTestCase.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOM.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOM2.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMComponent.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMService.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMTestCase.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldService.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldTestCase.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldWSDLMergedTestCaseFIXME.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/AbstractHelloWorldOMTestCase.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultMultiServiceTestCase.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultSingleServiceTestCase.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLExplicitURITestCase.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLRelativeURITestCase.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorldTestCase.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/AbstractHelloWorldOMTestCase.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/ClientPWCBHandler.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/IntegrityPWCBHandler.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/ServerPWCBHandler.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurityAuthenticationTestCase.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurityConfidentialityTestCaseFIXBouncyCastleIssue.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurityIntegrityTestCase.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12TestCase.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/QuestionMarkWSDLTestCase.java create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/definitions.xml create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.composite create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDL.composite create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultMultiService.composite create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultSingleService.composite create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLExplicitURI.composite create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLRelativeURI.composite create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/helloworld-om-relative-uri.wsdl create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorld.composite create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-binding.wsdl create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-merged.composite create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-porttype.wsdl create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-uri.wsdl create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.composite create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.wsdl create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld.wsdl create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurityAuthentication.composite create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurityConfidentiality.composite create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurityIntegrity.composite create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/security.properties create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/tuscanyKeys.jks create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl.composite create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12.composite create mode 100644 tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/questionmark-wsdl.composite (limited to 'tags/java/sca/1.0/modules/binding-ws-axis2') diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/DISCLAIMER b/tags/java/sca/1.0/modules/binding-ws-axis2/DISCLAIMER new file mode 100644 index 0000000000..d68a410903 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/DISCLAIMER @@ -0,0 +1,8 @@ +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is +required of all newly accepted projects until a further review indicates that +the infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of the +code, it does indicate that the project has yet to be fully endorsed by the ASF. + diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/LICENSE b/tags/java/sca/1.0/modules/binding-ws-axis2/LICENSE new file mode 100644 index 0000000000..8aa906c321 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/LICENSE @@ -0,0 +1,205 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + + diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/NOTICE b/tags/java/sca/1.0/modules/binding-ws-axis2/NOTICE new file mode 100644 index 0000000000..94481d6cfa --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/NOTICE @@ -0,0 +1,6 @@ +${pom.name} +Copyright (c) 2005 - 2007 The Apache Software Foundation + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/pom.xml b/tags/java/sca/1.0/modules/binding-ws-axis2/pom.xml new file mode 100755 index 0000000000..a9d3774a4d --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/pom.xml @@ -0,0 +1,310 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-modules + 1.0-incubating + ../pom.xml + + + tuscany-binding-ws-axis2 + Apache Tuscany SCA Axis2-based WS Binding Extension + + + + apache.ws + Apache WebServices Repository + http://ws.zones.apache.org/repository/ + legacy + + + + + + org.apache.tuscany.sca + tuscany-core + 1.0-incubating + + + + org.apache.tuscany.sca + tuscany-interface-wsdl-xml + 1.0-incubating + + + + org.apache.tuscany.sca + tuscany-assembly-xml + 1.0-incubating + + + + org.apache.tuscany.sca + tuscany-binding-ws-xml + 1.0-incubating + + + + org.apache.tuscany.sca + tuscany-core-databinding + 1.0-incubating + + + + org.apache.tuscany.sca + tuscany-databinding-axiom + 1.0-incubating + + + + org.apache.tuscany.sca + tuscany-host-http + 1.0-incubating + + + + org.apache.tuscany.sca + tuscany-policy-security + 1.0-incubating + + + + org.apache.axis2 + axis2-kernel + 1.3 + + + org.apache.ant + ant + + + + + + org.apache.axis2 + axis2-java2wsdl + 1.3 + + + + org.apache.axis2 + axis2-adb + 1.3 + runtime + + + + org.apache.axis2 + axis2-codegen + 1.3 + runtime + + + + org.apache.ws.commons.axiom + axiom-api + + + xerces + xercesImpl + + + 1.2.5 + + + + xerces + xercesImpl + 2.8.1 + runtime + + + + org.apache.ws.commons.axiom + axiom-impl + 1.2.5 + + + + org.apache.woden + woden + 1.0-incubating-M7b + runtime + + + + commons-logging + commons-logging + 1.1 + + + javax.servlet + servlet-api + + + + + + javax.servlet + servlet-api + 2.4 + provided + + + + + org.apache.neethi + neethi + 2.0.2 + + + + org.apache.ws.commons.schema + XmlSchema + 1.3.2 + + + + commons-httpclient + commons-httpclient + 3.0.1 + + + + javax.mail + mail + 1.4 + + + + backport-util-concurrent + backport-util-concurrent + 2.2 + runtime + + + + commons-codec + commons-codec + 1.3 + runtime + + + + org.apache.tuscany.sca + tuscany-host-jetty + 1.0-incubating + test + + + + org.apache.tuscany.sca + tuscany-host-embedded + 1.0-incubating + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 1.0-incubating + test + + + + org.apache.axis2 + axis2-mtompolicy + 1.3 + + + + org.apache.santuario + xmlsec + 1.4.0 + + + + xalan + xalan + 2.7.0 + + + + org.apache.ws.security + wss4j + 1.5.3 + + + + xml-apis + xml-apis + 1.3.03 + + + + org.apache.rampart + rampart-core + 1.3 + + + + org.apache.rampart + rampart-policy + 1.3 + + + + org.apache.rampart + rampart-trust + 1.3 + + + + + diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java new file mode 100644 index 0000000000..577513854c --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java @@ -0,0 +1,188 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.binding.ws.axis2; + +import java.lang.reflect.InvocationTargetException; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMElement; +import org.apache.axiom.soap.SOAPBody; +import org.apache.axiom.soap.SOAPEnvelope; +import org.apache.axiom.soap.SOAPFactory; +import org.apache.axiom.soap.SOAPHeader; +import org.apache.axis2.AxisFault; +import org.apache.axis2.addressing.AddressingConstants; +import org.apache.axis2.addressing.EndpointReference; +import org.apache.axis2.addressing.EndpointReferenceHelper; +import org.apache.axis2.client.OperationClient; +import org.apache.axis2.client.Options; +import org.apache.axis2.client.ServiceClient; +import org.apache.axis2.context.MessageContext; +import org.apache.axis2.transport.http.HTTPConstants; +import org.apache.axis2.wsdl.WSDLConstants; +import org.apache.tuscany.sca.assembly.xml.Constants; +import org.apache.tuscany.sca.interfacedef.util.FaultException; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.Message; +import org.apache.tuscany.sca.runtime.ReferenceParameters; + +/** + * Axis2BindingInvoker uses an Axis2 OperationClient to invoke a remote web service + */ +public class Axis2BindingInvoker implements Invoker { + + private ServiceClient serviceClient; + private QName wsdlOperationName; + private Options options; + private SOAPFactory soapFactory; + + public static final QName QNAME_WSA_FROM = + new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.WSA_FROM); + public static final QName QNAME_WSA_TO = + new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.WSA_TO); + + public static final QName CALLBACK_REFERENCE_REFPARM_QN = new QName(Constants.SCA10_TUSCANY_NS, "CallbackReference"); + public static final QName CALLBACK_ID_REFPARM_QN = new QName(Constants.SCA10_TUSCANY_NS, "CallbackID"); + public static final QName CONVERSATION_ID_REFPARM_QN = new QName(Constants.SCA10_TUSCANY_NS, "ConversationID"); + + public Axis2BindingInvoker(ServiceClient serviceClient, + QName wsdlOperationName, + Options options, + SOAPFactory soapFactory) { + this.serviceClient = serviceClient; + this.wsdlOperationName = wsdlOperationName; + this.options = options; + this.soapFactory = soapFactory; + } + + public Message invoke(Message msg) { + try { + Object resp = invokeTarget(msg); + msg.setBody(resp); + } catch (AxisFault e) { + if (e.getDetail() != null) { + FaultException f = new FaultException(e.getMessage(), e.getDetail()); + f.setLogical(e.getDetail().getQName()); + msg.setFaultBody(f); + } else { + msg.setFaultBody(e); + } + } catch (Throwable e) { + msg.setFaultBody(e); + } + + return msg; + } + + protected Object invokeTarget(Message msg) throws AxisFault { + OperationClient operationClient = createOperationClient(msg); + + // ensure connections are tracked so that they can be closed by the reference binding + MessageContext requestMC = operationClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE); + requestMC.getOptions().setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Boolean.TRUE); + requestMC.getOptions().setTimeOutInMilliSeconds(120000L); + + operationClient.execute(true); + + MessageContext responseMC = operationClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE); + + OMElement response = responseMC.getEnvelope().getBody().getFirstElement(); + + // FIXME: [rfeng] We have to pay performance penality to build the complete OM as the operationClient.complete() will + // release the underlying HTTP connection. + // Force the response to be populated, see https://issues.apache.org/jira/browse/TUSCANY-1541 + if (response != null) { + response.build(); + } + + operationClient.complete(requestMC); + + return response; + } + + @SuppressWarnings("deprecation") + protected OperationClient createOperationClient(Message msg) throws AxisFault { + SOAPEnvelope env = soapFactory.getDefaultEnvelope(); + Object[] args = (Object[])msg.getBody(); + if (args != null && args.length > 0) { + SOAPBody body = env.getBody(); + for (Object bc : args) { + if (bc instanceof OMElement) { + body.addChild((OMElement)bc); + } else { + throw new IllegalArgumentException( + "Can't handle mixed payloads betweem OMElements and other types."); + } + } + } + MessageContext requestMC = new MessageContext(); + requestMC.setEnvelope(env); + + // Axis2 operationClients can not be shared so create a new one for each request + OperationClient operationClient = serviceClient.createClient(wsdlOperationName); + operationClient.setOptions(options); + + ReferenceParameters parameters = msg.getTo().getReferenceParameters(); + + // if target endpoint was not specified when this invoker was created, + // use dynamically specified target endpoint passed in on this call + EndpointReference toEPR = options.getTo(); + if (toEPR == null) { + org.apache.tuscany.sca.runtime.EndpointReference ep = msg.getTo(); + toEPR = new EndpointReference(ep.getURI()); + } + + // set callback endpoint and callback ID for WS-Addressing header + if (parameters.getCallbackReference() != null) { + toEPR.addReferenceParameter(CALLBACK_REFERENCE_REFPARM_QN, + parameters.getCallbackReference().getBinding().getURI()); + } + if (parameters.getCallbackID() != null) { + //FIXME: serialize callback ID to XML in case it is not a string + toEPR.addReferenceParameter(CALLBACK_ID_REFPARM_QN, parameters.getCallbackID().toString()); + } + + // set conversation ID for WS-Addressing header + //FIXME: get conversation ID from the message's callable reference + Object conversationId = parameters.getConversationID(); + if (conversationId != null) { + //FIXME: serialize conversation ID to XML in case it is not a string + toEPR.addReferenceParameter(CONVERSATION_ID_REFPARM_QN, conversationId.toString()); + } + + // add WS-Addressing header + //FIXME: is there any way to use the Axis2 addressing support for this? + if (toEPR != null) { + SOAPEnvelope sev = requestMC.getEnvelope(); + SOAPHeader sh = sev.getHeader(); + OMElement epr = + EndpointReferenceHelper.toOM(sev.getOMFactory(), + toEPR, + QNAME_WSA_TO, + AddressingConstants.Final.WSA_NAMESPACE); + sh.addChild(epr); + requestMC.setTo(toEPR); + } + + operationClient.addMessageContext(requestMC); + + return operationClient; + } +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingProviderFactory.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingProviderFactory.java new file mode 100644 index 0000000000..610c376bc9 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingProviderFactory.java @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.binding.ws.axis2; + +import org.apache.tuscany.sca.binding.ws.WebServiceBinding; +import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.host.http.ServletHost; +import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint; +import org.apache.tuscany.sca.invocation.MessageFactory; +import org.apache.tuscany.sca.provider.BindingProviderFactory; +import org.apache.tuscany.sca.provider.ReferenceBindingProvider; +import org.apache.tuscany.sca.provider.ServiceBindingProvider; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.runtime.RuntimeComponentReference; +import org.apache.tuscany.sca.runtime.RuntimeComponentService; + +/** + * Axis2BindingProviderFactory + * + * @version $Rev$ $Date$ + */ + +public class Axis2BindingProviderFactory implements BindingProviderFactory { + + private MessageFactory messageFactory; + private ServletHost servletHost; + + public Axis2BindingProviderFactory(ExtensionPointRegistry extensionPoints) { + ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class); + this.servletHost = servletHosts.getServletHosts().get(0); + ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); + this.messageFactory = modelFactories.getFactory(MessageFactory.class); + } + + public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component, RuntimeComponentReference reference, WebServiceBinding binding) { + return new Axis2ReferenceBindingProvider(component, reference, binding, servletHost, messageFactory); + } + + public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component, RuntimeComponentService service, WebServiceBinding binding) { + return new Axis2ServiceBindingProvider(component, service, binding, servletHost, messageFactory); + } + + public Class getModelType() { + return WebServiceBinding.class; + } +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2OneWayBindingInvoker.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2OneWayBindingInvoker.java new file mode 100644 index 0000000000..b33a9a9dfc --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2OneWayBindingInvoker.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.binding.ws.axis2; + +import java.lang.reflect.InvocationTargetException; + +import javax.xml.namespace.QName; + +import org.apache.axiom.soap.SOAPFactory; +import org.apache.axis2.AxisFault; +import org.apache.axis2.client.OperationClient; +import org.apache.axis2.client.Options; +import org.apache.axis2.client.ServiceClient; +import org.apache.axis2.context.MessageContext; +import org.apache.axis2.transport.http.HTTPConstants; +import org.apache.axis2.wsdl.WSDLConstants; +import org.apache.tuscany.sca.invocation.Message; + +public class Axis2OneWayBindingInvoker extends Axis2BindingInvoker { + + public Axis2OneWayBindingInvoker(ServiceClient serviceClient, + QName wsdlOperationName, + Options options, + SOAPFactory soapFactory) { + + super(serviceClient, wsdlOperationName, options, soapFactory); + } + + @Override + protected Object invokeTarget(Message msg) throws AxisFault { + OperationClient operationClient = createOperationClient(msg); + + // ensure connections are tracked so that they can be closed by the reference binding + MessageContext requestMC = operationClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE); + requestMC.getOptions().setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Boolean.TRUE); + + operationClient.execute(false); + + // REVIEW it seems ok to return null + return null; + } + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceBindingProvider.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceBindingProvider.java new file mode 100644 index 0000000000..dba9c5b3de --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceBindingProvider.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.binding.ws.axis2; + +import org.apache.axiom.om.OMElement; +import org.apache.tuscany.sca.binding.ws.WebServiceBinding; +import org.apache.tuscany.sca.host.http.ServletHost; +import org.apache.tuscany.sca.interfacedef.InterfaceContract; +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.MessageFactory; +import org.apache.tuscany.sca.provider.ReferenceBindingProvider; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.runtime.RuntimeComponentReference; + +public class Axis2ReferenceBindingProvider implements ReferenceBindingProvider { + + private WebServiceBinding wsBinding; + private Axis2ServiceClient axisClient; + + public Axis2ReferenceBindingProvider(RuntimeComponent component, + RuntimeComponentReference reference, + WebServiceBinding wsBinding, + ServletHost servletHost, + MessageFactory messageFactory) { + + this.wsBinding = wsBinding; + + InterfaceContract contract = wsBinding.getBindingInterfaceContract(); + if (contract == null) { + contract = reference.getInterfaceContract().makeUnidirectional(false); + if ((contract instanceof JavaInterfaceContract)) { + contract = Java2WSDLHelper.createWSDLInterfaceContract((JavaInterfaceContract)contract, wsBinding); + } + wsBinding.setBindingInterfaceContract(contract); + } + + // Set to use the Axiom data binding + contract.getInterface().setDefaultDataBinding(OMElement.class.getName()); + + axisClient = new Axis2ServiceClient(component, reference, wsBinding, servletHost, messageFactory); + } + + public void start() { + axisClient.start(); + } + + public void stop() { + axisClient.stop(); + } + + public InterfaceContract getBindingInterfaceContract() { + return wsBinding.getBindingInterfaceContract(); + } + + public boolean supportsOneWayInvocation() { + return true; + } + + public Invoker createInvoker(Operation operation) { + return axisClient.createInvoker(operation); + } + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java new file mode 100644 index 0000000000..4133a11cbd --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java @@ -0,0 +1,77 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.binding.ws.axis2; + +import org.apache.axiom.om.OMElement; +import org.apache.tuscany.sca.binding.ws.WebServiceBinding; +import org.apache.tuscany.sca.host.http.ServletHost; +import org.apache.tuscany.sca.interfacedef.InterfaceContract; +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.MessageFactory; +import org.apache.tuscany.sca.provider.ServiceBindingProvider; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.runtime.RuntimeComponentService; + +public class Axis2ServiceBindingProvider implements ServiceBindingProvider { + + private WebServiceBinding wsBinding; + private Axis2ServiceProvider axisProvider; + + public Axis2ServiceBindingProvider(RuntimeComponent component, + RuntimeComponentService service, + WebServiceBinding wsBinding, + ServletHost servletHost, + MessageFactory messageFactory) { + + this.wsBinding = wsBinding; + + InterfaceContract contract = wsBinding.getBindingInterfaceContract(); + if (contract == null) { + contract = service.getInterfaceContract().makeUnidirectional(false); + if ((contract instanceof JavaInterfaceContract)) { + contract = Java2WSDLHelper.createWSDLInterfaceContract((JavaInterfaceContract)contract, wsBinding); + } + wsBinding.setBindingInterfaceContract(contract); + } + + // Set to use the Axiom data binding + contract.getInterface().setDefaultDataBinding(OMElement.class.getName()); + + axisProvider = new Axis2ServiceProvider(component, service, wsBinding, servletHost, messageFactory); + } + + public void start() { + axisProvider.start(); + } + + public void stop() { + axisProvider.stop(); + } + + public InterfaceContract getBindingInterfaceContract() { + return wsBinding.getBindingInterfaceContract(); + } + + public boolean supportsOneWayInvocation() { + return true; + } + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java new file mode 100644 index 0000000000..e032ca708b --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java @@ -0,0 +1,350 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.binding.ws.axis2; + +import java.io.IOException; +import java.net.URL; +import java.util.List; + +import javax.wsdl.Binding; +import javax.wsdl.BindingOperation; +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.Service; +import javax.wsdl.extensions.soap.SOAPAddress; +import javax.wsdl.extensions.soap.SOAPOperation; +import javax.xml.namespace.QName; +import javax.xml.stream.FactoryConfigurationError; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import javax.xml.transform.dom.DOMSource; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.impl.builder.StAXOMBuilder; +import org.apache.axiom.soap.SOAPFactory; +import org.apache.axis2.AxisFault; +import org.apache.axis2.addressing.EndpointReference; +import org.apache.axis2.addressing.EndpointReferenceHelper; +import org.apache.axis2.client.Options; +import org.apache.axis2.client.ServiceClient; +import org.apache.axis2.context.ConfigurationContext; +import org.apache.axis2.description.AxisEndpoint; +import org.apache.axis2.description.AxisService; +import org.apache.axis2.description.Parameter; +import org.apache.axis2.description.WSDL11ToAxisServiceBuilder; +import org.apache.axis2.description.WSDL2Constants; +import org.apache.axis2.transport.http.HTTPConstants; +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager; +import org.apache.tuscany.sca.assembly.AbstractContract; +import org.apache.tuscany.sca.binding.ws.WebServiceBinding; +import org.apache.tuscany.sca.contribution.Contribution; +import org.apache.tuscany.sca.contribution.DeployedArtifact; +import org.apache.tuscany.sca.host.http.ServletHost; +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.interfacedef.wsdl.xml.XMLDocumentHelper; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.MessageFactory; +import org.apache.tuscany.sca.policy.Intent; +import org.apache.tuscany.sca.policy.IntentAttachPoint; +import org.apache.tuscany.sca.policy.PolicySet; +import org.apache.tuscany.sca.policy.PolicySetAttachPoint; +import org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicy; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.ws.commons.schema.resolver.URIResolver; +import org.xml.sax.InputSource; + +public class Axis2ServiceClient { + + private WebServiceBinding wsBinding; + private ServiceClient serviceClient; + private static final QName SOAP12_INTENT = new QName("http://www.osoa.org/xmlns/sca/1.0", "soap12"); + + public Axis2ServiceClient(RuntimeComponent component, + AbstractContract contract, + WebServiceBinding wsBinding, + ServletHost servletHost, + MessageFactory messageFactory) { + + this.wsBinding = wsBinding; + this.serviceClient = createServiceClient(); + } + + protected void start() { + } + + /** + * Create an Axis2 ServiceClient + */ + protected ServiceClient createServiceClient() { + try { + TuscanyAxisConfigurator tuscanyAxisConfigurator = new TuscanyAxisConfigurator(); + ConfigurationContext configContext = tuscanyAxisConfigurator.getConfigurationContext(); + + configureSecurity(configContext); + + Definition wsdlDefinition = wsBinding.getWSDLDefinition().getDefinition(); + setServiceAndPort(wsBinding); + QName serviceQName = wsBinding.getServiceName(); + String portName = wsBinding.getPortName(); + AxisService axisService = + createClientSideAxisService(wsdlDefinition, serviceQName, portName, new Options()); + + return new ServiceClient(configContext, axisService); + } catch (AxisFault e) { + throw new RuntimeException(e); // TODO: better exception + } + } + + /** + * URI resolver implementation for xml schema + */ + public static class URIResolverImpl implements URIResolver { + private Definition definition; + + public URIResolverImpl(Definition definition) { + this.definition = definition; + } + + public org.xml.sax.InputSource resolveEntity(java.lang.String targetNamespace, + java.lang.String schemaLocation, + java.lang.String baseUri) { + try { + if (baseUri == null) { + baseUri = definition.getDocumentBaseURI(); + } + URL url = new URL(new URL(baseUri), schemaLocation); + return XMLDocumentHelper.getInputSource(url); + } catch (IOException e) { + return null; + } + } + } + + /** + * This method is copied from AxisService.createClientSideAxisService to + * work around http://issues.apache.org/jira/browse/WSCOMMONS-228 + * + * @param wsdlDefinition + * @param wsdlServiceName + * @param portName + * @param options + * @return + * @throws AxisFault + */ + @Deprecated + public static AxisService createClientSideAxisService(Definition wsdlDefinition, + QName wsdlServiceName, + String portName, + Options options) throws AxisFault { + WSDL11ToAxisServiceBuilder serviceBuilder = + new WSDL11ToAxisServiceBuilder(wsdlDefinition, wsdlServiceName, portName); + serviceBuilder.setServerSide(false); + // [rfeng] Add a custom resolver to work around WSCOMMONS-228 + serviceBuilder.setCustomResolver(new URIResolverImpl(wsdlDefinition)); + serviceBuilder.setBaseUri(wsdlDefinition.getDocumentBaseURI()); + // [rfeng] + AxisService axisService = serviceBuilder.populateService(); + AxisEndpoint axisEndpoint = (AxisEndpoint) axisService.getEndpoints() + .get(axisService.getEndpointName()); + options.setTo(new EndpointReference(axisEndpoint.getEndpointURL())); + if (axisEndpoint != null) { + options.setSoapVersionURI((String) axisEndpoint.getBinding() + .getProperty(WSDL2Constants.ATTR_WSOAP_VERSION)); + } + return axisService; + } + + + /** + * Ensure the WSDL definition contains a suitable service and port + */ + protected static void setServiceAndPort(WebServiceBinding wsBinding) { + Definition wsdlDefinition = wsBinding.getWSDLDefinition().getDefinition(); + QName serviceQName = wsBinding.getServiceName(); + String portName = wsBinding.getPortName(); + + // If no service is specified in the binding element, allow for WSDL that + // only contains a portType and not a service and port. Synthesize a + // service and port using WSDL4J and add them to the wsdlDefinition to + // keep Axis happy. + //FIXME: it would be better to do this for all WSDLs to explictly control the + // service and port that Axis will use, rather than just hoping the user has + // placed a suitable service and/or port first in the WSDL. + if (serviceQName == null && wsBinding.getBinding() != null) { + QName bindingQName = wsBinding.getBindingName(); + Port port = wsdlDefinition.createPort(); + portName = "$port$." + bindingQName.getLocalPart(); + port.setName(portName); + wsBinding.setPortName(portName); + port.setBinding(wsBinding.getBinding()); + Service service = wsdlDefinition.createService(); + serviceQName = new QName(bindingQName.getNamespaceURI(), + "$service$." + bindingQName.getLocalPart()); + service.setQName(serviceQName); + wsBinding.setServiceName(serviceQName); + service.addPort(port); + wsdlDefinition.addService(service); + } + } + + protected void stop() { + // close all connections that we have initiated, so that the jetty server + // can be restarted without seeing ConnectExceptions + HttpClient httpClient = + (HttpClient)serviceClient.getServiceContext().getConfigurationContext() + .getProperty(HTTPConstants.CACHED_HTTP_CLIENT); + if (httpClient != null) + ((MultiThreadedHttpConnectionManager)httpClient.getHttpConnectionManager()).shutdown(); + } + + /** + * Create and configure an Axis2BindingInvoker for each operation + */ + protected Invoker createInvoker(Operation operation) { + Options options = new Options(); + EndpointReference epTo = getWSATOEPR(wsBinding); + if (epTo != null) { + options.setTo(epTo); + } + options.setProperty(HTTPConstants.CHUNKED, Boolean.FALSE); + + String operationName = operation.getName(); + + String soapAction = getSOAPAction(operationName); + if (soapAction != null && soapAction.length() > 1) { + options.setAction(soapAction); + } + + options.setTimeOutInMilliSeconds(30 * 1000); // 30 seconds + + SOAPFactory soapFactory = requiresSOAP12() ? OMAbstractFactory.getSOAP12Factory() : OMAbstractFactory.getSOAP11Factory(); + QName wsdlOperationQName = new QName(operationName); + + Axis2BindingInvoker invoker; + if (operation.isNonBlocking()) { + invoker = new Axis2OneWayBindingInvoker(serviceClient, wsdlOperationQName, options, soapFactory); + } else { + invoker = new Axis2BindingInvoker(serviceClient, wsdlOperationQName, options, soapFactory); + } + return invoker; + } + + private boolean requiresSOAP12() { + if (wsBinding instanceof IntentAttachPoint) { + List intents = ((IntentAttachPoint)wsBinding).getRequiredIntents(); + for (Intent intent : intents) { + if (SOAP12_INTENT.equals(intent.getName())) { + return true; + } + } + } + return false; + } + + protected EndpointReference getWSATOEPR(WebServiceBinding binding) { + EndpointReference epr = getEPR(binding); + if (epr == null) { + epr = getPortLocationEPR(binding); + } else if (epr.getAddress() == null || epr.getAddress().length() < 1) { + EndpointReference bindingEPR = getPortLocationEPR(binding); + if (bindingEPR != null) { + epr.setAddress(bindingEPR.getAddress()); + } + } + return epr; + } + + protected EndpointReference getPortLocationEPR(WebServiceBinding binding) { + String ep = binding.getURI(); + if (ep == null && binding.getPort() != null) { + List wsdlPortExtensions = binding.getPort().getExtensibilityElements(); + for (final Object extension : wsdlPortExtensions) { + if (extension instanceof SOAPAddress) { + ep = ((SOAPAddress)extension).getLocationURI(); + break; + } + } + } + return ep != null ? new EndpointReference(ep) : null; + } + + protected org.apache.axis2.addressing.EndpointReference getEPR(WebServiceBinding wsBinding) { + if (wsBinding.getEndPointReference() == null) { + return null; + } + try { + + XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(new DOMSource(wsBinding.getEndPointReference())); + StAXOMBuilder builder = new StAXOMBuilder(parser); + OMElement omElement = builder.getDocumentElement(); + org.apache.axis2.addressing.EndpointReference epr = EndpointReferenceHelper.fromOM(omElement); + return epr; + + } catch (IOException e) { + throw new RuntimeException(e); + } catch (XMLStreamException e) { + throw new RuntimeException(e); + } catch (FactoryConfigurationError e) { + throw new RuntimeException(e); + } + } + + protected String getSOAPAction(String operationName) { + Binding binding = wsBinding.getBinding(); + if (binding != null) { + for (Object o : binding.getBindingOperations()) { + BindingOperation bop = (BindingOperation)o; + if (bop.getName().equalsIgnoreCase(operationName)) { + for (Object o2 : bop.getExtensibilityElements()) { + if (o2 instanceof SOAPOperation) { + return ((SOAPOperation)o2).getSoapActionURI(); + } + } + } + } + } + return null; + } + + private void configureSecurity(ConfigurationContext configContext) throws AxisFault { + if ( wsBinding instanceof PolicySetAttachPoint ) { + PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)wsBinding; + Parameter configParam = null; + Axis2ConfigParamPolicy axis2ConfigParamPolicy = null; + for ( PolicySet policySet : policiedBinding.getPolicySets() ) { + for ( Object policy : policySet.getPolicies() ) { + if ( policy instanceof Axis2ConfigParamPolicy ) { + axis2ConfigParamPolicy = (Axis2ConfigParamPolicy)policy; + for ( String paramName : axis2ConfigParamPolicy.getParamElements().keySet() ) { + configParam = new Parameter(paramName, + axis2ConfigParamPolicy.getParamElements().get(paramName).getFirstElement()); + configParam.setParameterElement(axis2ConfigParamPolicy.getParamElements().get(paramName)); + configContext.getAxisConfiguration().addParameter(configParam); + } + } + } + } + } + } + + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInMessageReceiver.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInMessageReceiver.java new file mode 100644 index 0000000000..1684cc93dc --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInMessageReceiver.java @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.binding.ws.axis2; + +import java.lang.reflect.InvocationTargetException; + +import org.apache.axiom.om.OMElement; +import org.apache.axis2.AxisFault; +import org.apache.axis2.context.MessageContext; +import org.apache.axis2.receivers.AbstractInMessageReceiver; +import org.apache.tuscany.sca.interfacedef.Operation; + +public class Axis2ServiceInMessageReceiver extends AbstractInMessageReceiver { + + protected Operation operation; + + private Axis2ServiceProvider provider; + + public Axis2ServiceInMessageReceiver(Axis2ServiceProvider provider, Operation operation) { + this.provider = provider; + this.operation = operation; + } + + public Axis2ServiceInMessageReceiver() { + } + + @Override + public void invokeBusinessLogic(MessageContext inMC) throws AxisFault { + try { + OMElement requestOM = inMC.getEnvelope().getBody().getFirstElement(); + Object[] args = new Object[] {requestOM}; + provider.invokeTarget(operation, args, inMC); + + } catch (InvocationTargetException e) { + Throwable t = e.getCause(); + if (t instanceof Exception) { + throw AxisFault.makeFault((Exception)t); + } + throw new RuntimeException(e); + } catch (Exception e) { + e.printStackTrace(); + throw AxisFault.makeFault(e); + } + } +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInOutSyncMessageReceiver.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInOutSyncMessageReceiver.java new file mode 100644 index 0000000000..11809e576a --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInOutSyncMessageReceiver.java @@ -0,0 +1,86 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.binding.ws.axis2; + +import java.lang.reflect.InvocationTargetException; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.apache.axiom.om.OMElement; +import org.apache.axiom.soap.SOAPEnvelope; +import org.apache.axis2.AxisFault; +import org.apache.axis2.Constants; +import org.apache.axis2.context.MessageContext; +import org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver; +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.interfacedef.util.FaultException; +import org.osoa.sca.ServiceRuntimeException; + +public class Axis2ServiceInOutSyncMessageReceiver extends AbstractInOutSyncMessageReceiver { + private static final Logger logger = Logger.getLogger(Axis2ServiceInOutSyncMessageReceiver.class.getName()); + + protected Operation operation; + + private Axis2ServiceProvider provider; + + public Axis2ServiceInOutSyncMessageReceiver(Axis2ServiceProvider provider, Operation operation) { + this.provider = provider; + this.operation = operation; + } + + public Axis2ServiceInOutSyncMessageReceiver() { + } + + @Override + public void invokeBusinessLogic(MessageContext inMC, MessageContext outMC) throws AxisFault { + try { + OMElement requestOM = inMC.getEnvelope().getBody().getFirstElement(); + Object[] args = null; + + if (requestOM != null) { + args = new Object[] {requestOM}; + } + OMElement responseOM = (OMElement)provider.invokeTarget(operation, args, inMC); + + SOAPEnvelope soapEnvelope = getSOAPFactory(inMC).getDefaultEnvelope(); + if (null != responseOM ) { + soapEnvelope.getBody().addChild(responseOM); + } + outMC.setEnvelope(soapEnvelope); + outMC.getOperationContext().setProperty(Constants.RESPONSE_WRITTEN, Constants.VALUE_TRUE); + + } catch (InvocationTargetException e) { + Throwable t = e.getCause(); + if (t instanceof FaultException && ((FaultException)t).getFaultInfo() instanceof OMElement) { + OMElement faultDetail = (OMElement)((FaultException)t).getFaultInfo(); + inMC.setProperty(Constants.FAULT_NAME, faultDetail.getQName().getLocalPart()); + AxisFault f = new AxisFault(null, e.getMessage(), "faultNode", "faultRole", faultDetail); + throw f; + } + if (t instanceof Exception) { + throw AxisFault.makeFault((Exception)t); + } + logger.log(Level.SEVERE, e.getMessage(), t); + throw new ServiceRuntimeException(e); + } catch (Throwable e) { + logger.log(Level.SEVERE, e.getMessage(), e); + throw AxisFault.makeFault(e); + } + } +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java new file mode 100644 index 0000000000..880897d06a --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java @@ -0,0 +1,537 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.InvocationTargetException; +import java.net.URI; +import java.net.URL; +import java.security.PrivilegedAction; +import java.util.Iterator; +import java.util.List; + +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.extensions.soap.SOAPAddress; +import javax.xml.namespace.QName; +import javax.xml.stream.FactoryConfigurationError; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import javax.xml.transform.dom.DOMSource; + +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.impl.builder.StAXOMBuilder; +import org.apache.axiom.soap.SOAPHeader; +import org.apache.axis2.AxisFault; +import org.apache.axis2.Constants; +import org.apache.axis2.addressing.AddressingConstants; +import org.apache.axis2.addressing.EndpointReferenceHelper; +import org.apache.axis2.context.ConfigurationContext; +import org.apache.axis2.context.MessageContext; +import org.apache.axis2.deployment.DeploymentErrorMsgs; +import org.apache.axis2.deployment.DeploymentException; +import org.apache.axis2.deployment.ModuleBuilder; +import org.apache.axis2.deployment.util.Utils; +import org.apache.axis2.description.AxisModule; +import org.apache.axis2.description.AxisOperation; +import org.apache.axis2.description.AxisService; +import org.apache.axis2.description.Parameter; +import org.apache.axis2.description.WSDL11ToAxisServiceBuilder; +import org.apache.axis2.description.WSDL2Constants; +import org.apache.axis2.description.WSDLToAxisServiceBuilder; +import org.apache.axis2.engine.AxisConfiguration; +import org.apache.axis2.engine.MessageReceiver; +import org.apache.axis2.i18n.Messages; +import org.apache.axis2.wsdl.WSDLConstants; +import org.apache.tuscany.sca.assembly.AbstractContract; +import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.binding.ws.WebServiceBinding; +import org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceClient.URIResolverImpl; +import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl; +import org.apache.tuscany.sca.host.http.ServletHost; +import org.apache.tuscany.sca.interfacedef.Interface; +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.interfacedef.java.JavaInterface; +import org.apache.tuscany.sca.invocation.Message; +import org.apache.tuscany.sca.invocation.MessageFactory; +import org.apache.tuscany.sca.policy.PolicySet; +import org.apache.tuscany.sca.policy.PolicySetAttachPoint; +import org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicy; +import org.apache.tuscany.sca.runtime.EndpointReference; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.runtime.RuntimeComponentService; +import org.apache.tuscany.sca.runtime.RuntimeWire; + +public class Axis2ServiceProvider { + + private AbstractContract contract; + private WebServiceBinding wsBinding; + private ServletHost servletHost; + private MessageFactory messageFactory; + private ConfigurationContext configContext; + + public static final QName QNAME_WSA_ADDRESS = + new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.EPR_ADDRESS); + public static final QName QNAME_WSA_FROM = + new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.WSA_FROM); + public static final QName QNAME_WSA_TO = + new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.WSA_TO); + + public static final QName QNAME_WSA_REFERENCE_PARAMETERS = + new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.EPR_REFERENCE_PARAMETERS); + + // TODO: what to do about the base URI? + // This port number may be used to construct callback URIs. The value 8085 is used + // beacuse it matches the service port number used by the simple-callback-ws sample. + private static final String BASE_URI = "http://localhost:8085/"; + + public Axis2ServiceProvider(RuntimeComponent component, + AbstractContract contract, + WebServiceBinding wsBinding, + ServletHost servletHost, + MessageFactory messageFactory) { + + this.contract = contract; + this.wsBinding = wsBinding; + this.servletHost = servletHost; + this.messageFactory = messageFactory; + + try { + TuscanyAxisConfigurator tuscanyAxisConfigurator = new TuscanyAxisConfigurator(); + configContext = tuscanyAxisConfigurator.getConfigurationContext(); + //deployRampartModule(); + configureSecurity(); + } catch (AxisFault e) { + throw new RuntimeException(e); // TODO: better exception + } catch ( Exception e ) { + throw new RuntimeException(e); + } + + configContext.setContextRoot(servletHost.getContextPath()); + + String uri = computeActualURI(BASE_URI, component, contract).normalize().toString(); + if (uri.endsWith("/")) { + uri = uri.substring(0, uri.length() - 1); + } + wsBinding.setURI(uri); + } + + private void engageModules() throws AxisFault { + if ( wsBinding instanceof PolicySetAttachPoint ) { + PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)wsBinding; + if ( policiedBinding.getPolicySets().size() > 0 ) { + //TODO: need to verify if one of the policies are concerned with security + AxisModule m = new AxisModule("rampart"); + m.setFileName(wsBinding.getClass().getClassLoader().getResource("rampart-1.2.mar")); + configContext.getAxisConfiguration().addModule(m); + configContext.getAxisConfiguration().engageModule(m, configContext.getAxisConfiguration()); + } + } + } + + public void start() { + + // TODO: if specifies the wsdl service then should create a + // service for every port + + try { + AxisService axisService = createAxisService(); + configContext.getAxisConfiguration().addService(createAxisService()); + } catch (AxisFault e) { + throw new RuntimeException(e); + } + + Axis2ServiceServlet servlet = new Axis2ServiceServlet(); + servlet.init(configContext); + String servletURI = wsBinding.getURI(); + servletHost.addServletMapping(servletURI, servlet); + } + + public void stop() { + servletHost.removeServletMapping(wsBinding.getURI()); + try { + configContext.getAxisConfiguration().removeService(wsBinding.getURI()); + } catch (AxisFault e) { + throw new RuntimeException(e); + } + } + + /** + * Compute the endpoint URI based on section 2.1.1 of the WS binding spec 1. + * The URIs in the endpoint(s) of the referenced WSDL, which may be relative + * 2. The URI specified by the wsa:Address element of the + * wsa:EndpointReference, which may be relative 3. The explicitly stated URI + * in the "uri" attribute of the binding.ws element, which may be relative, + * 4. The implicit URI as defined by in section 1.7 in the SCA Assembly spec + * If the has no wsdlElement but does have a uri attribute then + * the uri takes precidence over any implicitly used WSDL. + * + * @param parent + */ + protected URI computeActualURI(String baseURI, RuntimeComponent component, AbstractContract contract) { + + org.apache.axis2.addressing.EndpointReference epr = null; + URI eprURI = null; + if (wsBinding.getEndPointReference() != null) { + epr = getEPR(); + if (epr.getAddress() != null) { + eprURI = URI.create(epr.getAddress()); + } + } + + URI wsdlURI = null; + if (wsBinding.getServiceName() != null && wsBinding.getBindingName() == null) { + // explicitly points at a wsdl port, may be a relative URI + wsdlURI = getEndpoint(wsBinding.getPort()); + } + + // if the wsdl port/endpoint has an absolute URI use that + if (wsdlURI != null && wsdlURI.isAbsolute()) { + if (wsBinding.getURI() != null) { +// TODO: throw new IllegalArgumentException("Cannot specify binding URI when wsdl has aboslute URI"); + } + return URI.create(wsdlURI.toString()); + } + + // if the wsa:EndpointReference has an address element with an absolute URI use that + if (eprURI != null && eprURI.isAbsolute()) { + //FIXME Throwing an exception breaks as wsBinding.getURI() will return the default URI + // derived from the service name or the URI actually configured in the .composite +// if (wsBinding.getURI() != null) { +// throw new IllegalArgumentException("Cannot specify binding URI when wsa:EndpointReference has aboslute address URI"); +// } + return URI.create(eprURI.toString()); + } + + // either there is no wsdl port endpoint URI or that URI is relative + + URI completeURI; + if (wsBinding.getURI() != null) { + completeURI = URI.create(wsBinding.getURI()); + if (!completeURI.isAbsolute()) { + completeURI = URI.create(baseURI + "/" + wsBinding.getURI()); + } + } else { + completeURI = URI.create(baseURI + "/" + wsBinding.getName()); + } + + if (eprURI != null) { + // there is a relative URI in the binding EPR + completeURI = URI.create(completeURI + "/" + eprURI); + } + + if (wsdlURI != null) { + // there is a relative URI in the wsdl port + completeURI = URI.create(completeURI + "/" + wsdlURI); + } + + return completeURI; + + } + + private org.apache.axis2.addressing.EndpointReference getEPR() { + try { + + XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(new DOMSource(wsBinding.getEndPointReference())); + StAXOMBuilder builder = new StAXOMBuilder(parser); + OMElement omElement = builder.getDocumentElement(); + org.apache.axis2.addressing.EndpointReference epr = EndpointReferenceHelper.fromOM(omElement); + return epr; + + } catch (IOException e) { + throw new RuntimeException(e); + } catch (XMLStreamException e) { + throw new RuntimeException(e); + } catch (FactoryConfigurationError e) { + throw new RuntimeException(e); + } + } + + /** + * Returns the endpoint of a given port. + */ + protected URI getEndpoint(Port wsdlPort) { + if (wsdlPort != null) { + List wsdlPortExtensions = wsdlPort.getExtensibilityElements(); + for (Object extension : wsdlPortExtensions) { + if (extension instanceof SOAPAddress) { + return URI.create(((SOAPAddress)extension).getLocationURI()); + } + } + } + return null; + } + + private AxisService createAxisService() throws AxisFault { + AxisService axisService; + if (wsBinding.getWSDLDefinition() != null) { + axisService = createWSDLAxisService(); + } else { + axisService = createJavaAxisService(); + } + initAxisOperations(axisService); + return axisService; + } + + /** + * Create an AxisService from the interface class from the SCA service interface + */ + protected AxisService createJavaAxisService() throws AxisFault { + AxisService axisService = new AxisService(); + String path = URI.create(wsBinding.getURI()).getPath(); + axisService.setName(path); + axisService.setServiceDescription("Tuscany configured AxisService for service: " + wsBinding.getURI()); + axisService.setClientSide(false); + Parameter classParam = + new Parameter(Constants.SERVICE_CLASS, ((JavaInterface)contract.getInterfaceContract().getInterface()) + .getJavaClass().getName()); + axisService.addParameter(classParam); + try { + Utils.fillAxisService(axisService, configContext.getAxisConfiguration(), null, null); + } catch (Exception e) { + throw new RuntimeException(e); + } + + return axisService; + } + + /** + * Create an AxisService from the WSDL doc used by ws binding + */ + protected AxisService createWSDLAxisService() throws AxisFault { + Definition definition = wsBinding.getWSDLDefinition().getDefinition(); + + // WSDLToAxisServiceBuilder only uses the service and port to find the wsdl4J Binding + // An SCA service with binding.ws does not require a service or port so we may not have + // these but ... + + Axis2ServiceClient.setServiceAndPort(wsBinding); + QName serviceQName = wsBinding.getServiceName(); + String portName = wsBinding.getPortName(); + + WSDLToAxisServiceBuilder builder = new WSDL11ToAxisServiceBuilder(definition, serviceQName, portName); + builder.setServerSide(true); + // [rfeng] Add a custom resolver to work around WSCOMMONS-228 + builder.setCustomResolver(new URIResolverImpl(definition)); + builder.setBaseUri(definition.getDocumentBaseURI()); + // [rfeng] + AxisService axisService = builder.populateService(); + + String path = URI.create(wsBinding.getURI()).getPath(); + axisService.setName(path); + axisService.setDocumentation("Tuscany configured AxisService for service: " + wsBinding.getURI()); + + // Use the existing WSDL + Parameter wsdlParam = new Parameter(WSDLConstants.WSDL_4_J_DEFINITION, null); + wsdlParam.setValue(definition); + axisService.addParameter(wsdlParam); + Parameter userWSDL = new Parameter("useOriginalwsdl", "true"); + axisService.addParameter(userWSDL); + + return axisService; + } + + protected void initAxisOperations(AxisService axisService) { + for (Iterator i = axisService.getOperations(); i.hasNext();) { + AxisOperation axisOp = (AxisOperation)i.next(); + Operation op = getOperation(axisOp); + if (op != null) { + + if (op.isNonBlocking()) { + axisOp.setMessageExchangePattern(WSDL2Constants.MEP_URI_IN_ONLY); + } else { + axisOp.setMessageExchangePattern(WSDL2Constants.MEP_URI_IN_OUT); + } + + MessageReceiver msgrec = null; + if (op.isNonBlocking()) { + msgrec = new Axis2ServiceInMessageReceiver(this, op); + } else { + msgrec = new Axis2ServiceInOutSyncMessageReceiver(this, op); + } + axisOp.setMessageReceiver(msgrec); + } + } + } + + protected Operation getOperation(AxisOperation axisOp) { + String operationName = axisOp.getName().getLocalPart(); + Interface iface = wsBinding.getBindingInterfaceContract().getInterface(); + for (Operation op : iface.getOperations()) { + if (op.getName().equalsIgnoreCase(operationName)) { + return op; + } + } + return null; + } + + // methods for Axis2 message receivers + + public Object invokeTarget(Operation op, Object[] args, MessageContext inMC) throws InvocationTargetException { + + String callbackAddress = null; + String callbackID = null; + Object conversationID = null; + + //FIXME: can we use the Axis2 addressing support for this? + SOAPHeader header = inMC.getEnvelope().getHeader(); + if (header != null) { + OMElement to = header.getFirstChildWithName(QNAME_WSA_TO); + if (to != null) { + OMElement params = to.getFirstChildWithName(QNAME_WSA_REFERENCE_PARAMETERS); + if (params != null) { + OMElement convIDElement = + params.getFirstChildWithName(Axis2BindingInvoker.CONVERSATION_ID_REFPARM_QN); + if (convIDElement != null) { + if (isConversational()) { + conversationID = convIDElement.getText(); + } + } + OMElement callbackAddrElement = + params.getFirstChildWithName(Axis2BindingInvoker.CALLBACK_REFERENCE_REFPARM_QN); + if (callbackAddrElement != null) { + if (contract.getInterfaceContract().getCallbackInterface() != null) { + callbackAddress = callbackAddrElement.getText(); + } + } + OMElement callbackIDElement = + params.getFirstChildWithName(Axis2BindingInvoker.CALLBACK_ID_REFPARM_QN); + if (callbackIDElement != null) { + if (contract.getInterfaceContract().getCallbackInterface() != null) { + callbackID = callbackIDElement.getText(); + } + } + } + } + } + + // create a message object and set the args as its body + Message msg = messageFactory.createMessage(); + msg.setBody(args); + + // if reference parameters are needed, create a new "To" EPR to hold them + EndpointReference to = null; + if (callbackAddress != null || + callbackID != null || + conversationID != null) { + to = new EndpointReferenceImpl(null); + msg.setTo(to); + } + + // set the reference parameters into the "To" EPR + if (callbackAddress != null) { + to.getReferenceParameters().setCallbackReference(new EndpointReferenceImpl(callbackAddress)); + } + if (callbackID != null) { + to.getReferenceParameters().setCallbackID(callbackID); + } + if (conversationID != null) { + to.getReferenceParameters().setConversationID(conversationID); + } + + // find the runtime wire and invoke it with the message + RuntimeWire wire = ((RuntimeComponentService)contract).getRuntimeWire(getBinding()); + return wire.invoke(op, msg); + } + + public boolean isConversational() { + return wsBinding.getBindingInterfaceContract().getInterface().isConversational(); + } + + /** + * Return the binding for this provider as a primitive binding type + * For use when looking up wires registered against the binding. + * + * @return the binding + */ + protected Binding getBinding() { + return wsBinding; + } + + private void configureSecurity() throws AxisFault { + if ( wsBinding instanceof PolicySetAttachPoint ) { + PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)wsBinding; + Parameter configParam = null; + Axis2ConfigParamPolicy axis2ConfigParamPolicy = null; + for ( PolicySet policySet : policiedBinding.getPolicySets() ) { + for ( Object policy : policySet.getPolicies() ) { + if ( policy instanceof Axis2ConfigParamPolicy ) { + axis2ConfigParamPolicy = (Axis2ConfigParamPolicy)policy; + for ( String paramName : axis2ConfigParamPolicy.getParamElements().keySet() ) { + configParam = new Parameter(paramName, + axis2ConfigParamPolicy.getParamElements().get(paramName).getFirstElement()); + configParam.setParameterElement(axis2ConfigParamPolicy.getParamElements().get(paramName)); + configContext.getAxisConfiguration().addParameter(configParam); + } + } + } + } + } + } + + private void deployRampartModule() throws DeploymentException, AxisFault { + ClassLoader tccl = (ClassLoader) org.apache.axis2.java.security.AccessController + .doPrivileged(new PrivilegedAction() { + public Object run() { + return Thread.currentThread().getContextClassLoader(); + } + }); + + + AxisModule module = new AxisModule(); + module.setParent(configContext.getAxisConfiguration()); + String moduleName = "rampart-1.2"; + URL moduleurl = TuscanyAxisConfigurator.class.getResource("/org/apache/tuscany/sca/binding/ws/axis2/engine/config/rampart-1.2.mar"); + module.setName(moduleName); + ClassLoader deploymentClassloader = Utils.createClassLoader(new URL[]{moduleurl}, + tccl, + true, + (File)configContext.getAxisConfiguration().getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR)); + + module.setModuleClassLoader(deploymentClassloader); + populateModule(module, moduleurl,configContext.getAxisConfiguration()); + module.setFileName(moduleurl); + TuscanyAxisConfigurator.addNewModule(module, configContext.getAxisConfiguration()); + org.apache.axis2.util.Utils.calculateDefaultModuleVersion( + configContext.getAxisConfiguration().getModules(), configContext.getAxisConfiguration()); + } + + private void populateModule(AxisModule module, URL moduleUrl, AxisConfiguration axisConfig) throws DeploymentException { + try { + ClassLoader classLoadere = module.getModuleClassLoader(); + InputStream moduleStream = classLoadere.getResourceAsStream("META-INF/module.xml"); + if (moduleStream == null) { + moduleStream = classLoadere.getResourceAsStream("meta-inf/module.xml"); + } + if (moduleStream == null) { + throw new DeploymentException( + Messages.getMessage( + DeploymentErrorMsgs.MODULE_XML_MISSING, moduleUrl.toString())); + } + ModuleBuilder moduleBuilder = new ModuleBuilder(moduleStream, module, axisConfig); + moduleBuilder.populateModule(); + } catch (IOException e) { + throw new DeploymentException(e); + } + } +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceServlet.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceServlet.java new file mode 100644 index 0000000000..7096dd9e3e --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceServlet.java @@ -0,0 +1,297 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.binding.ws.axis2; + +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.SocketException; +import java.net.URI; +import java.net.URL; +import java.util.Collections; +import java.util.Enumeration; +import java.util.Set; +import java.util.Vector; + +import javax.servlet.RequestDispatcher; +import javax.servlet.Servlet; +import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.axis2.AxisFault; +import org.apache.axis2.Constants; +import org.apache.axis2.addressing.EndpointReference; +import org.apache.axis2.context.ConfigurationContext; +import org.apache.axis2.description.TransportInDescription; +import org.apache.axis2.engine.ListenerManager; +import org.apache.axis2.transport.http.AxisServlet; +import org.apache.axis2.transport.http.ListingAgent; +import org.apache.axis2.transport.http.server.HttpUtils; + +/** + * This overrides the servlet init of the AxisServlet so Tuscany can use + * a single Axis2 ConfigurationContext instance shared between AxisServlet + * instances for each SCA service with a ws binding. + * TODO: need to review if thats really what we want to be doing + */ +public class Axis2ServiceServlet extends AxisServlet { + + protected TuscanyListingAgent agent; + + private static final long serialVersionUID = 1L; + private static final ServletConfig DUMMY_CONFIG = createDummyServletConfig(); + +//JIRA TUSCANY-1561 Port to Axis2 1.3 + private ConfigurationContext tmpconfigContext; + + public void init(ConfigurationContext configContext) { + this.tmpconfigContext = configContext; + try { + super.init(DUMMY_CONFIG); + } catch (ServletException e) { + throw new RuntimeException(e); + } + agent = new TuscanyListingAgent(configContext); + } + + /** + * Override Axis2 servlet method to avoid loop when init + * is called after servletConfig already initialized by + * this classes init(ConfigurationContext) method. + */ + @Override + public void init() throws ServletException { + } + + public void init(ServletConfig config) throws ServletException { + ServletContext servletContext = config.getServletContext(); + servletContext.setAttribute(CONFIGURATION_CONTEXT, tmpconfigContext); + super.init(config); + } + + /** + * We've setup the Servlet by passing in a ConfigurationContext on our init method + * override this method to just return that + */ + @Override + protected ConfigurationContext initConfigContext(ServletConfig config) throws ServletException { + return this.tmpconfigContext; + } + + @Override + public ServletConfig getServletConfig() { + return DUMMY_CONFIG; + } + + @Override + public String getServletName() { + return "TuscanyAxis2Servlet"; + } + + /** + * The AxisServlet gets NPE during init without a ServletConfig so this is a mocked up one to prevent that. + */ + private static ServletConfig createDummyServletConfig() { + ServletConfig sc = new ServletConfig() { + + public String getServletName() { + return "TuscanyAxis2DummyServlet"; + } + + public ServletContext getServletContext() { + return new ServletContext() { + + public ServletContext getContext(String uripath) { + return null; + } + + @SuppressWarnings("unused") // it's on the servlet 2.5 api so we need it + public String getContextPath() { + return null; + } + + public int getMajorVersion() { + return 0; + } + + public int getMinorVersion() { + return 0; + } + + public String getMimeType(String file) { + return null; + } + + public Set getResourcePaths(String path) { + return Collections.emptySet(); + } + + public URL getResource(String path) throws MalformedURLException { + if("/".equals(path)) { + // HACK: To avoid NPE + return new URL("/axis2"); + } + return null; + } + + public InputStream getResourceAsStream(String path) { + return null; + } + + public RequestDispatcher getRequestDispatcher(String path) { + return null; + } + + public RequestDispatcher getNamedDispatcher(String arg0) { + return null; + } + + public Servlet getServlet(String arg0) throws ServletException { + return null; + } + + public Enumeration getServlets() { + return null; + } + + public Enumeration getServletNames() { + return null; + } + + public void log(String arg0) { + } + + public void log(Exception arg0, String arg1) { + } + + public void log(String arg0, Throwable arg1) { + } + + public String getRealPath(String arg0) { + return null; + } + + public String getServerInfo() { + return null; + } + + public String getInitParameter(String arg0) { + return null; + } + + public Enumeration getInitParameterNames() { + return null; + } + + public Object getAttribute(String arg0) { + return null; + } + + public Enumeration getAttributeNames() { + return null; + } + + public void setAttribute(String arg0, Object arg1) { + } + + public void removeAttribute(String arg0) { + } + + public String getServletContextName() { + return null; + } + }; + } + + public String getInitParameter(String arg0) { + return null; + } + + public Enumeration getInitParameterNames() { + return new Vector().elements(); + } + }; + return sc; + } + + @Override + public void destroy() { + try { + super.destroy(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Override the AxisServlet doGet to use the TuscanyListingAgent for ?wsdl + */ + @Override + protected void doGet(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + + initContextRoot(request); + + String query = request.getQueryString(); + if ((query != null) && (query.indexOf("wsdl2") >= 0 || + query.indexOf("wsdl") >= 0 || query.indexOf("xsd") >= 0 || + query.indexOf("policy") >= 0)) { + agent.processListService(request, response); + } else { + super.doGet(request, response); + } + } + + /** + + /** + * Override the AxisServlet method so as to not add "/services" into the url + * and to work with Tuscany service names. can go once moved to Axis2 1.3 + */ + @Override + public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault { + //RUNNING_PORT + String port = (String) configContext.getProperty(ListingAgent.RUNNING_PORT); + if (port == null) { + port = "8080"; + } + if (ip == null) { + try { + ip = HttpUtils.getIpAddress(); + if (ip == null) { + ip = "localhost"; + } + } catch (SocketException e) { +//TUSCANY-1561 Port to Axis2 1.3 +// throw new AxisFault.(e); + throw AxisFault.makeFault(e); + } + } + + String contextPath = configContext.getServiceContextPath(); + + URI epURI = URI.create("http://" + ip + ":" + port + "/" + contextPath + "/" + serviceName).normalize(); + + return new EndpointReference[]{new EndpointReference(epURI.toString())}; + } + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Java2WSDLHelper.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Java2WSDLHelper.java new file mode 100644 index 0000000000..80aa4efaf6 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Java2WSDLHelper.java @@ -0,0 +1,384 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.binding.ws.axis2; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.Method; +import java.net.URL; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.wsdl.Binding; +import javax.wsdl.BindingOperation; +import javax.wsdl.BindingOutput; +import javax.wsdl.Definition; +import javax.wsdl.Input; +import javax.wsdl.Message; +import javax.wsdl.OperationType; +import javax.wsdl.Output; +import javax.wsdl.Part; +import javax.wsdl.Port; +import javax.wsdl.PortType; +import javax.wsdl.Service; +import javax.wsdl.Types; +import javax.wsdl.WSDLException; +import javax.wsdl.extensions.ExtensibilityElement; +import javax.wsdl.extensions.schema.Schema; +import javax.wsdl.factory.WSDLFactory; +import javax.wsdl.xml.WSDLLocator; +import javax.wsdl.xml.WSDLReader; +import javax.xml.namespace.QName; + +import org.apache.tuscany.sca.binding.ws.WebServiceBinding; +import org.apache.tuscany.sca.interfacedef.DataType; +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.interfacedef.java.JavaInterface; +import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; +import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory; +import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition; +import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface; +import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract; +import org.apache.tuscany.sca.interfacedef.wsdl.impl.InvalidWSDLException; +import org.apache.tuscany.sca.interfacedef.wsdl.impl.WSDLOperationIntrospectorImpl; +import org.apache.tuscany.sca.interfacedef.wsdl.xml.XMLDocumentHelper; +import org.apache.tuscany.sca.policy.Intent; +import org.apache.tuscany.sca.policy.IntentAttachPoint; +import org.apache.ws.commons.schema.XmlSchemaCollection; +import org.apache.ws.java2wsdl.Java2WSDLBuilder; +import org.osoa.sca.annotations.OneWay; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.xml.sax.InputSource; + +/** + * Utility methods to create WSDL objects from Java interfaces + */ +public class Java2WSDLHelper { + + /** + * Create a WSDLInterfaceContract from a JavaInterfaceContract + */ + public static WSDLInterfaceContract createWSDLInterfaceContract(JavaInterfaceContract contract, WebServiceBinding wsBinding) { + JavaInterface iface = (JavaInterface)contract.getInterface(); + Definition def = Java2WSDLHelper.createDefinition(iface.getJavaClass(), wsBinding); + + DefaultWSDLFactory wsdlFactory = new DefaultWSDLFactory(); + + WSDLInterfaceContract wsdlContract = wsdlFactory.createWSDLInterfaceContract(); + WSDLInterface wsdlInterface = wsdlFactory.createWSDLInterface(); + + wsdlContract.setInterface(wsdlInterface); + WSDLDefinition wsdlDefinition = new DefaultWSDLFactory().createWSDLDefinition(); + wsdlDefinition.setDefinition(def); + wsdlInterface.setWsdlDefinition(wsdlDefinition); + wsdlInterface.setRemotable(true); + wsdlInterface.setConversational(contract.getInterface().isConversational()); + wsdlInterface.setUnresolved(false); + wsdlInterface.setRemotable(true); + PortType portType = (PortType)def.getAllPortTypes().values().iterator().next(); + wsdlInterface.setPortType(portType); + + readInlineSchemas(def, wsdlDefinition.getInlinedSchemas()); + + try { + for (Operation op : iface.getOperations()) { + javax.wsdl.Operation wsdlOp = portType.getOperation(op.getName(), null, null); + WSDLOperationIntrospectorImpl opx = + new WSDLOperationIntrospectorImpl(wsdlFactory, wsdlOp, wsdlDefinition.getInlinedSchemas(), null, + null); + + Operation clonedOp = (Operation)op.clone(); + clonedOp.setDataBinding(null); + + if (clonedOp.getInputType().getLogical().isEmpty()) { + // null args case needs a single input type for the wrapper + clonedOp.setInputType(opx.getInputType()); + } + for (DataType dt : clonedOp.getInputType().getLogical()) { + dt.setDataBinding(null); + } + + if (clonedOp.getOutputType() != null ){ + clonedOp.getOutputType().setDataBinding(null); + } + for (DataType dt : clonedOp.getFaultTypes()) { + dt.setDataBinding(null); + } + clonedOp.setWrapperStyle(true); + clonedOp.setWrapper(opx.getWrapper().getWrapperInfo()); + + wsdlInterface.getOperations().add(clonedOp); + } + } catch (CloneNotSupportedException e) { + throw new RuntimeException(e); + } catch (InvalidWSDLException e) { + throw new RuntimeException(e); + } + + return wsdlContract; + } + + protected static void readInlineSchemas(Definition definition, XmlSchemaCollection schemaCollection) { + Types types = definition.getTypes(); + if (types != null) { + for (Object ext : types.getExtensibilityElements()) { + if (ext instanceof Schema) { + Element element = ((Schema)ext).getElement(); + schemaCollection.setBaseUri(((Schema)ext).getDocumentBaseURI()); + schemaCollection.read(element, definition.getDocumentBaseURI()); + } + } + } + for (Object imports : definition.getImports().values()) { + List impList = (List)imports; + for (Object i : impList) { + javax.wsdl.Import anImport = (javax.wsdl.Import)i; + // Read inline schemas + if (anImport.getDefinition() != null) { + readInlineSchemas(anImport.getDefinition(), schemaCollection); + } + } + } + } + + /** + * Create a WSDL4J Definition object from a Java interface + */ + protected static Definition createDefinition(Class javaInterface, WebServiceBinding wsBinding) { + + String className = javaInterface.getName(); + ClassLoader cl = javaInterface.getClassLoader(); + ByteArrayOutputStream os = new ByteArrayOutputStream(); + Java2WSDLBuilder builder = new Java2WSDLBuilder(os, className, cl); + + try { + builder.generateWSDL(); + } catch (Exception e) { + throw new RuntimeException(e); + } + + try { + + WSDLReader reader = javax.wsdl.factory.WSDLFactory.newInstance().newWSDLReader(); + reader.setFeature("javax.wsdl.verbose", false); + reader.setFeature("javax.wsdl.importDocuments", true); + + WSDLLocatorImpl locator = new WSDLLocatorImpl(new ByteArrayInputStream(os.toByteArray())); + Definition definition = reader.readWSDL(locator); + + processSOAPVersion(definition, wsBinding); + processNoArgAndVoidReturnMethods(definition, javaInterface); + + return definition; + + } catch (WSDLException e) { + throw new RuntimeException(e); + } + } + + private static void processSOAPVersion(Definition definition, WebServiceBinding wsBinding) { + if (requiresSOAP12(wsBinding)) { + removePort(definition, "SOAP11port_http"); + } else { + removePort(definition, "SOAP12port_http"); + } + } + + private static void removePort(Definition definition, String portNameSuffix) { + Service service = (Service)definition.getServices().values().iterator().next(); + Map ports = service.getPorts(); + for (Object o : ports.keySet()) { + if (((String)o).endsWith(portNameSuffix)) { + Port p = (Port) ports.remove(o); + definition.removeBinding(p.getBinding().getQName()); + break; + } + } + } + + private static final QName SOAP12_INTENT = new QName("http://www.osoa.org/xmlns/sca/1.0", "soap12"); + + private static boolean requiresSOAP12(WebServiceBinding wsBinding) { + if (wsBinding instanceof IntentAttachPoint) { + List intents = ((IntentAttachPoint)wsBinding).getRequiredIntents(); + for (Intent intent : intents) { + if (SOAP12_INTENT.equals(intent.getName())) { + return true; + } + } + } + return false; + } + + private static void processNoArgAndVoidReturnMethods(Definition definition, Class javaInterface) { + String namespaceURI = definition.getTargetNamespace(); + String prefix = definition.getPrefix(namespaceURI); + String xsPrefix = definition.getPrefix("http://www.w3.org/2001/XMLSchema"); + PortType portType = (PortType)definition.getAllPortTypes().values().iterator().next(); + + Element schema = null; + Document document = null; + Types types = definition.getTypes(); + if (types != null) { + for (Object ext : types.getExtensibilityElements()) { + if (ext instanceof Schema) { + Element element = ((Schema)ext).getElement(); + if (element.getAttribute("targetNamespace").equals(namespaceURI)) { + schema = element; + document = schema.getOwnerDocument(); + break; + } + } + } + } + if (document == null) { + return; + } + + // look at each operation in the port type to see if it needs fixing up + for (Object oper : portType.getOperations()) { + javax.wsdl.Operation operation = (javax.wsdl.Operation)oper; + String opName = operation.getName(); + + // if input message has no parts, add one containing an empty wrapper + Input input = operation.getInput(); + if (input != null) { + Message inputMsg = input.getMessage(); + if (inputMsg.getParts().isEmpty()) { + // create wrapper element and add it to the schema DOM + Element wrapper = document.createElementNS("http://www.w3.org/2001/XMLSchema", + xsPrefix + ":element"); + wrapper.setAttribute("name", opName); + schema.appendChild(wrapper); + Element complexType = document.createElementNS("http://www.w3.org/2001/XMLSchema", + xsPrefix + ":complexType"); + wrapper.appendChild(complexType); + + // create new part for the wrapper and add it to the message + Part part = definition.createPart(); + part.setName("parameters"); + part.setElementName(new QName(namespaceURI, opName, prefix)); + inputMsg.addPart(part); + } + } + + // if two-way operation has no output message, add one containing an empty wrapper + if (input != null && operation.getOutput() == null) { + boolean isOneWay = false; + Method[] methods = javaInterface.getMethods(); + for (Method method : methods) { + if (method.getName().equals(opName) && method.getAnnotation(OneWay.class) != null) { + isOneWay = true; + } + } + if (!isOneWay) { + // create wrapper element and add it to the schema DOM + String msgName = opName + "Response"; + Element wrapper = document.createElementNS("http://www.w3.org/2001/XMLSchema", + xsPrefix + ":element"); + wrapper.setAttribute("name", msgName); + schema.appendChild(wrapper); + Element complexType = document.createElementNS("http://www.w3.org/2001/XMLSchema", + xsPrefix + ":complexType"); + wrapper.appendChild(complexType); + + // create new part for the wrapper + Part part = definition.createPart(); + part.setName("parameters"); + part.setElementName(new QName(namespaceURI, msgName, prefix)); + + // create new message for the part + Message outputMsg = definition.createMessage(); + outputMsg.setQName(new QName(namespaceURI, msgName, prefix)); + outputMsg.addPart(part); + outputMsg.setUndefined(false); + definition.addMessage(outputMsg); + + // create output element for the operation + Output output = definition.createOutput(); + output.setMessage(outputMsg); + output.setExtensionAttribute(new QName("http://www.w3.org/2006/05/addressing/wsdl", "Action"), + new QName("urn:" + msgName)); + operation.setOutput(output); + operation.setStyle(OperationType.REQUEST_RESPONSE); + + // add binding output element to bindings for this port type + for (Object bindObj : definition.getAllBindings().values()) { + Binding binding = (Binding)bindObj; + if (binding.getPortType().equals(portType)) { + BindingOperation op = binding.getBindingOperation(opName, null, null); + if (op != null && op.getBindingInput() != null && op.getBindingOutput() == null) { + BindingOutput bindingOut = definition.createBindingOutput(); + for (Object extObj : op.getBindingInput().getExtensibilityElements()) { + bindingOut.addExtensibilityElement((ExtensibilityElement)extObj); + } + op.setBindingOutput(bindingOut); + } + } + } + } + } + } + + } + +} + +class WSDLLocatorImpl implements WSDLLocator { + private InputStream inputStream; + private String base = "http://"; + private String latestImportURI; + + public WSDLLocatorImpl(InputStream is) { + this.inputStream = is; + } + + public void close() { + try { + inputStream.close(); + } catch (IOException e) { + // Ignore + } + } + + public InputSource getBaseInputSource() { + try { + return XMLDocumentHelper.getInputSource(new URL(base), inputStream); + } catch (IOException e) { + throw new IllegalArgumentException(e); + } + } + + public String getBaseURI() { + return base; + } + + public InputSource getImportInputSource(String parentLocation, String importLocation) { + return null; + } + + public String getLatestImportURI() { + return latestImportURI; + } + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyAxisConfigurator.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyAxisConfigurator.java new file mode 100755 index 0000000000..ed2d862722 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyAxisConfigurator.java @@ -0,0 +1,173 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.binding.ws.axis2; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; + +import org.apache.axis2.AxisFault; +import org.apache.axis2.Constants; +import org.apache.axis2.context.ConfigurationContext; +import org.apache.axis2.context.ConfigurationContextFactory; +import org.apache.axis2.deployment.DeploymentConstants; +import org.apache.axis2.deployment.DeploymentErrorMsgs; +import org.apache.axis2.deployment.DeploymentException; +import org.apache.axis2.deployment.ModuleBuilder; +import org.apache.axis2.deployment.URLBasedAxisConfigurator; +import org.apache.axis2.deployment.util.Utils; +import org.apache.axis2.description.AxisModule; +import org.apache.axis2.description.Parameter; +import org.apache.axis2.engine.AxisConfiguration; +import org.apache.axis2.engine.AxisConfigurator; +import org.apache.axis2.i18n.Messages; +import org.apache.axis2.util.Loader; + +/** + * Helps configure Axis2 from a resource in binding.ws.axis2 instead of Axis2.xml + *

TODO: Review: should there be a single global Axis ConfigurationContext + */ +public class TuscanyAxisConfigurator extends URLBasedAxisConfigurator implements AxisConfigurator { + + /* these two fields are part of a temporary fix to solve problems that maven has with including + * rampart-1.3.mar into the classpath and also at the time of Release 1.0 rampart-1.3.mar seems + * to pull in a SNAPSHOT version of rampart-project pom. Hence rampart.mar has been excluded + * as a maven dependency and has been packed with this module + */ + /************start of fix *********************************************************************/ + private URL axis2_xml = + TuscanyAxisConfigurator.class.getResource("/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml"); + private URL axis2_repository = null; + private URL rampart_mar_url = + TuscanyAxisConfigurator.class.getResource("/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/rampart-1.3.mar"); + /************** end of fix *************************************************************/ + + public TuscanyAxisConfigurator() throws AxisFault { + //super(TuscanyAxisConfigurator.class.getResource("/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml"), + // TuscanyAxisConfigurator.class.getResource("/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/rampart.mar")); + super(TuscanyAxisConfigurator.class.getResource("/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml"), + null); + } + + public ConfigurationContext getConfigurationContext() throws AxisFault { + if (configContext == null) { + configContext = ConfigurationContextFactory.createConfigurationContext(this); + } + return configContext; + } + + /* these three methods are part of a temporary fix to solve problems that maven has with including + * rampart-1.3.mar into the classpath and also at the time of Release 1.0 rampart-1.3.mar seems + * to pull in a SNAPSHOT version of rampart-project pom. Hence rampart.mar has been excluded + * as a maven dependency and has been packed with this module + */ + /************start of fix *********************************************************************/ + public AxisConfiguration getAxisConfiguration() throws AxisFault { + InputStream axis2xmlStream; + try { + if (axis2_xml == null) { + axis2xmlStream = + Loader.getResourceAsStream(DeploymentConstants.AXIS2_CONFIGURATION_RESOURCE); + } else { + axis2xmlStream = axis2_xml.openStream(); + } + axisConfig = populateAxisConfiguration(axis2xmlStream); + if (axis2_repository == null) { + Parameter axis2repoPara = axisConfig.getParameter(DeploymentConstants.AXIS2_REPO); + if (axis2repoPara != null) { + String repoValue = (String) axis2repoPara.getValue(); + if (repoValue != null && !"".equals(repoValue.trim())) { + if (repoValue.startsWith("file:/")) { + // we treat this case specially , by assuming file is + // located in the local machine + loadRepository(repoValue); + } else { + loadRepositoryFromURL(new URL(repoValue)); + } + } + } else { + //log.info("No repository found , module will be loaded from classpath"); + try { + loadFromClassPath(); + } catch ( Exception e ) { + loadRampartModule(); + } + } + + } else { + loadRepositoryFromURL(axis2_repository); + } + + } catch (IOException e) { + throw new AxisFault(e.getMessage()); + } + axisConfig.setConfigurator(this); + return axisConfig; + } + + public void loadRampartModule() throws DeploymentException { + try { + ClassLoader deploymentClassLoader = + Utils.createClassLoader( + new URL[]{rampart_mar_url}, + axisConfig.getModuleClassLoader(), + true, + (File) axisConfig.getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR)); + AxisModule module = new AxisModule(); + module.setModuleClassLoader(deploymentClassLoader); + module.setParent(axisConfig); + //String moduleFile = fileUrl.substring(0, fileUrl.indexOf(".mar")); + if (module.getName() == null) { + module.setName(org.apache.axis2.util.Utils.getModuleName("rampart-1.3")); + module.setVersion(org.apache.axis2.util.Utils.getModuleVersion("rampart-1.3")); + } + populateModule(module, rampart_mar_url); + module.setFileName(rampart_mar_url); + addNewModule(module, axisConfig); + org.apache.axis2.util.Utils. + calculateDefaultModuleVersion(axisConfig.getModules(), axisConfig); + axisConfig.validateSystemPredefinedPhases(); + } catch (IOException e) { + throw new DeploymentException(e); + } + } + + private void populateModule(AxisModule module, URL moduleUrl) throws DeploymentException { + try { + ClassLoader classLoader = module.getModuleClassLoader(); + InputStream moduleStream = classLoader.getResourceAsStream("META-INF/module.xml"); + if (moduleStream == null) { + moduleStream = classLoader.getResourceAsStream("meta-inf/module.xml"); + } + if (moduleStream == null) { + throw new DeploymentException( + Messages.getMessage( + DeploymentErrorMsgs.MODULE_XML_MISSING, moduleUrl.toString())); + } + ModuleBuilder moduleBuilder = new ModuleBuilder(moduleStream, module, axisConfig); + moduleBuilder.populateModule(); + } catch (IOException e) { + throw new DeploymentException(e); + } + } + + /************** end of fix *************************************************************/ + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyDispatcher.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyDispatcher.java new file mode 100644 index 0000000000..c761c7481e --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyDispatcher.java @@ -0,0 +1,103 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2; + +import java.net.URI; +import java.util.HashMap; + +import org.apache.axis2.AxisFault; +import org.apache.axis2.addressing.EndpointReference; +import org.apache.axis2.context.ConfigurationContext; +import org.apache.axis2.context.MessageContext; +import org.apache.axis2.description.AxisService; +import org.apache.axis2.description.HandlerDescription; +import org.apache.axis2.engine.AxisConfiguration; +import org.apache.axis2.engine.RequestURIBasedDispatcher; +import org.apache.axis2.util.JavaUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * A Tuscany specific Axis2 Dispatcher that enables using services + * exposed at the SCA defined service URI instead of /services/ + */ +public class TuscanyDispatcher extends RequestURIBasedDispatcher { + + public static final String NAME = "TuscanyDispatcher"; + private static final Log log = LogFactory.getLog(RequestURIBasedDispatcher.class); + private static final boolean isDebugEnabled = log.isDebugEnabled(); + + /* + * (non-Javadoc) + * + * @see org.apache.axis2.engine.AbstractDispatcher#findService(org.apache.axis2.context.MessageContext) + */ + @Override + public AxisService findService(MessageContext messageContext) throws AxisFault { + EndpointReference toEPR = messageContext.getTo(); + + if (toEPR != null) { + if(isDebugEnabled){ + log.debug("Checking for Service using target endpoint address : " + toEPR.getAddress()); + } + + String path = URI.create(toEPR.getAddress()).getPath(); + + ConfigurationContext configurationContext = messageContext.getConfigurationContext(); + AxisConfiguration registry = configurationContext.getAxisConfiguration(); + + String serviceName = findAxisServiceName(registry, path); + return registry.getService(serviceName); + + } else { + if(isDebugEnabled){ + log.debug("Attempted to check for Service using null target endpoint URI"); + } + return null; + } + } + + @Override + public void initDispatcher() { + init(new HandlerDescription(NAME)); + } + + protected String findAxisServiceName(AxisConfiguration registry, String path) { + HashMap services = registry.getServices(); + if (services == null) { + return null; + } + String[] parts = JavaUtils.split(path, '/'); + String serviceName = ""; + for (int i=parts.length-1; i>=0; i--) { + serviceName = parts[i] + serviceName; + if (services.containsKey(serviceName)) { + return serviceName; + } + serviceName = "/" + serviceName; + if (services.containsKey(serviceName)) { + return serviceName; + } + } + + return null; + } + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyListingAgent.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyListingAgent.java new file mode 100644 index 0000000000..8ff52413e1 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyListingAgent.java @@ -0,0 +1,411 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.Service; +import javax.wsdl.extensions.soap.SOAPAddress; +import javax.wsdl.extensions.soap12.SOAP12Address; +import javax.xml.stream.FactoryConfigurationError; +import javax.xml.stream.XMLOutputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamWriter; + +import org.apache.axiom.attachments.utils.IOUtils; +import org.apache.axis2.AxisFault; +import org.apache.axis2.Constants; +import org.apache.axis2.context.ConfigurationContext; +import org.apache.axis2.deployment.DeploymentConstants; +import org.apache.axis2.description.AxisDescription; +import org.apache.axis2.description.AxisService; +import org.apache.axis2.description.Parameter; +import org.apache.axis2.description.PolicyInclude; +import org.apache.axis2.transport.http.ListingAgent; +import org.apache.axis2.util.ExternalPolicySerializer; +import org.apache.axis2.util.JavaUtils; +import org.apache.axis2.wsdl.WSDLConstants; +import org.apache.neethi.Policy; +import org.apache.neethi.PolicyRegistry; +import org.apache.ws.commons.schema.XmlSchema; + +/** + * A Tuscany specific Axis2 ListingAgent as the Axis2 one does not work + * with the Tuscany sevice names which include slash ('/') characters. + * Unfortunately it ends up having to copy a fair amount of Axis2 code to do this. + */ +public class TuscanyListingAgent extends ListingAgent { + + private static final String LIST_SINGLE_SERVICE_JSP_NAME = + "listSingleService.jsp"; + + public TuscanyListingAgent(ConfigurationContext aConfigContext) { + super(aConfigContext); + } + + protected String findAxisServiceName(String path) { + HashMap services = configContext.getAxisConfiguration().getServices(); + if (services == null) { + return null; + } + String[] parts = JavaUtils.split(path, '/'); + String serviceName = ""; + for (int i=parts.length-1; i>=0; i--) { + serviceName = parts[i] + serviceName; + if (services.containsKey(serviceName)) { + return serviceName; + } + serviceName = "/" + serviceName; + if (services.containsKey(serviceName)) { + return serviceName; + } + } + + return null; + } + + @Override + public void processListService(HttpServletRequest req, + HttpServletResponse res) + throws IOException, ServletException { + + + String filePart = req.getRequestURL().toString(); +// String serviceName = filePart.substring(filePart.lastIndexOf("/") + 1, +// filePart.length()); +// Change the Axis2 code so as to use the complete ServletPath as the service name +// this line is the only change to to Axis2 code + + String serviceName = findAxisServiceName(filePart); + setContextRoot(filePart, serviceName); + + String query = req.getQueryString(); + int wsdl2 = query.indexOf("wsdl2"); + int wsdl = query.indexOf("wsdl"); + int xsd = query.indexOf("xsd"); + int policy = query.indexOf("policy"); + + HashMap services = configContext.getAxisConfiguration().getServices(); + if ((services != null) && !services.isEmpty()) { + Object serviceObj = services.get(serviceName); + if (serviceObj != null) { + boolean isHttp = "http".equals(req.getScheme()); + if (wsdl2 >= 0) { + OutputStream out = res.getOutputStream(); + res.setContentType("text/xml"); + String ip = extractHostAndPort(filePart, isHttp); +// JIRA TUSCANY-1561 Port to Axis2 1.3 +// ((AxisService) serviceObj).printWSDL2(out, ip, configContext.getServiceContextPath()); + ((AxisService) serviceObj).printWSDL2(out, ip); + out.flush(); + out.close(); + return; + } else if (wsdl >= 0) { + OutputStream out = res.getOutputStream(); + res.setContentType("text/xml"); + String ip = extractHostAndPort(filePart, isHttp); + patchSOAP12Port((AxisService)serviceObj); +// JIRA TUSCANY-1561 Port to Axis2 1.3 +// ((AxisService) serviceObj).printWSDL(out, ip, configContext.getServicePath()); + ((AxisService) serviceObj).printWSDL(out, ip); + out.flush(); + out.close(); + return; + } else if (xsd >= 0) { + OutputStream out = res.getOutputStream(); + res.setContentType("text/xml"); + AxisService axisService = (AxisService) serviceObj; + //call the populator + axisService.populateSchemaMappings(); + Map schemaMappingtable = + axisService.getSchemaMappingTable(); + ArrayList schemas = axisService.getSchema(); + + //a name is present - try to pump the requested schema + String xsds = req.getParameter("xsd"); + if (!"".equals(xsds)) { + XmlSchema schema = + (XmlSchema) schemaMappingtable.get(xsds); + if (schema != null) { + //schema is there - pump it outs + schema.write(new OutputStreamWriter(out, "UTF8")); + out.flush(); + out.close(); + } else { + InputStream in = axisService.getClassLoader() + .getResourceAsStream(DeploymentConstants.META_INF + "/" + xsds); + if (in != null) { + out.write(IOUtils.getStreamAsByteArray(in)); + out.flush(); + out.close(); + } else { + res.sendError(HttpServletResponse.SC_NOT_FOUND); + } + } + + //multiple schemas are present and the user specified + //no name - in this case we cannot possibly pump a schema + //so redirect to the service root + } else if (schemas.size() > 1) { + res.sendRedirect(""); + //user specified no name and there is only one schema + //so pump that out + } else { + XmlSchema schema = axisService.getSchema(0); + if (schema != null) { + schema.write(new OutputStreamWriter(out, "UTF8")); + out.flush(); + out.close(); + } + } + return; + } else if (policy >= 0) { + + OutputStream out = res.getOutputStream(); + + ExternalPolicySerializer serializer = new ExternalPolicySerializer(); + serializer.setAssertionsToFilter(configContext + .getAxisConfiguration().getLocalPolicyAssertions()); + + // check whether Id is set + String idParam = req.getParameter("id"); + + if (idParam != null) { + // Id is set + + Policy targetPolicy = findPolicy(idParam, (AxisService) serviceObj); + + if (targetPolicy != null) { + XMLStreamWriter writer; + + try { + writer = XMLOutputFactory.newInstance() + .createXMLStreamWriter(out); + + res.setContentType("text/xml"); + targetPolicy.serialize(writer); + writer.flush(); + + } catch (XMLStreamException e) { + throw new ServletException( + "Error occured when serializing the Policy", + e); + + } catch (FactoryConfigurationError e) { + throw new ServletException( + "Error occured when serializing the Policy", + e); + } + + } else { + + res.setContentType("text/html"); + String outStr = "No policy found for id=" + + idParam + ""; + out.write(outStr.getBytes()); + } + + } else { + + PolicyInclude policyInclude = ((AxisService) serviceObj).getPolicyInclude(); + Policy effecPolicy = policyInclude.getEffectivePolicy(); + + if (effecPolicy != null) { + XMLStreamWriter writer; + + try { + writer = XMLOutputFactory.newInstance() + .createXMLStreamWriter(out); + + res.setContentType("text/xml"); + effecPolicy.serialize(writer); + writer.flush(); + + } catch (XMLStreamException e) { + throw new ServletException( + "Error occured when serializing the Policy", + e); + + } catch (FactoryConfigurationError e) { + throw new ServletException( + "Error occured when serializing the Policy", + e); + } + } else { + + res.setContentType("text/html"); + String outStr = "No effective policy for " + + serviceName + " servcie"; + out.write(outStr.getBytes()); + } + } + + return; + } else { + req.getSession().setAttribute(Constants.SINGLE_SERVICE, + serviceObj); + } + } else { + req.getSession().setAttribute(Constants.SINGLE_SERVICE, null); + } + } + + renderView(LIST_SINGLE_SERVICE_JSP_NAME, req, res); + } + + /** + * Hack for Tuscany to get ?wsdl working with Tuscany service names + * Can go once moved up to Axis2 1.3 + */ + private void setContextRoot(String filePart, String serviceName) { + String contextRoot = configContext.getContextRoot(); + if (contextRoot != null && contextRoot.length() > 0) { + if (contextRoot.equals("/")) { + configContext.setServicePath("/"); + } else { + int i = filePart.indexOf(contextRoot) + contextRoot.length(); + int j = filePart.lastIndexOf(serviceName); + if (i==j) { + configContext.setServicePath("/"); + } else { + String mapping = filePart.substring(i+1, j); + configContext.setServicePath(mapping); + } + } + configContext.setContextRoot(contextRoot); + } + } + + private String extractHostAndPort(String filePart, boolean isHttp) { + int ipindex = filePart.indexOf("//"); + String ip = null; + if (ipindex >= 0) { + ip = filePart.substring(ipindex + 2, filePart.length()); + int seperatorIndex = ip.indexOf(":"); + int slashIndex = ip.indexOf("/"); + String port; + if (seperatorIndex >= 0) { + port = ip.substring(seperatorIndex + 1, slashIndex); + ip = ip.substring(0, seperatorIndex); + } else { + ip = ip.substring(0, slashIndex); + port = "80"; + } + if (isHttp) { + configContext.setProperty(RUNNING_PORT, port); + } + } + return ip; + } + + private Policy findPolicy(String id, AxisDescription des) { + + List policyElements = des.getPolicyInclude().getPolicyElements(); + PolicyRegistry registry = des.getPolicyInclude().getPolicyRegistry(); + + Object policyComponent; + + Policy policy = registry.lookup(id); + + if (policy != null) { + return policy; + } + + for (Iterator iterator = policyElements.iterator(); iterator.hasNext();) { + policyComponent = iterator.next(); + + if (policyComponent instanceof Policy) { + // policy found for the id + + if (id.equals(((Policy) policyComponent).getId())) { + return (Policy) policyComponent; + } + } + } + + AxisDescription child; + + for (Iterator iterator = des.getChildren(); iterator.hasNext();) { + child = (AxisDescription) iterator.next(); + policy = findPolicy(id, child); + + if (policy != null) { + return policy; + } + } + + return null; + } + + /** + * Hack to get ?wsdl working with soap 1.2 + * Fixed in Axis2 1.3 + */ + private void patchSOAP12Port(AxisService as) throws AxisFault { + Parameter wsld4jdefinition = as.getParameter(WSDLConstants.WSDL_4_J_DEFINITION); + Definition definition = (Definition) wsld4jdefinition.getValue(); + setPortAddress(definition, null, as); + } + + /** + * This is a copy of the AxisService setPortAddress patched to work with SOAP 1.2 Addresses + * Fixed in Axis2 1.3 + */ + private void setPortAddress(Definition definition, String requestIP, AxisService axisService) throws AxisFault { + Iterator serviceItr = definition.getServices().values().iterator(); + while (serviceItr.hasNext()) { + Service serviceElement = (Service) serviceItr.next(); + Iterator portItr = serviceElement.getPorts().values().iterator(); + while (portItr.hasNext()) { + Port port = (Port) portItr.next(); + List list = port.getExtensibilityElements(); + for (int i = 0; i < list.size(); i++) { + Object extensibilityEle = list.get(i); + String locationURI = null; + if (requestIP == null) { + locationURI = axisService.getEPRs()[0]; + } else { +// can't do this as the method's not visible, but Tuscany doesn't use this path anyway +// locationURI = axisService.getEPRs(requestIP)[0]); + } + if (extensibilityEle instanceof SOAPAddress) { + ((SOAPAddress) extensibilityEle).setLocationURI(locationURI); + } else if (extensibilityEle instanceof SOAP12Address) { + ((SOAP12Address) extensibilityEle).setLocationURI(locationURI); + } + } + } + } + } + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory new file mode 100644 index 0000000000..a48ff54c77 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Implementation class for the binding extension +org.apache.tuscany.sca.binding.ws.axis2.Axis2BindingProviderFactory;model=org.apache.tuscany.sca.binding.ws.WebServiceBinding diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml new file mode 100755 index 0000000000..b4e2490588 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml @@ -0,0 +1,478 @@ + + + + + + + + true + false + false + false + + + + + + + + + 30000 + + + + + + true + + + + + + false + + admin + axis2 + + + + + + + + + + + + + + + + + + + + + + + + / + + + + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6060 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + > + + + + + + + + + + + + + HTTP/1.1 + chunked + + + + + + + HTTP/1.1 + chunked + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/modules.list b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/modules.list new file mode 100644 index 0000000000..1641457d28 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/modules.list @@ -0,0 +1 @@ +rampart-1.3.mar \ No newline at end of file diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/rampart-1.3.mar b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/rampart-1.3.mar new file mode 100644 index 0000000000..af3c45aa93 Binary files /dev/null and b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/rampart-1.3.mar differ diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/services/services.list b/tags/java/sca/1.0/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/services/services.list new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceTestCase.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceTestCase.java new file mode 100755 index 0000000000..2ce23bf2c4 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceTestCase.java @@ -0,0 +1,83 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.binding.ws.axis2; + +import junit.framework.TestCase; + +public class Axis2ReferenceTestCase extends TestCase { + + public void testInvokeService() throws Exception { +// Axis2ReferenceBinding axis2Reference = createAxis2Reference("testWebAppName", "testServiceName"); +// ServiceContract contract = new JavaServiceContract(); +// Operation operation = new Operation("sayHi", null, null, null, false, null, NO_CONVERSATION); +// TargetInvoker targetInvoker = axis2Reference.createTargetInvoker(contract, operation); +// assertNotNull(targetInvoker); +// assertFalse(targetInvoker instanceof Axis2AsyncTargetInvoker); + } + + public void testAsyncTargetInvoker() throws Exception { +// Axis2ReferenceBinding axis2Reference = createAxis2Reference("testWebAppName", "testServiceName"); +// //Create a mocked InboundWire, make the call of ServiceBindingExtension.getInterface() returns a Class +// Wire inboundWire = EasyMock.createNiceMock(Wire.class); +// JavaServiceContract contract = new JavaServiceContract(Greeter.class); +// contract.setCallbackName(""); +// contract.setCallbackClass(GreetingCallback.class); +// Operation callbackOp = +// new Operation("sayHiCallback", null, null, null, true, null, NO_CONVERSATION); +// HashMap> callbackOps = new HashMap>(); +// callbackOps.put("sayHiCallback", callbackOp); +// contract.setCallbackOperations(callbackOps); +// EasyMock.expect(inboundWire.getTargetContract()).andReturn(contract).anyTimes(); +// EasyMock.replay(inboundWire); +// +// axis2Reference.setWire(inboundWire); +// Operation operation = new Operation("sayHi", null, null, null, true, null, NO_CONVERSATION); +// TargetInvoker asyncTargetInvoker = axis2Reference.createTargetInvoker(contract, operation); +// assertNotNull(asyncTargetInvoker); +// assertTrue(asyncTargetInvoker instanceof Axis2AsyncTargetInvoker); + } + +// @SuppressWarnings("unchecked") +// private Axis2ReferenceBinding createAxis2Reference(String webAppName, String serviceName) throws Exception { +// //Create WebServiceBindingDefinition +// String wsdlLocation = "/wsdl/hello_world_doc_lit.wsdl"; +// URL url = getClass().getResource(wsdlLocation); +// assertNotNull("Could not find wsdl " + url.toString(), url); +// +// WSDLFactory factory = WSDLFactory.newInstance(); +// WSDLReader reader = factory.newWSDLReader(); +// reader.setFeature("javax.wsdl.verbose", false); +// InputSource input = new InputSource(url.openStream()); +// Definition wsdlDef = reader.readWSDL(url.toString(), input); +// Service wsdlService = wsdlDef.getService(new QName("http://objectweb.org/hello_world_soap_http", +// "SOAPService")); +// Port port = wsdlService.getPort("SoapPort"); +// WebServiceBindingDefinition wsBinding = +// new WebServiceBindingDefinition(wsdlDef, port, "uri", "portURI", wsdlService); +// //Create a mocked WireService, make the call of ServiceBindingExtension.getServiceInstance() returns a proxy instance. +// // TODO figure out what to do with the service contract +// ServiceContract contract = new WSDLServiceContract(); +// contract.setInterfaceClass(Greeter.class); +// return new Axis2ReferenceBinding(URI.create(serviceName), +// wsBinding, +// contract, +// null, +// null); +// } +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceTestCase.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceTestCase.java new file mode 100755 index 0000000000..d4d20414e5 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceTestCase.java @@ -0,0 +1,104 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.binding.ws.axis2; + +import junit.framework.TestCase; + +public class Axis2ServiceTestCase extends TestCase { + + public void testInvokeService() throws Exception { +// TestServletHost tomcatHost = new TestServletHost(); +// Axis2ServiceBinding axis2Service = createAxis2Service("testServiceName", tomcatHost, false); +// axis2Service.start(); +// +// if (true) return; +// Servlet servlet = tomcatHost.getMapping("testWebAppName/serviceBindings/testServiceName"); +// assertNotNull(servlet); +// +// //Create mocked HttpRequest and HttpResponse object to test the Axis2Servlet +// //To be done: + + } + + public void testAsyncMessageReceiver() throws Exception { + +// TestServletHost tomcatHost = new TestServletHost(); +// Axis2ServiceBinding axis2Service = createAxis2Service("testServiceName", tomcatHost, true); +// axis2Service.start(); + } + +// @SuppressWarnings("unchecked") +// private Axis2ServiceBinding createAxis2Service(String serviceName, ServletHost tomcatHost, boolean callback) +// throws Exception { +// //Create WebServiceBindingDefinition +// String wsdlLocation = "/wsdl/hello_world_doc_lit.wsdl"; +// URL url = getClass().getResource(wsdlLocation); +// assertNotNull("Could not find wsdl " + url.toString(), url); +// +// WSDLFactory factory = WSDLFactory.newInstance(); +// WSDLReader reader = factory.newWSDLReader(); +// reader.setFeature("javax.wsdl.verbose", false); +// InputSource input = new InputSource(url.openStream()); +// Definition wsdlDef = reader.readWSDL(url.toString(), input); +// Service wsdlService = wsdlDef.getService(new QName("http://objectweb.org/hello_world_soap_http", +// "SOAPService")); +// Port port = wsdlService.getPort("SoapPort"); +// WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition(wsdlDef, port, "uri", "portURI", wsdlService); +// +// //Create a mocked WireService, make the call of ServiceBindingExtension.getServiceInstance() returns a proxy instance. +//// WireService wireService = EasyMock.createNiceMock(WireService.class); +//// wireService.createProxy(EasyMock.isA(Class.class), EasyMock.isA(Wire.class)); +//// EasyMock.expectLastCall().andReturn(null); +//// EasyMock.replay(wireService); +// +// //Create a mocked InboundWire, make the call of ServiceBindingExtension.getInterface() returns a Class +// Wire inboundWire = EasyMock.createNiceMock(Wire.class); +// JavaServiceContract contract = new JavaServiceContract(Greeter.class); +// Map> opMap = new HashMap>(); +// for (Method m : Greeter.class.getMethods()) { +// opMap.put(m.getName(), new Operation(m.getName(), null, null, null)); +// } +// contract.setOperations(opMap); +// EasyMock.expect(inboundWire.getTargetContract()).andReturn(contract).anyTimes(); +// if (callback) { +// contract.setCallbackName(""); +// } +// EasyMock.replay(inboundWire); +// +// Wire outboundWire = EasyMock.createNiceMock(Wire.class); +// Map, InvocationChain> map = new HashMap, InvocationChain>(); +// EasyMock.expect(outboundWire.getInvocationChains()).andReturn(map).once(); +// EasyMock.replay(outboundWire); +// +// TuscanyAxisConfigurator tuscanyAxisConfigurator = new TuscanyAxisConfigurator(); +// ConfigurationContext configurationContext = tuscanyAxisConfigurator.getConfigurationContext(); +// Axis2ServiceBinding axis2Service = +// new Axis2ServiceBinding(URI.create(serviceName), +// contract, +// null, +// wsBinding, +// tomcatHost, +// configurationContext, null); +// axis2Service.setWire(inboundWire); +//// axis2Service.setOutboundWire(outboundWire); +// +// return axis2Service; +// } + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Greeter.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Greeter.java new file mode 100755 index 0000000000..767f59646f --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Greeter.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.binding.ws.axis2; + +public interface Greeter { + + String sayHi(); + + String greetMe(String requestType); + + void greetMeOneWay(String requestType); + + void greetMeWithCallback(String requestType); + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/GreetingCallback.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/GreetingCallback.java new file mode 100644 index 0000000000..e5e76af0b7 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/GreetingCallback.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.binding.ws.axis2; + +public interface GreetingCallback { + + void greetMeCallback(String greetMeResponse); +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Java2WSDLHelperTestCase.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Java2WSDLHelperTestCase.java new file mode 100644 index 0000000000..fe1411a8d3 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Java2WSDLHelperTestCase.java @@ -0,0 +1,75 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.binding.ws.axis2; + +import java.util.List; +import java.util.Map; + +import javax.wsdl.Definition; +import javax.wsdl.Operation; +import javax.wsdl.PortType; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.binding.ws.axis2.Java2WSDLHelper; +import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; +import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory; +import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; +import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface; +import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract; + +public class Java2WSDLHelperTestCase extends TestCase { + + public void testCreateDefinition() { + Definition definition = Java2WSDLHelper.createDefinition(HelloWorld.class, null); + assertNotNull(definition); + + Map portTypes = definition.getPortTypes(); + assertEquals(1, portTypes.size()); + + PortType portType = (PortType)portTypes.values().iterator().next(); + assertEquals("HelloWorldPortType", portType.getQName().getLocalPart()); + assertEquals("http://axis2.ws.binding.sca.tuscany.apache.org", portType.getQName().getNamespaceURI()); + + List ops = portType.getOperations(); + assertEquals(1, ops.size()); + + Operation operation = (Operation)ops.get(0); + assertEquals("sayHello", operation.getName()); + } + + + public void testCreateWSDLInterfaceContract() throws InvalidInterfaceException { + DefaultJavaInterfaceFactory factory = new DefaultJavaInterfaceFactory(); + JavaInterfaceContract javaIC = factory.createJavaInterfaceContract(); + javaIC.setInterface(factory.createJavaInterface(HelloWorld.class)); + WSDLInterfaceContract wsdlIC = Java2WSDLHelper.createWSDLInterfaceContract(javaIC, null); + assertNotNull(wsdlIC); + WSDLInterface wsdlInterface = (WSDLInterface)wsdlIC.getInterface(); + assertNotNull(wsdlInterface); + assertEquals(1, wsdlInterface.getOperations().size()); + assertEquals("sayHello", wsdlInterface.getOperations().get(0).getName()); + assertNotNull(wsdlInterface.getPortType()); + } + +} + +interface HelloWorld { + public String sayHello(String s); +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Bar.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Bar.java new file mode 100644 index 0000000000..2dc7d8dee4 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Bar.java @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2.itests; + +import java.io.Serializable; + +public class Bar implements Serializable { + private static final long serialVersionUID = 1249963611910502668L; + + private String s; + private int x; + private Integer y; + + private Boolean b; + + public Boolean getB() { + return b; + } + public void setB(Boolean b) { + this.b = b; + } + public String getS() { + return s; + } + public void setS(String s) { + this.s = s; + } + public int getX() { + return x; + } + public void setX(int x) { + this.x = x; + } + public Integer getY() { + return y; + } + public void setY(Integer y) { + this.y = y; + } + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Echo.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Echo.java new file mode 100644 index 0000000000..e60c30790a --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Echo.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2.itests; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface Echo { + + public Foo echoFoo(Foo foo); + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/EchoComponent.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/EchoComponent.java new file mode 100644 index 0000000000..5e1a4cf259 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/EchoComponent.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2.itests; + +import org.osoa.sca.annotations.Reference; + +public class EchoComponent implements Echo { + + @Reference + public Echo echoWS; + + public Foo echoFoo(Foo foo) { + return echoWS.echoFoo(foo); + } + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/EchoImpl.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/EchoImpl.java new file mode 100644 index 0000000000..d028ced69e --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/EchoImpl.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2.itests; + + +public class EchoImpl implements Echo { + + public Foo echoFoo(Foo foo) { + return foo; + } + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Foo.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Foo.java new file mode 100644 index 0000000000..c7b503af17 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Foo.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2.itests; + +import java.io.Serializable; + +public class Foo implements Serializable { + private static final long serialVersionUID = 4879476066850018458L; + + private Bar[] bars; + + public Bar[] getBars() { + return bars; + } + + public void setBars(Bar[] bars) { + this.bars = bars; + } +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.java new file mode 100644 index 0000000000..e2f3982d99 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2.itests; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface HelloWorld { + + public String getGreetings(String s); + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldComponent.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldComponent.java new file mode 100644 index 0000000000..88705c1a95 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldComponent.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2.itests; + +import org.osoa.sca.annotations.Reference; + +public class HelloWorldComponent implements HelloWorld { + + @Reference + public HelloWorld helloWorldWS; + + public String getGreetings(String s) { + return helloWorldWS.getGreetings(s); + } + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldMultiService.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldMultiService.java new file mode 100644 index 0000000000..f30286feea --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldMultiService.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2.itests; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; + +public class HelloWorldMultiService implements HelloWorldOM, HelloWorldOM2 { + + public OMElement getGreetings(OMElement requestOM) { + String name = requestOM.getFirstElement().getText(); + + OMFactory omFactory = OMAbstractFactory.getOMFactory(); + OMElement responseOM = omFactory.createOMElement("getGreetingsResponse", "http://helloworld-om", "helloworld"); + OMElement param = omFactory.createOMElement("getGreetingsReturn", "http://helloworld-om", "helloworld"); + responseOM.addChild(param); + param.addChild(omFactory.createOMText("Hello " + name)); + + return responseOM; + } + + public OMElement getGreetings2(OMElement requestOM) { + String name = requestOM.getFirstElement().getText(); + + OMFactory omFactory = OMAbstractFactory.getOMFactory(); + OMElement responseOM = omFactory.createOMElement("getGreetingsResponse", "http://helloworld-om", "helloworld"); + OMElement param = omFactory.createOMElement("getGreetingsReturn", "http://helloworld-om", "helloworld"); + responseOM.addChild(param); + param.addChild(omFactory.createOMText("Hello2 " + name)); + + return responseOM; + } +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDLTestCase.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDLTestCase.java new file mode 100644 index 0000000000..7ee48d4451 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDLTestCase.java @@ -0,0 +1,77 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2.itests ; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class HelloWorldNoWSDLTestCase extends TestCase { + + private SCADomain domain; + + public void testHelloWorld() throws Exception { + HelloWorld helloWorld = domain.getService(HelloWorld.class, "HelloWorldComponent"); + assertEquals("Hello petra", helloWorld.getGreetings("petra")); + } + + /** + * Test a a WS call with a complex type + */ + public void testEchoFoo() throws Exception { + Echo echo = domain.getService(Echo.class, "EchoComponent"); + + Foo f = new Foo(); + Bar b1 = new Bar(); + b1.setS("petra"); + b1.setX(1); + b1.setY(new Integer(2)); + b1.setB(Boolean.TRUE); + Bar b2 = new Bar(); + b2.setS("beate"); + b2.setX(3); + b2.setY(new Integer(4)); + b2.setB(Boolean.FALSE); + f.setBars(new Bar[] { b1, b2} ); + + Foo f2 = echo.echoFoo(f); + + assertEquals("petra", f2.getBars()[0].getS()); + assertEquals(1, f2.getBars()[0].getX()); + assertEquals(2, f2.getBars()[0].getY().intValue()); + assertTrue(f2.getBars()[0].getB().booleanValue()); + assertEquals("beate", f2.getBars()[1].getS()); + assertEquals(3, f2.getBars()[1].getX()); + assertEquals(4, f2.getBars()[1].getY().intValue()); + assertFalse(f2.getBars()[1].getB().booleanValue()); + + } + + @Override + protected void setUp() throws Exception { + domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDL.composite"); + } + + @Override + protected void tearDown() throws Exception { + domain.close(); + } + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOM.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOM.java new file mode 100644 index 0000000000..f09ca4a435 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOM.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2.itests; + +import org.apache.axiom.om.OMElement; +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface HelloWorldOM { + + public OMElement getGreetings(OMElement parmE); + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOM2.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOM2.java new file mode 100644 index 0000000000..f3a4ae4c8b --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOM2.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2.itests; + +import org.apache.axiom.om.OMElement; +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface HelloWorldOM2 { + + public OMElement getGreetings2(OMElement parmE); + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMComponent.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMComponent.java new file mode 100644 index 0000000000..d1cbfb88fd --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMComponent.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2.itests; + +import org.apache.axiom.om.OMElement; +import org.osoa.sca.annotations.Reference; + +public class HelloWorldOMComponent implements HelloWorldOM { + + @Reference + public HelloWorldOM helloWorldWS; + + public OMElement getGreetings(OMElement om) { + return helloWorldWS.getGreetings(om); + } + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMService.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMService.java new file mode 100644 index 0000000000..69bb571144 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMService.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2.itests; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; + +public class HelloWorldOMService implements HelloWorldOM { + + public OMElement getGreetings(OMElement requestOM) { + String name = requestOM.getFirstElement().getText(); + + OMFactory omFactory = OMAbstractFactory.getOMFactory(); + OMElement responseOM = omFactory.createOMElement("getGreetingsResponse", "http://helloworld-om", "helloworld"); + OMElement param = omFactory.createOMElement("getGreetingsReturn", "http://helloworld-om", "helloworld"); + responseOM.addChild(param); + param.addChild(omFactory.createOMText("Hello " + name)); + + return responseOM; + } + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMTestCase.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMTestCase.java new file mode 100644 index 0000000000..e7511027c2 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMTestCase.java @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2.itests; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.apache.axiom.om.OMText; +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class HelloWorldOMTestCase extends TestCase { + + private SCADomain domain; + private HelloWorldOM helloWorld; + + public void testHelloWorld() throws Exception { + OMFactory fac = OMAbstractFactory.getOMFactory(); + OMElement requestOM = fac.createOMElement("getGreetings", "http://helloworld-om", "helloworld"); + OMElement parmE = fac.createOMElement("name", "http://helloworld-om", "helloworld"); + requestOM.addChild(parmE); + parmE.addChild(fac.createOMText("petra")); + OMElement responseOM = helloWorld.getGreetings(requestOM); + OMElement child = (OMElement)responseOM.getFirstElement(); + Assert.assertEquals("Hello petra", ((OMText)child.getFirstOMChild()).getText()); + } + + @Override + protected void setUp() throws Exception { + domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.composite"); + helloWorld = domain.getService(HelloWorldOM.class, "HelloWorldComponent"); + } + + @Override + protected void tearDown() throws Exception { + domain.close(); + } + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldService.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldService.java new file mode 100644 index 0000000000..017d9bb478 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2.itests; + +public class HelloWorldService implements HelloWorld { + + public String getGreetings(String s) { + return "Hello " + s; + } + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldTestCase.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldTestCase.java new file mode 100644 index 0000000000..a3a43d032f --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldTestCase.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2.itests; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class HelloWorldTestCase extends TestCase { + + private SCADomain domain; + private HelloWorld helloWorld; + + public void testCalculator() throws Exception { + assertEquals("Hello petra", helloWorld.getGreetings("petra")); + } + + @Override + protected void setUp() throws Exception { + domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.composite"); + helloWorld = domain.getService(HelloWorld.class, "HelloWorldComponent"); + } + + @Override + protected void tearDown() throws Exception { + domain.close(); + } + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldWSDLMergedTestCaseFIXME.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldWSDLMergedTestCaseFIXME.java new file mode 100644 index 0000000000..d105e3d50e --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldWSDLMergedTestCaseFIXME.java @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2.itests; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.apache.axiom.om.OMText; +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class HelloWorldWSDLMergedTestCaseFIXME extends TestCase { + + private SCADomain domain; + private HelloWorldOM helloWorld; + + public void testHelloWorld() throws Exception { + OMFactory fac = OMAbstractFactory.getOMFactory(); + OMElement requestOM = fac.createOMElement("getGreetings", "http://helloworld-om", "helloworld"); + OMElement parmE = fac.createOMElement("name", "http://helloworld-om", "helloworld"); + requestOM.addChild(parmE); + parmE.addChild(fac.createOMText("petra")); + OMElement responseOM = helloWorld.getGreetings(requestOM); + OMElement child = (OMElement)responseOM.getFirstElement(); + Assert.assertEquals("Hello petra", ((OMText)child.getFirstOMChild()).getText()); + } + + @Override + protected void setUp() throws Exception { + domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-merged.composite"); + helloWorld = domain.getService(HelloWorldOM.class, "HelloWorldWSDLMergedComponent"); + } + + @Override + protected void tearDown() throws Exception { + domain.close(); + } + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java new file mode 100644 index 0000000000..535ad3eeca --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java @@ -0,0 +1,100 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2.itests; + +import java.util.List; + +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.Service; +import javax.wsdl.extensions.soap.SOAPAddress; +import javax.wsdl.factory.WSDLFactory; +import javax.wsdl.xml.WSDLReader; +import javax.xml.namespace.QName; + +import junit.framework.TestCase; + +import org.apache.axis2.transport.http.server.HttpUtils; +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * Test ?wsdl works and that the returned wsdl has the correct endpoint + */ +public class QuestionMarkWSDLTestCase extends TestCase { + + private SCADomain domain; + + /** + * Tests ?wsdl works and returns the correct port endpoint from the WSDL + */ + public void testWSDLPortEndpoint() throws Exception { + WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader(); + wsdlReader.setFeature("javax.wsdl.verbose",false); + wsdlReader.setFeature("javax.wsdl.importDocuments",true); + + Definition definition = wsdlReader.readWSDL("http://localhost:8085/services/HelloWorldWebService?wsdl"); + assertNotNull(definition); + Service service = definition.getService(new QName("http://helloworld", "HelloWorldService")); + Port port = service.getPort("HelloWorldSoapPort"); + + String endpoint = getEndpoint(port); + String ip = HttpUtils.getIpAddress(); + assertEquals("http://" + ip + ":8085/services/HelloWorldWebService", endpoint); + } + + /** + * Tests ?wsdl works and returns the correct port endpoint from binding.ws with a custom URI + */ + public void testCustomEndpoint() throws Exception { + WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader(); + wsdlReader.setFeature("javax.wsdl.verbose",false); + wsdlReader.setFeature("javax.wsdl.importDocuments",true); + + Definition definition = wsdlReader.readWSDL("http://localhost:8085/foo/bar?wsdl"); + assertNotNull(definition); + Service service = definition.getService(new QName("http://itests.axis2.ws.binding.sca.tuscany.apache.org", "HelloWorld")); + Port port = service.getPort("HelloWorldSOAP11port_http"); + + String endpoint = getEndpoint(port); + String ip = HttpUtils.getIpAddress(); + assertEquals("http://" + ip + ":8085/foo/bar", endpoint); + } + + protected String getEndpoint(Port port) { + List wsdlPortExtensions = port.getExtensibilityElements(); + for (final Object extension : wsdlPortExtensions) { + if (extension instanceof SOAPAddress) { + return ((SOAPAddress) extension).getLocationURI(); + } + } + throw new RuntimeException("no SOAPAddress"); + } + + @Override + protected void setUp() throws Exception { + domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl.composite"); + } + + @Override + protected void tearDown() throws Exception { + domain.close(); + } + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/AbstractHelloWorldOMTestCase.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/AbstractHelloWorldOMTestCase.java new file mode 100644 index 0000000000..56d0537a44 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/AbstractHelloWorldOMTestCase.java @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2.itests.endpoints; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.apache.axiom.om.OMText; +import org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOM; +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public abstract class AbstractHelloWorldOMTestCase extends TestCase { + + private SCADomain domain; + private HelloWorldOM helloWorld; + + public void testCalculator() throws Exception { + OMFactory fac = OMAbstractFactory.getOMFactory(); + OMElement requestOM = fac.createOMElement("getGreetings", "http://helloworld-om", "helloworld"); + OMElement parmE = fac.createOMElement("name", "http://helloworld-om", "helloworld"); + requestOM.addChild(parmE); + parmE.addChild(fac.createOMText("petra")); + OMElement responseOM = helloWorld.getGreetings(requestOM); + OMElement child = (OMElement)responseOM.getFirstElement(); + Assert.assertEquals("Hello petra", ((OMText)child.getFirstOMChild()).getText()); + } + + @Override + protected void setUp() throws Exception { + domain = SCADomain.newInstance(getCompositeName()); + helloWorld = domain.getService(HelloWorldOM.class, "HelloWorldComponent"); + } + + @Override + protected void tearDown() throws Exception { + domain.close(); + } + + protected String getCompositeName() { + String className = this.getClass().getName(); + return className.substring(0, className.length() - 8).replace('.', '/') + ".composite"; + } + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultMultiServiceTestCase.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultMultiServiceTestCase.java new file mode 100644 index 0000000000..661afdddad --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultMultiServiceTestCase.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2.itests.endpoints; + +public class DefaultMultiServiceTestCase extends AbstractHelloWorldOMTestCase { + // super class does it all getting composite based on this class name +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultSingleServiceTestCase.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultSingleServiceTestCase.java new file mode 100644 index 0000000000..9b2e0eafa0 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultSingleServiceTestCase.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2.itests.endpoints; + +public class DefaultSingleServiceTestCase extends AbstractHelloWorldOMTestCase { + // super class does it all getting composite based on this class name +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLExplicitURITestCase.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLExplicitURITestCase.java new file mode 100644 index 0000000000..98d9a73926 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLExplicitURITestCase.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2.itests.endpoints; + +public class WSDLExplicitURITestCase extends AbstractHelloWorldOMTestCase { + // super class does it all getting composite based on this class name +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLRelativeURITestCase.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLRelativeURITestCase.java new file mode 100644 index 0000000000..201d11a79f --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLRelativeURITestCase.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2.itests.endpoints; + +public class WSDLRelativeURITestCase extends AbstractHelloWorldOMTestCase { + // super class does it all getting composite based on this class name +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorldTestCase.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorldTestCase.java new file mode 100644 index 0000000000..f5d87cdcee --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorldTestCase.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2.itests.epr; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorld; +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class HelloWorldTestCase extends TestCase { + + private SCADomain domain; + private HelloWorld helloWorld; + + public void testCalculator() throws Exception { + assertEquals("Hello petra", helloWorld.getGreetings("petra")); + } + + @Override + protected void setUp() throws Exception { + domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorld.composite"); + helloWorld = domain.getService(HelloWorld.class, "HelloWorldComponent"); + } + + @Override + protected void tearDown() throws Exception { + domain.close(); + } + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/AbstractHelloWorldOMTestCase.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/AbstractHelloWorldOMTestCase.java new file mode 100644 index 0000000000..34ecf37f31 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/AbstractHelloWorldOMTestCase.java @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2.itests.policy; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.apache.axiom.om.OMText; +import org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOM; +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public abstract class AbstractHelloWorldOMTestCase extends TestCase { + + private SCADomain domain; + private HelloWorldOM helloWorld; + + public void testHelloWorld() throws Exception { + OMFactory fac = OMAbstractFactory.getOMFactory(); + OMElement requestOM = fac.createOMElement("getGreetings", "http://helloworld-om", "helloworld"); + OMElement parmE = fac.createOMElement("name", "http://helloworld-om", "helloworld"); + requestOM.addChild(parmE); + parmE.addChild(fac.createOMText("petra")); + OMElement responseOM = helloWorld.getGreetings(requestOM); + OMElement child = (OMElement)responseOM.getFirstElement(); + Assert.assertEquals("Hello petra", ((OMText)child.getFirstOMChild()).getText()); + } + + @Override + protected void setUp() throws Exception { + domain = SCADomain.newInstance(getCompositeName()); + helloWorld = domain.getService(HelloWorldOM.class, "HelloWorldComponent"); + } + + @Override + protected void tearDown() throws Exception { + domain.close(); + } + + protected String getCompositeName() { + String className = this.getClass().getName(); + return className.substring(0, className.length() - 8).replace('.', '/') + ".composite"; + } + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/ClientPWCBHandler.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/ClientPWCBHandler.java new file mode 100644 index 0000000000..f674d8a6ca --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/ClientPWCBHandler.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.binding.ws.axis2.itests.policy; + +import java.io.IOException; + +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.UnsupportedCallbackException; + +import org.apache.ws.security.WSPasswordCallback; + +/** + * Sample userid passwd generation class + */ +public class ClientPWCBHandler implements CallbackHandler { + + public void handle(Callback[] callbacks) throws IOException, + UnsupportedCallbackException { + for (int i = 0; i < callbacks.length; i++) { + System.out.println("*** Calling Client UserId/Password Handler .... "); + WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i]; + pwcb.setPassword("TuscanyWsUserPasswd"); + } + } + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/IntegrityPWCBHandler.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/IntegrityPWCBHandler.java new file mode 100644 index 0000000000..ed955ab08b --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/IntegrityPWCBHandler.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.binding.ws.axis2.itests.policy; + +import java.io.IOException; + +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.UnsupportedCallbackException; + +import org.apache.ws.security.WSPasswordCallback; + +/** + * Sample userid passwd generation class + */ +public class IntegrityPWCBHandler implements CallbackHandler { + + public void handle(Callback[] callbacks) throws IOException, + UnsupportedCallbackException { + for (int i = 0; i < callbacks.length; i++) { + System.out.println("*** Calling Integrity Password Handler .... "); + WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i]; + pwcb.setPassword("TuscanyWsUserPasswd"); + } + } + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/ServerPWCBHandler.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/ServerPWCBHandler.java new file mode 100644 index 0000000000..3c34c5e313 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/ServerPWCBHandler.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.binding.ws.axis2.itests.policy; + +import java.io.IOException; + +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.UnsupportedCallbackException; + +import org.apache.ws.security.WSPasswordCallback; + +/** + * Sample userid passwd generation class + */ +public class ServerPWCBHandler implements CallbackHandler { + + public void handle(Callback[] callbacks) throws IOException, + UnsupportedCallbackException { + for (int i = 0; i < callbacks.length; i++) { + System.out.println("*** Calling Server User/Passwd Handler...."); + WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i]; + pwcb.setPassword("TuscanyWsUserPasswd"); + } + } + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurityAuthenticationTestCase.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurityAuthenticationTestCase.java new file mode 100644 index 0000000000..b7716582c5 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurityAuthenticationTestCase.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2.itests.policy; + +public class WSSecurityAuthenticationTestCase extends AbstractHelloWorldOMTestCase { + // super class does it all getting composite based on this class name +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurityConfidentialityTestCaseFIXBouncyCastleIssue.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurityConfidentialityTestCaseFIXBouncyCastleIssue.java new file mode 100644 index 0000000000..3807642d49 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurityConfidentialityTestCaseFIXBouncyCastleIssue.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2.itests.policy; + +import java.security.Provider; +import java.security.Security; + +public class WSSecurityConfidentialityTestCaseFIXBouncyCastleIssue extends AbstractHelloWorldOMTestCase { + + /** + * @see org.apache.tuscany.sca.binding.ws.axis2.itests.policy.AbstractHelloWorldOMTestCase#setUp() + */ + @Override + protected void setUp() throws Exception { + // Workaround an issue with IBM JDK + Provider jce = Security.getProvider("IBMJCE"); + if (jce != null) { + // Make sure IBMJCE is used first + Security.removeProvider("IBMJCE"); + Security.insertProviderAt(jce, 1); + } + super.setUp(); + } + // super class does it all getting composite based on this class name +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurityIntegrityTestCase.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurityIntegrityTestCase.java new file mode 100644 index 0000000000..3d084a8627 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurityIntegrityTestCase.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2.itests.policy; + +public class WSSecurityIntegrityTestCase extends AbstractHelloWorldOMTestCase { + // super class does it all getting composite based on this class name +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12TestCase.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12TestCase.java new file mode 100644 index 0000000000..b2ccd7f97d --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12TestCase.java @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2.itests.soap12 ; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorld; +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class HelloWorldSOAP12TestCase extends TestCase { + + private SCADomain domain; + + public void testHelloWorld() throws Exception { + HelloWorld helloWorld = domain.getService(HelloWorld.class, "HelloWorldClient"); + assertEquals("Hello petra", helloWorld.getGreetings("petra")); + } + public void testHelloWorldSOAP() throws Exception { + HelloWorld helloWorld = domain.getService(HelloWorld.class, "HelloWorldClientSOAP"); + assertEquals("Hello petra", helloWorld.getGreetings("petra")); + } + public void testHelloWorldSOAP11() throws Exception { + HelloWorld helloWorld = domain.getService(HelloWorld.class, "HelloWorldClientSOAP11"); + assertEquals("Hello petra", helloWorld.getGreetings("petra")); + } + public void testHelloWorldSOAP12() throws Exception { + HelloWorld helloWorld = domain.getService(HelloWorld.class, "HelloWorldClientSOAP12"); + assertEquals("Hello petra", helloWorld.getGreetings("petra")); + } + + @Override + protected void setUp() throws Exception { + domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12.composite"); + } + + @Override + protected void tearDown() throws Exception { + domain.close(); + } + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/QuestionMarkWSDLTestCase.java b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/QuestionMarkWSDLTestCase.java new file mode 100644 index 0000000000..9b92f6862f --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/QuestionMarkWSDLTestCase.java @@ -0,0 +1,121 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2.itests.soap12; + +import java.util.List; + +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.Service; +import javax.wsdl.extensions.soap.SOAPAddress; +import javax.wsdl.extensions.soap12.SOAP12Address; +import javax.wsdl.factory.WSDLFactory; +import javax.wsdl.xml.WSDLReader; +import javax.xml.namespace.QName; + +import junit.framework.TestCase; + +import org.apache.axis2.transport.http.server.HttpUtils; +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * Test ?wsdl works and that the returned wsdl has the correct endpoint + */ +public class QuestionMarkWSDLTestCase extends TestCase { + + private SCADomain domain; + + /** + * Tests ?wsdl returns a soap 1.1 port by default + */ + public void testSOAPDefault() throws Exception { + WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader(); + wsdlReader.setFeature("javax.wsdl.verbose",false); + wsdlReader.setFeature("javax.wsdl.importDocuments",true); + + Definition definition = wsdlReader.readWSDL("http://localhost:8085/ep1?wsdl"); + assertNotNull(definition); + Service service = definition.getService(new QName("http://itests.axis2.ws.binding.sca.tuscany.apache.org", "HelloWorld")); + Port port = service.getPort("HelloWorldSOAP11port_http"); + + String endpoint = getEndpoint(port); + String ip = HttpUtils.getIpAddress(); + assertEquals("http://" + ip + ":8085/ep1", endpoint); + } + + /** + * Tests ?wsdl returns a soap 1.1 port when binding uses requires="soap11" + */ + public void testSOAP11Endpoint() throws Exception { + WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader(); + wsdlReader.setFeature("javax.wsdl.verbose",false); + wsdlReader.setFeature("javax.wsdl.importDocuments",true); + + Definition definition = wsdlReader.readWSDL("http://localhost:8085/ep2?wsdl"); + assertNotNull(definition); + Service service = definition.getService(new QName("http://itests.axis2.ws.binding.sca.tuscany.apache.org", "HelloWorld")); + Port port = service.getPort("HelloWorldSOAP11port_http"); + + String endpoint = getEndpoint(port); + String ip = HttpUtils.getIpAddress(); + assertEquals("http://" + ip + ":8085/ep2", endpoint); + } + + /** + * Tests ?wsdl returns a soap 1.2 port when binding uses requires="soap12" + */ + public void testSOAP12Endpoint() throws Exception { + WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader(); + wsdlReader.setFeature("javax.wsdl.verbose",false); + wsdlReader.setFeature("javax.wsdl.importDocuments",true); + + Definition definition = wsdlReader.readWSDL("http://localhost:8085/ep3?wsdl"); + assertNotNull(definition); + Service service = definition.getService(new QName("http://itests.axis2.ws.binding.sca.tuscany.apache.org", "HelloWorld")); + Port port = service.getPort("HelloWorldSOAP12port_http"); + + String endpoint = getEndpoint(port); + String ip = HttpUtils.getIpAddress(); + assertEquals("http://" + ip + ":8085/ep3", endpoint); + } + + protected String getEndpoint(Port port) { + List wsdlPortExtensions = port.getExtensibilityElements(); + for (final Object extension : wsdlPortExtensions) { + if (extension instanceof SOAPAddress) { + return ((SOAPAddress) extension).getLocationURI(); + } else if (extension instanceof SOAP12Address) { + return ((SOAP12Address) extension).getLocationURI(); + } + } + throw new RuntimeException("no SOAPAddress"); + } + + @Override + protected void setUp() throws Exception { + domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/questionmark-wsdl.composite"); + } + + @Override + protected void tearDown() throws Exception { + domain.close(); + } + +} diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/definitions.xml b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/definitions.xml new file mode 100644 index 0000000000..fb823ae989 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/definitions.xml @@ -0,0 +1,152 @@ + + + + + + + Communitcation thro this binding requires SOAP + + + + + + Communitcation thro this binding requires SOAP 1.1 + + + + + + Communitcation thro this binding requires SOAP 1.2 + + + + + + Communitcation thro this binding required Authentication. + + + + + + Communitcation thro this binding required Authentication. + + + + + + Protect messages from unauthorized reading or modification + + + + + + Communitcation thro this binding must prevent + unauthorized users from reading the messages. + + + + + + + + + UsernameToken + org.apache.tuscany.sca.binding.ws.axis2.itests.policy.ServerPWCBHandler + + + + + + + + + + UsernameToken + TuscanyWsUser + org.apache.tuscany.sca.binding.ws.axis2.itests.policy.ClientPWCBHandler" + + PasswordText + + + + + + + + + + Timestamp Signature + org/apache/tuscany/sca/binding/ws/axis2/itests/policy/security.properties + + + + + Timestamp Signature + TuscanyWsUser + org/apache/tuscany/sca/binding/ws/axis2/itests/policy/security.properties + org.apache.tuscany.sca.binding.ws.axis2.itests.policy.IntegrityPWCBHandler" + + DirectReference + + + + + + + + + + Timestamp Signature Encrypt + org.apache.tuscany.sca.binding.ws.axis2.itests.policy.IntegrityPWCBHandler + org/apache/tuscany/sca/binding/ws/axis2/itests/policy/security.properties + + + + + Timestamp Signature Encrypt + TuscanyWsUser + TuscanyWsUser + org.apache.tuscany.sca.binding.ws.axis2.itests.policy.IntegrityPWCBHandler + org/apache/tuscany/sca/binding/ws/axis2/itests/policy/security.properties + DirectReference + SKIKeyIdentifier + + + + + + \ No newline at end of file diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.composite b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.composite new file mode 100644 index 0000000000..78163900fe --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.composite @@ -0,0 +1,50 @@ + + + + + + + + + + myURI + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDL.composite b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDL.composite new file mode 100644 index 0000000000..3ff98f9a51 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDL.composite @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultMultiService.composite b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultMultiService.composite new file mode 100644 index 0000000000..25815d8019 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultMultiService.composite @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultSingleService.composite b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultSingleService.composite new file mode 100644 index 0000000000..42b99e3a99 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultSingleService.composite @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLExplicitURI.composite b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLExplicitURI.composite new file mode 100644 index 0000000000..14ebfc837d --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLExplicitURI.composite @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLRelativeURI.composite b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLRelativeURI.composite new file mode 100644 index 0000000000..79285a5324 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLRelativeURI.composite @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/helloworld-om-relative-uri.wsdl b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/helloworld-om-relative-uri.wsdl new file mode 100644 index 0000000000..fe68755c47 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/helloworld-om-relative-uri.wsdl @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorld.composite b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorld.composite new file mode 100644 index 0000000000..9ab4250a31 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorld.composite @@ -0,0 +1,50 @@ + + + + + + + + + http://localhost:8085/myService + + + + + + + + + + + + + + + + + http://localhost:8085/myService + + + + + diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-binding.wsdl b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-binding.wsdl new file mode 100644 index 0000000000..7bf47bc412 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-binding.wsdl @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-merged.composite b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-merged.composite new file mode 100644 index 0000000000..48ce948354 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-merged.composite @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-porttype.wsdl b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-porttype.wsdl new file mode 100644 index 0000000000..c66fa51c34 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-porttype.wsdl @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-uri.wsdl b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-uri.wsdl new file mode 100644 index 0000000000..baa223f41c --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-uri.wsdl @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.composite b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.composite new file mode 100644 index 0000000000..fcb8443f60 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.composite @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.wsdl b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.wsdl new file mode 100644 index 0000000000..73ca02246d --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.wsdl @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld.wsdl b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld.wsdl new file mode 100644 index 0000000000..4c85637f0d --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld.wsdl @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurityAuthentication.composite b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurityAuthentication.composite new file mode 100644 index 0000000000..05d47fe8d1 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurityAuthentication.composite @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurityConfidentiality.composite b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurityConfidentiality.composite new file mode 100644 index 0000000000..ea0bcf7bc4 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurityConfidentiality.composite @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurityIntegrity.composite b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurityIntegrity.composite new file mode 100644 index 0000000000..27e497ce8f --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/WSSecurityIntegrity.composite @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/security.properties b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/security.properties new file mode 100644 index 0000000000..24d1070e27 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/security.properties @@ -0,0 +1,4 @@ +org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin +org.apache.ws.security.crypto.merlin.keystore.type=jks +org.apache.ws.security.crypto.merlin.keystore.password=TuscanyWsUserPasswd +org.apache.ws.security.crypto.merlin.file=org/apache/tuscany/sca/binding/ws/axis2/itests/policy/tuscanyKeys.jks \ No newline at end of file diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/tuscanyKeys.jks b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/tuscanyKeys.jks new file mode 100644 index 0000000000..c1a63b7f20 Binary files /dev/null and b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/tuscanyKeys.jks differ diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl.composite b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl.composite new file mode 100644 index 0000000000..13cfdfd5d6 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl.composite @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12.composite b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12.composite new file mode 100644 index 0000000000..a2aa2cced4 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12.composite @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/questionmark-wsdl.composite b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/questionmark-wsdl.composite new file mode 100644 index 0000000000..2e4c66bc89 --- /dev/null +++ b/tags/java/sca/1.0/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/questionmark-wsdl.composite @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3