summaryrefslogtreecommitdiffstats
path: root/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2
diff options
context:
space:
mode:
Diffstat (limited to 'tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2')
-rw-r--r--tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/.ruleset190
-rw-r--r--tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/LICENSE.txt202
-rw-r--r--tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/NOTICE.txt14
-rwxr-xr-xtags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/pom.xml163
-rw-r--r--tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/assembly/axis2.xml38
-rw-r--r--tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2AsyncTargetInvoker.java84
-rwxr-xr-xtags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java208
-rw-r--r--tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilderRuntimeException.java65
-rw-r--r--tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingRunTimeException.java48
-rw-r--r--tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2CallbackInvocationHandler.java74
-rw-r--r--tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2OneWayTargetInvoker.java71
-rwxr-xr-xtags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Reference.java187
-rw-r--r--tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallback.java55
-rw-r--r--tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallbackTargetInvoker.java100
-rwxr-xr-xtags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Service.java290
-rw-r--r--tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceCallbackTargetInvoker.java114
-rw-r--r--tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInMessageReceiver.java67
-rw-r--r--tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutAsyncMessageReceiver.java95
-rw-r--r--tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.java73
-rw-r--r--tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceServlet.java207
-rwxr-xr-xtags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java136
-rwxr-xr-xtags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBinding.java78
-rwxr-xr-xtags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingLoader.java143
-rwxr-xr-xtags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/TuscanyAxisConfigurator.java44
-rwxr-xr-xtags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/WebServiceOperationMetaData.java491
-rwxr-xr-xtags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/WebServicePortMetaData.java377
-rw-r--r--tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/resources/META-INF/sca/binding.axis2.scdl48
-rw-r--r--tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/resources/META-INF/sca/default.scdl49
-rwxr-xr-xtags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/resources/org/apache/tuscany/binding/axis2/engine/config/axis2.xml302
-rwxr-xr-xtags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java105
-rwxr-xr-xtags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java150
-rwxr-xr-xtags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Greeter.java31
-rw-r--r--tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/GreetingCallback.java24
-rwxr-xr-xtags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/test/resources/wsdl/hello_world_doc_lit.wsdl169
34 files changed, 4492 insertions, 0 deletions
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/.ruleset b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/.ruleset
new file mode 100644
index 0000000000..70a035bc01
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/.ruleset
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/LICENSE.txt b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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, serviceDefinition 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-incubator-M2/services/bindings/binding.axis2/NOTICE.txt b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/NOTICE.txt
@@ -0,0 +1,14 @@
+${pom.name}
+Copyright (c) 2005 - 2006 The Apache Software Foundation
+
+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.
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/pom.xml b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/pom.xml
new file mode 100755
index 0000000000..6e0f0d881c
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/pom.xml
@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.services.bindings</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-M2</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>axis2</artifactId>
+ <name>Apache Tuscany Binding for Axis2</name>
+ <description>Implementation of the SCA Web Services binding using Axis2.</description>
+
+ <repositories>
+ <!-- ws zones repos is for woden -->
+ <repository>
+ <id>apache.ws.zones</id>
+ <name>Apache WS zones Repository</name>
+ <url>http://ws.zones.apache.org/repository/</url>
+ <layout>legacy</layout>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.idl</groupId>
+ <artifactId>wsdl</artifactId>
+ <version>${sca.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <!-- A hack to bring in databinding-axiom transitively -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-axiom</artifactId>
+ <version>${sca.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </dependency>
+
+ <!-- Axis2 1.1 release -->
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-kernel</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>incubator-woden</groupId>
+ <artifactId>woden</artifactId>
+ <version>1.0.0M6</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.neethi</groupId>
+ <artifactId>neethi</artifactId>
+ <version>2.0</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.schema</groupId>
+ <artifactId>XmlSchema</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.0.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ <version>1.4</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>backport-util-concurrent</groupId>
+ <artifactId>backport-util-concurrent</artifactId>
+ <version>2.2</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.3</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>httpcomponents-httpcore</groupId>
+ <artifactId>jakarta-httpcore</artifactId>
+ <version>4.0-alpha2</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <!-- end Axis2 1.1 release -->
+
+ <!-- test dependencies -->
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>test</artifactId>
+ <version>${sca.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/assembly/axis2.xml b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/assembly/axis2.xml
new file mode 100644
index 0000000000..7c835caa5c
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/assembly/axis2.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<assembly>
+ <id>bin</id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>zip</format>
+ <format>tar.gz</format>
+ </formats>
+
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>extension</outputDirectory>
+ <includes>
+ <include>org.apache.tuscany.bindings:axis2</include>
+ </includes>
+ <fileMode>644</fileMode>
+ </dependencySet>
+ </dependencySets>
+</assembly>
+
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2AsyncTargetInvoker.java b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2AsyncTargetInvoker.java
new file mode 100644
index 0000000000..0cf3976f37
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2AsyncTargetInvoker.java
@@ -0,0 +1,84 @@
+/*
+ * 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.binding.axis2;
+
+import java.lang.reflect.InvocationTargetException;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
+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.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.InvocationRuntimeException;
+import org.apache.tuscany.spi.wire.Message;
+
+public class Axis2AsyncTargetInvoker extends Axis2TargetInvoker {
+
+ protected static final OMElement RESPONSE = null;
+
+ private InboundWire wire;
+ private Object messageId;
+ private Axis2ReferenceCallbackTargetInvoker callbackInvoker;
+
+ public Axis2AsyncTargetInvoker(ServiceClient serviceClient,
+ QName wsdlOperationName,
+ Options options,
+ SOAPFactory soapFactory,
+ InboundWire wire) {
+ super(serviceClient, wsdlOperationName, options, soapFactory);
+ this.wire = wire;
+ }
+
+ public Object invokeTarget(final Object payload) throws InvocationTargetException {
+ try {
+ Object[] args = (Object[])payload;
+ OperationClient operationClient = createOperationClient(args);
+ callbackInvoker.setCorrelationId(messageId);
+ Axis2ReferenceCallback callback = new Axis2ReferenceCallback(callbackInvoker);
+ operationClient.setCallback(callback);
+
+ operationClient.execute(false);
+
+ // REVIEW it seems ok to return null
+ return RESPONSE;
+ } catch (AxisFault e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+
+ public Message invoke(Message msg) throws InvocationRuntimeException {
+ try {
+ wire.addMapping(msg.getMessageId(), msg.getFromAddress());
+ messageId = msg.getMessageId();
+ Object resp = invokeTarget(msg.getBody());
+ msg.setBody(resp);
+ } catch (Throwable e) {
+ msg.setBodyWithFault(e);
+ }
+ return msg;
+ }
+
+ public void setCallbackTargetInvoker(Axis2ReferenceCallbackTargetInvoker callbackInvoker) {
+ this.callbackInvoker = callbackInvoker;
+ }
+}
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java
new file mode 100755
index 0000000000..1090be874d
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java
@@ -0,0 +1,208 @@
+/*
+ * 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.binding.axis2;
+
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.tuscany.binding.axis2.util.TuscanyAxisConfigurator;
+import org.apache.tuscany.idl.wsdl.InterfaceWSDLIntrospector;
+import org.apache.tuscany.idl.wsdl.WSDLServiceContract;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.builder.BuilderConfigException;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.Reference;
+import org.apache.tuscany.spi.component.Service;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.BindingBuilderExtension;
+import org.apache.tuscany.spi.host.ServletHost;
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.model.BoundReferenceDefinition;
+import org.apache.tuscany.spi.model.BoundServiceDefinition;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.IncompatibleServiceContractException;
+
+/**
+ * Builds a {@link org.osoa.sca.annotations.Service} or {@link org.apache.tuscany.spi.component.Reference} configured
+ * with the Axis2 binding
+ *
+ * @version $Rev$ $Date$
+ */
+public class Axis2BindingBuilder extends BindingBuilderExtension<WebServiceBinding> {
+ private static final String OM_DATA_BINDING = OMElement.class.getName();
+
+ private ServletHost servletHost;
+
+ private ConfigurationContext configContext;
+
+ private WorkContext workContext;
+
+ private InterfaceWSDLIntrospector introspector;
+
+ public Axis2BindingBuilder() {
+ initAxis();
+ }
+
+ @Autowire(required = false)
+ public void setServletHost(ServletHost servletHost) {
+ this.servletHost = servletHost;
+ }
+
+ /**
+ * @param introspector the introspector to set
+ */
+ @Autowire
+ public void setIntrospector(InterfaceWSDLIntrospector introspector) {
+ this.introspector = introspector;
+ }
+
+ @Autowire
+ public void setWorkContext(WorkContext workContext) {
+ this.workContext = workContext;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Service build(
+ CompositeComponent parent,
+ BoundServiceDefinition<WebServiceBinding> serviceDefinition,
+ DeploymentContext deploymentContext) {
+
+ try {
+ // Set the default databinding
+ ServiceContract<?> outboundContract = serviceDefinition.getServiceContract();
+ if (WSDLServiceContract.class.isInstance(outboundContract)) {
+ outboundContract.setDataBinding(OM_DATA_BINDING);
+ }
+
+ // FIXME: We need to define how the WSDL PortType is honored in the case that
+ // both the binding.ws and interface.wsdl are in place.
+ // The WSDL portType from the WSDL Port decides the incoming SOAP message format
+ // There are also cases that interface.java is used.
+
+ ServiceContract<?> inboundContract = null;
+ WebServiceBinding wsBinding = serviceDefinition.getBinding();
+ Port port = wsBinding.getWSDLPort();
+ if (port == null) {
+ // FIXME: [rfeng] No WSDL is referenced by binding.ws, we need to create one from
+ // the outbound service contract if it's JavaServiceContract
+ inboundContract = outboundContract;
+ }
+
+ PortType portType = wsBinding.getWSDLPort().getBinding().getPortType();
+ inboundContract = introspector.introspect(portType);
+
+ // FIXME:
+ inboundContract.setInterfaceClass(serviceDefinition.getServiceContract().getInterfaceClass());
+ inboundContract.setDataBinding(OM_DATA_BINDING);
+ inboundContract.setCallbackName(serviceDefinition.getServiceContract().getCallbackName());
+
+ try {
+ wireService.checkCompatibility(inboundContract, outboundContract, true);
+ } catch (IncompatibleServiceContractException e) {
+ throw new Axis2BindingBuilderRuntimeException(e);
+ }
+
+ Service service = new Axis2Service(serviceDefinition.getName(), outboundContract, parent, wireService, wsBinding,
+ servletHost, configContext, workContext);
+ service.setBindingServiceContract(inboundContract);
+
+ return service;
+
+ } catch (InvalidServiceContractException e) {
+ throw new Axis2BindingBuilderRuntimeException(e);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public Reference build(
+ CompositeComponent parent,
+ BoundReferenceDefinition<WebServiceBinding> boundReferenceDefinition,
+ DeploymentContext deploymentContext) {
+
+ try {
+ // Set the default binding
+ ServiceContract<?> inboundContract = boundReferenceDefinition.getServiceContract();
+ if (WSDLServiceContract.class.isInstance(inboundContract)) {
+ inboundContract.setDataBinding(OM_DATA_BINDING);
+ }
+
+ // FIXME: We need to define how the WSDL PortType is honored in the case that
+ // both the binding.ws and interface.wsdl are in place
+ // The WSDL portType from the WSDL Port decides the incoming SOAP message format
+
+ ServiceContract<?> outboundContract = inboundContract;
+ WebServiceBinding wsBinding = boundReferenceDefinition.getBinding();
+ Port port = wsBinding.getWSDLPort();
+ if (port == null) {
+ // FIXME: [rfeng] No WSDL is referenced by binding.ws, we need to create one from
+ // the inbound service contract if it's JavaServiceContract
+ outboundContract = inboundContract;
+ }
+ PortType portType = port.getBinding().getPortType();
+ outboundContract = introspector.introspect(portType);
+
+ // Set the default databinding
+ outboundContract.setDataBinding(OM_DATA_BINDING);
+
+ try {
+ wireService.checkCompatibility(inboundContract, outboundContract, true);
+ } catch (IncompatibleServiceContractException e) {
+ throw new Axis2BindingBuilderRuntimeException(e);
+ }
+
+ Reference reference = new Axis2Reference(boundReferenceDefinition.getName(), parent, wireService, wsBinding,
+ inboundContract, workContext);
+ reference.setBindingServiceContract(outboundContract);
+
+ return reference;
+
+ } catch (InvalidServiceContractException e) {
+ throw new Axis2BindingBuilderRuntimeException(e);
+ }
+ }
+
+ protected Class<WebServiceBinding> getBindingType() {
+ return WebServiceBinding.class;
+ }
+
+ protected void initAxis() {
+ // TODO: Fix classloader switching. See TUSCANY-647
+ // TODO: also consider having a system component wrapping the Axis2 ConfigContext
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ ClassLoader scl = getClass().getClassLoader();
+ try {
+ if (tccl != scl) {
+ Thread.currentThread().setContextClassLoader(scl);
+ }
+ try {
+ this.configContext = new TuscanyAxisConfigurator().getConfigurationContext();
+ } catch (AxisFault e) {
+ throw new BuilderConfigException(e);
+ }
+ } finally {
+ if (tccl != scl) {
+ Thread.currentThread().setContextClassLoader(tccl);
+ }
+ }
+ }
+}
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilderRuntimeException.java b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilderRuntimeException.java
new file mode 100644
index 0000000000..a5743668a4
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilderRuntimeException.java
@@ -0,0 +1,65 @@
+/*
+ * 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.binding.axis2;
+
+
+/**
+ * Base class for Exceptions raised during the loading process. Loader implementations should throw a subclass of this
+ * to indicate the actual problem.
+ *
+ * @version $Rev$ $Date$
+ */
+public class Axis2BindingBuilderRuntimeException extends Axis2BindingRunTimeException {
+ private static final long serialVersionUID = -7459051598906813461L;
+ private String resourceURI;
+
+ public Axis2BindingBuilderRuntimeException() {
+ }
+
+ public Axis2BindingBuilderRuntimeException(String message) {
+ super(message);
+ }
+
+ public Axis2BindingBuilderRuntimeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public Axis2BindingBuilderRuntimeException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Returns the location of the resource that was being loaded.
+ *
+ * @return the location of the resource that was being loaded
+ */
+ public String getResourceURI() {
+ return resourceURI;
+ }
+
+ /**
+ * Sets the location of the resource that was being loaded.
+ *
+ * @param resourceURI the location of the resource that was being loaded
+ */
+ public void setResourceURI(String resourceURI) {
+ this.resourceURI = resourceURI;
+ }
+
+}
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingRunTimeException.java b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingRunTimeException.java
new file mode 100644
index 0000000000..cd957c2ec6
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingRunTimeException.java
@@ -0,0 +1,48 @@
+/*
+ * 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.binding.axis2;
+
+import org.apache.tuscany.api.TuscanyRuntimeException;
+
+/**
+ * Denotes an error creating a new object instance
+ *
+ * @version $Rev$ $Date$
+ */
+public class Axis2BindingRunTimeException extends TuscanyRuntimeException {
+ private static final long serialVersionUID = -6423113430265944499L;
+
+ public Axis2BindingRunTimeException() {
+ super();
+ }
+
+ public Axis2BindingRunTimeException(String message) {
+ super(message);
+ }
+
+ public Axis2BindingRunTimeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public Axis2BindingRunTimeException(Throwable cause) {
+ super(cause);
+ }
+
+}
+
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2CallbackInvocationHandler.java b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2CallbackInvocationHandler.java
new file mode 100644
index 0000000000..4a9e054237
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2CallbackInvocationHandler.java
@@ -0,0 +1,74 @@
+/*
+ * 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.binding.axis2;
+
+import java.util.Map;
+
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.wire.AbstractOutboundInvocationHandler;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+public class Axis2CallbackInvocationHandler extends AbstractOutboundInvocationHandler {
+
+ private InboundWire inboundWire;
+ private Object messageId;
+ private Object correlationId;
+
+ public Axis2CallbackInvocationHandler(InboundWire inboundWire) {
+ this.inboundWire = inboundWire;
+ }
+
+ public Object invoke(Operation operation, Object[] args) throws Throwable {
+ Object targetAddress = inboundWire.retrieveMapping(correlationId);
+ if (targetAddress == null) {
+ throw new AssertionError("No from address associated with message id [" + correlationId + "]");
+ }
+ //TODO optimize as this is slow in local invocations
+ Map<Operation<?>, OutboundInvocationChain> sourceCallbackInvocationChains =
+ inboundWire.getSourceCallbackInvocationChains(targetAddress);
+ OutboundInvocationChain chain = sourceCallbackInvocationChains.get(operation);
+ TargetInvoker invoker = chain.getTargetInvoker();
+ return invoke(chain, invoker, args);
+ }
+
+ // This must be called before invoke
+ public void setMessageId(Object messageId) {
+ this.messageId = messageId;
+ }
+
+ // This must be called before invoke
+ public void setCorrelationId(Object correlationId) {
+ this.correlationId = correlationId;
+ }
+
+ protected Object getFromAddress() {
+ return (inboundWire.getContainer() == null) ? null : inboundWire.getContainer().getName();
+ }
+
+ protected Object getMessageId() {
+ return messageId;
+ }
+
+ protected Object getCorrelationId() {
+ return correlationId;
+ }
+
+}
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2OneWayTargetInvoker.java b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2OneWayTargetInvoker.java
new file mode 100644
index 0000000000..a85c57313f
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2OneWayTargetInvoker.java
@@ -0,0 +1,71 @@
+/*
+ * 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.binding.axis2;
+
+import java.lang.reflect.InvocationTargetException;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
+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.tuscany.spi.wire.InvocationRuntimeException;
+import org.apache.tuscany.spi.wire.Message;
+
+public class Axis2OneWayTargetInvoker extends Axis2TargetInvoker {
+
+ protected static final OMElement RESPONSE = null;
+
+ public Axis2OneWayTargetInvoker(ServiceClient serviceClient,
+ QName wsdlOperationName,
+ Options options,
+ SOAPFactory soapFactory) {
+
+ super(serviceClient, wsdlOperationName, options, soapFactory);
+ }
+
+ public Object invokeTarget(final Object payload) throws InvocationTargetException {
+ try {
+ Object[] args = (Object[])payload;
+ OperationClient operationClient = createOperationClient(args);
+
+ operationClient.execute(false);
+
+ // REVIEW it seems ok to return null
+ return RESPONSE;
+ } catch (AxisFault e) {
+ throw new InvocationTargetException(e);
+ } catch (Throwable t) {
+ throw new Axis2BindingRunTimeException(t);
+ }
+ }
+
+ public Message invoke(Message msg) throws InvocationRuntimeException {
+ try {
+ Object resp = invokeTarget(msg.getBody());
+ msg.setBody(resp);
+ } catch (Throwable e) {
+ msg.setBodyWithFault(e);
+ }
+ return msg;
+ }
+}
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Reference.java b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Reference.java
new file mode 100755
index 0000000000..53ae1ae51e
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Reference.java
@@ -0,0 +1,187 @@
+/*
+ * 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.binding.axis2;
+
+import java.util.Collection;
+
+import javax.wsdl.Definition;
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.tuscany.binding.axis2.util.TuscanyAxisConfigurator;
+import org.apache.tuscany.binding.axis2.util.WebServiceOperationMetaData;
+import org.apache.tuscany.binding.axis2.util.WebServicePortMetaData;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.extension.ReferenceExtension;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.wire.WireService;
+
+/**
+ * Axis2Reference uses Axis2 to invoke a remote web service
+ */
+public class Axis2Reference<T> extends ReferenceExtension {
+
+ private WebServicePortMetaData wsPortMetaData;
+ private ServiceClient serviceClient;
+
+ // private WorkContext workContext;
+
+ @SuppressWarnings("unchecked")
+ public Axis2Reference(String theName,
+ CompositeComponent parent,
+ WireService wireService,
+ WebServiceBinding wsBinding,
+ ServiceContract contract,
+ WorkContext workContext) {
+ super(theName, (Class<T>)contract.getInterfaceClass(), parent, wireService);
+ try {
+ Definition wsdlDefinition = wsBinding.getWSDLDefinition();
+ wsPortMetaData =
+ new WebServicePortMetaData(wsdlDefinition, wsBinding.getWSDLPort(), wsBinding.getURI(), false);
+ serviceClient = createServiceClient(wsdlDefinition, wsPortMetaData);
+ // this.workContext = workContext;
+ } catch (AxisFault e) {
+ throw new Axis2BindingRunTimeException(e);
+ }
+ }
+
+ public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation) {
+ Axis2TargetInvoker invoker;
+ try {
+ boolean isOneWay = operation.isNonBlocking();
+ invoker = createOperationInvoker(serviceClient, operation, wsPortMetaData, false, isOneWay);
+ } catch (AxisFault e) {
+ throw new Axis2BindingRunTimeException(e);
+ }
+ return invoker;
+ }
+
+ public TargetInvoker createAsyncTargetInvoker(OutboundWire wire, Operation operation) {
+ Axis2AsyncTargetInvoker invoker;
+ try {
+ // FIXME: SDODataBinding needs to pass in TypeHelper and classLoader
+ // as parameters.
+ invoker =
+ (Axis2AsyncTargetInvoker)createOperationInvoker(serviceClient,
+ operation,
+ wsPortMetaData,
+ true,
+ false);
+ // FIXME: This makes the (BIG) assumption that there is only one
+ // callback method
+ // Relaxing this assumption, however, does not seem to be trivial,
+ // it may depend on knowledge
+ // of what actual callback method was invoked by the service at the
+ // other end
+ Operation callbackOperation = findCallbackOperation();
+ Axis2CallbackInvocationHandler invocationHandler =
+ new Axis2CallbackInvocationHandler(inboundWire);
+ Axis2ReferenceCallbackTargetInvoker callbackInvoker =
+ new Axis2ReferenceCallbackTargetInvoker(callbackOperation, inboundWire, invocationHandler);
+ invoker.setCallbackTargetInvoker(callbackInvoker);
+ } catch (AxisFault e) {
+ throw new Axis2BindingRunTimeException(e);
+ }
+ return invoker;
+ }
+
+ private Operation findCallbackOperation() {
+ ServiceContract contract = inboundWire.getServiceContract();
+ Operation callbackOperation = null;
+ Collection callbackOperations = contract.getCallbackOperations().values();
+ if (callbackOperations.size() != 1) {
+ throw new Axis2BindingRunTimeException("Can only handle one callback operation");
+ } else {
+ callbackOperation = (Operation)callbackOperations.iterator().next();
+ }
+ return callbackOperation;
+ }
+
+ /**
+ * Create an Axis2 ServiceClient
+ */
+ private ServiceClient createServiceClient(Definition wsdlDefinition, WebServicePortMetaData wsPortMetaData)
+ throws AxisFault {
+
+ TuscanyAxisConfigurator tuscanyAxisConfigurator = new TuscanyAxisConfigurator();
+ ConfigurationContext configurationContext = tuscanyAxisConfigurator.getConfigurationContext();
+ QName serviceQName = wsPortMetaData.getServiceName();
+ String portName = wsPortMetaData.getPortName().getLocalPart();
+ AxisService axisService =
+ AxisService.createClientSideAxisService(wsdlDefinition, serviceQName, portName, new Options());
+ return new ServiceClient(configurationContext, axisService);
+ }
+
+ /**
+ * Create and configure an Axis2TargetInvoker for each operations
+ */
+ private Axis2TargetInvoker createOperationInvoker(ServiceClient serviceClient,
+ Operation m,
+ WebServicePortMetaData wsPortMetaData,
+ boolean hasCallback,
+ boolean isOneWay) throws AxisFault {
+ SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory();
+ String portTypeNS = wsPortMetaData.getPortTypeName().getNamespaceURI();
+
+ String methodName = m.getName();
+
+ WebServiceOperationMetaData operationMetaData = wsPortMetaData.getOperationMetaData(methodName);
+
+ Options options = new Options();
+ options.setTo(new EndpointReference(wsPortMetaData.getEndpoint()));
+ options.setProperty(HTTPConstants.CHUNKED, Boolean.FALSE);
+
+ String wsdlOperationName = operationMetaData.getBindingOperation().getOperation().getName();
+
+ String soapAction = wsPortMetaData.getOperationMetaData(wsdlOperationName).getSOAPAction();
+ if (soapAction != null && soapAction.length() > 1) {
+ options.setAction(soapAction);
+ }
+
+ options.setTimeOutInMilliSeconds(5 * 60 * 1000);
+
+ QName wsdlOperationQName = new QName(portTypeNS, wsdlOperationName);
+
+ Axis2TargetInvoker invoker;
+ if (hasCallback) {
+ invoker =
+ new Axis2AsyncTargetInvoker(serviceClient, wsdlOperationQName, options, soapFactory,
+ inboundWire);
+ } else if (isOneWay) {
+ invoker = new Axis2OneWayTargetInvoker(serviceClient, wsdlOperationQName, options, soapFactory);
+ } else {
+ invoker = new Axis2TargetInvoker(serviceClient, wsdlOperationQName, options, soapFactory);
+ }
+
+ return invoker;
+ }
+
+}
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallback.java b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallback.java
new file mode 100644
index 0000000000..d6bb1a0290
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallback.java
@@ -0,0 +1,55 @@
+/*
+ * 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.binding.axis2;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.client.async.AsyncResult;
+import org.apache.axis2.client.async.Callback;
+import org.apache.axis2.context.MessageContext;
+import org.apache.tuscany.spi.wire.InvocationRuntimeException;
+
+public class Axis2ReferenceCallback extends Callback {
+
+ private Axis2ReferenceCallbackTargetInvoker targetInvoker;
+
+ public Axis2ReferenceCallback(Axis2ReferenceCallbackTargetInvoker targetInvoker) {
+ this.targetInvoker = targetInvoker;
+ }
+
+ public void onComplete(AsyncResult result) {
+ MessageContext responseMC = result.getResponseMessageContext();
+ OMElement responseOM = responseMC.getEnvelope().getBody().getFirstElement();
+ try {
+ targetInvoker.invokeTarget(new Object[] {responseOM});
+ } catch (InvocationTargetException e) {
+ // FIXME what is the appropriate exception here?
+ throw new InvocationRuntimeException(e);
+ }
+ }
+
+ public void setComplete(boolean complete) {
+ super.setComplete(complete);
+ }
+
+ public void onError(Exception e) {
+ throw new InvocationRuntimeException(e);
+ }
+}
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallbackTargetInvoker.java b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallbackTargetInvoker.java
new file mode 100644
index 0000000000..87f9b5654b
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallbackTargetInvoker.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.binding.axis2;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.InvocationRuntimeException;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+public class Axis2ReferenceCallbackTargetInvoker implements TargetInvoker {
+
+ private Operation operation;
+ private InboundWire inboundWire;
+ private Object correlationId;
+ private boolean cacheable;
+ Axis2CallbackInvocationHandler invocationHandler;
+
+ public Axis2ReferenceCallbackTargetInvoker(Operation operation,
+ InboundWire inboundWire,
+ Axis2CallbackInvocationHandler invocationHandler) {
+
+ this.operation = operation;
+ this.inboundWire = inboundWire;
+ this.invocationHandler = invocationHandler;
+ }
+
+ public Object invokeTarget(final Object payload) throws InvocationTargetException {
+ invocationHandler.setMessageId(null);
+ invocationHandler.setCorrelationId(correlationId);
+ Object[] args;
+ if (payload != null && !payload.getClass().isArray()) {
+ args = new Object[]{payload};
+ } else {
+ args = (Object[]) payload;
+ }
+ try {
+ return invocationHandler.invoke(operation, args);
+ } catch(Throwable t) {
+ t.printStackTrace();
+ throw new InvocationTargetException(t);
+ }
+ }
+
+ public Message invoke(Message msg) throws InvocationRuntimeException {
+ try {
+ Object resp = invokeTarget(msg.getBody());
+ msg.setBody(resp);
+ } catch (InvocationTargetException e) {
+ msg.setBodyWithFault(e.getCause());
+ } catch (Throwable e) {
+ msg.setBodyWithFault(e);
+ }
+ return msg;
+ }
+
+ public boolean isCacheable() {
+ return cacheable;
+ }
+
+ public void setCacheable(boolean cacheable) {
+ this.cacheable = cacheable;
+ }
+
+ public boolean isOptimizable() {
+ return isCacheable(); // we only need to check if the scopes are correct
+ }
+
+ public Axis2ReferenceCallbackTargetInvoker clone() throws CloneNotSupportedException {
+ Axis2ReferenceCallbackTargetInvoker invoker = (Axis2ReferenceCallbackTargetInvoker) super.clone();
+ invoker.operation = this.operation;
+ invoker.inboundWire = this.inboundWire;
+ invoker.correlationId = this.correlationId;
+ invoker.cacheable = this.cacheable;
+ invoker.invocationHandler = this.invocationHandler;
+ return invoker;
+ }
+
+ public void setCorrelationId(Object correlationId) {
+ this.correlationId = correlationId;
+ }
+}
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Service.java b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Service.java
new file mode 100755
index 0000000000..47c9d8308a
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Service.java
@@ -0,0 +1,290 @@
+/*
+ * 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.binding.axis2;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Operation;
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+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.WSDLToAxisServiceBuilder;
+import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.axis2.wsdl.WSDLConstants.WSDL20_2004Constants;
+import org.apache.tuscany.binding.axis2.util.WebServicePortMetaData;
+import org.apache.tuscany.spi.builder.BuilderConfigException;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.extension.ServiceExtension;
+import org.apache.tuscany.spi.host.ServletHost;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.Interceptor;
+import org.apache.tuscany.spi.wire.InvocationChain;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.MessageId;
+import org.apache.tuscany.spi.wire.MessageImpl;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.wire.WireService;
+import org.osoa.sca.annotations.Destroy;
+
+/**
+ * An implementation of a {@link ServiceExtension} configured with the Axis2
+ * binding
+ *
+ * @version $Rev$ $Date$
+ */
+public class Axis2Service extends ServiceExtension {
+ private ServiceContract<?> serviceContract;
+
+ private ServletHost servletHost;
+
+ private ConfigurationContext configContext;
+
+ private WebServiceBinding binding;
+
+ private WorkContext workContext;
+
+ private Map<MessageId, InvocationContext> invCtxMap = new HashMap<MessageId, InvocationContext>();
+
+ private String serviceName;
+
+ public Axis2Service(String theName,
+ ServiceContract<?> serviceContract,
+ CompositeComponent parent,
+ WireService wireService,
+ WebServiceBinding binding,
+ ServletHost servletHost,
+ ConfigurationContext configContext,
+ WorkContext workContext) {
+
+ super(theName, serviceContract.getInterfaceClass(), parent, wireService);
+
+ this.serviceContract = serviceContract;
+ this.binding = binding;
+ this.servletHost = servletHost;
+ this.configContext = configContext;
+ this.workContext = workContext;
+ this.serviceName = theName;
+ }
+
+ public void start() {
+ super.start();
+
+ try {
+ configContext.getAxisConfiguration().addService(createAxisService(binding));
+ } catch (AxisFault e) {
+ throw new Axis2BindingRunTimeException(e);
+ }
+
+ Axis2ServiceServlet servlet = new Axis2ServiceServlet();
+ servlet.init(configContext);
+ configContext.setContextRoot(getName());
+ servletHost.registerMapping("/" + getName(), servlet);
+ }
+
+ @Destroy
+ public void stop() {
+ servletHost.unregisterMapping("/" + getName());
+ try {
+ configContext.getAxisConfiguration().removeService(getName());
+ } catch (AxisFault e) {
+ throw new Axis2BindingRunTimeException(e);
+ }
+ super.stop();
+ }
+
+ private AxisService createAxisService(WebServiceBinding wsBinding) throws AxisFault {
+ Definition definition = wsBinding.getWSDLDefinition();
+ WebServicePortMetaData wsdlPortInfo =
+ new WebServicePortMetaData(definition, wsBinding.getWSDLPort(), null, false);
+
+ // TODO investigate if this is 20 wsdl what todo?
+ WSDLToAxisServiceBuilder builder =
+ new WSDL11ToAxisServiceBuilder(definition, wsdlPortInfo.getServiceName(), wsdlPortInfo.getPort()
+ .getName());
+ builder.setServerSide(true);
+ AxisService axisService = builder.populateService();
+
+ axisService.setName(this.getName());
+ axisService.setServiceDescription("Tuscany configured AxisService for service: '" + this.getName()
+ + "'");
+
+ // 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);
+
+ PortType wsdlPortType = wsdlPortInfo.getPortType();
+ for (Object o : wsdlPortType.getOperations()) {
+ Operation wsdlOperation = (Operation)o;
+ String operationName = wsdlOperation.getName();
+ QName operationQN = new QName(definition.getTargetNamespace(), operationName);
+
+ org.apache.tuscany.spi.model.Operation<?> op = serviceContract.getOperations().get(operationName);
+
+ MessageReceiver msgrec = null;
+ boolean opIsNonBlocking = op.isNonBlocking();
+ if (serviceContract.getCallbackName() != null) {
+ msgrec = new Axis2ServiceInOutAsyncMessageReceiver(this, op, workContext);
+ } else if (opIsNonBlocking) {
+ msgrec = new Axis2ServiceInMessageReceiver(this, op);
+ } else {
+ msgrec = new Axis2ServiceInOutSyncMessageReceiver(this, op);
+ }
+
+ AxisOperation axisOp = axisService.getOperation(operationQN);
+ if (opIsNonBlocking) {
+ axisOp.setMessageExchangePattern(WSDL20_2004Constants.MEP_URI_IN_ONLY);
+ } else {
+ axisOp.setMessageExchangePattern(WSDL20_2004Constants.MEP_URI_IN_OUT);
+ }
+ axisOp.setMessageReceiver(msgrec);
+ }
+
+ return axisService;
+ }
+
+ public Object invokeTarget(org.apache.tuscany.spi.model.Operation<?> op, Object[] args)
+ throws InvocationTargetException {
+ InvocationChain chain = inboundWire.getInvocationChains().get(op);
+ Interceptor headInterceptor = chain.getHeadInterceptor();
+ if (headInterceptor == null) {
+ try {
+ // short-circuit the dispatch and invoke the target directly
+ if (chain.getTargetInvoker() == null) {
+ throw new AssertionError("No target invoker [" + chain.getOperation().getName() + "]");
+ }
+ return chain.getTargetInvoker().invokeTarget(args);
+ } catch (InvocationTargetException e) {
+ // the cause was thrown by the target so throw it
+ throw e;
+ }
+ } else {
+ Object messageId = workContext.getCurrentMessageId();
+ workContext.setCurrentMessageId(null);
+ Object correlationId = workContext.getCurrentCorrelationId();
+ workContext.setCurrentCorrelationId(null);
+
+ Message msg = new MessageImpl();
+ msg.setTargetInvoker(chain.getTargetInvoker());
+ msg.setFromAddress(getFromAddress());
+ if (messageId == null) {
+ messageId = new MessageId();
+ }
+ msg.setMessageId(messageId);
+ msg.setCorrelationId(correlationId);
+ msg.setBody(args);
+ Message resp;
+ // dispatch the wire down the chain and get the response
+ // TODO http://issues.apache.org/jira/browse/TUSCANY-777
+ ClassLoader oldtccl = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
+ resp = headInterceptor.invoke(msg);
+ } finally {
+ Thread.currentThread().setContextClassLoader(oldtccl);
+ }
+ Object body = resp.getBody();
+ if (resp.isFault()) {
+ throw new InvocationTargetException((Throwable)body);
+ }
+ return body;
+ }
+ }
+
+ protected Object getFromAddress() {
+ return this.serviceName;
+ }
+
+ /**
+ * Get the Method from an interface matching the WSDL operation name
+ */
+ protected Method getMethod(Class<?> serviceInterface, String operationName) {
+ // Note: this doesn't support overloaded operations
+ Method[] methods = serviceInterface.getMethods();
+ for (Method m : methods) {
+ if (m.getName().equals(operationName)) {
+ return m;
+ }
+ // tolerate WSDL with capatalized operation name
+ StringBuilder sb = new StringBuilder(operationName);
+ sb.setCharAt(0, Character.toLowerCase(sb.charAt(0)));
+ if (m.getName().equals(sb.toString())) {
+ return m;
+ }
+ }
+ throw new BuilderConfigException("no operation named " + operationName
+ + " found on service interface: "
+ + serviceInterface.getName());
+ }
+
+ public TargetInvoker createCallbackTargetInvoker(ServiceContract contract,
+ org.apache.tuscany.spi.model.Operation operation) {
+
+ return new Axis2ServiceCallbackTargetInvoker(workContext, this);
+ }
+
+ public void addMapping(MessageId msgId, InvocationContext invCtx) {
+ this.invCtxMap.put(msgId, invCtx);
+ }
+
+ public InvocationContext retrieveMapping(MessageId msgId) {
+ return this.invCtxMap.get(msgId);
+ }
+
+ public void removeMapping(MessageId msgId) {
+ this.invCtxMap.remove(msgId);
+ }
+
+ protected class InvocationContext {
+ public MessageContext inMessageContext;
+
+ public org.apache.tuscany.spi.model.Operation<?> operation;
+
+ public SOAPFactory soapFactory;
+
+ public CountDownLatch doneSignal;
+
+ public InvocationContext(MessageContext messageCtx,
+ org.apache.tuscany.spi.model.Operation<?> operation,
+ SOAPFactory soapFactory,
+ CountDownLatch doneSignal) {
+ this.inMessageContext = messageCtx;
+ this.operation = operation;
+ this.soapFactory = soapFactory;
+ this.doneSignal = doneSignal;
+ }
+ }
+}
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceCallbackTargetInvoker.java b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceCallbackTargetInvoker.java
new file mode 100644
index 0000000000..ca7812e01b
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceCallbackTargetInvoker.java
@@ -0,0 +1,114 @@
+/*
+ * 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.binding.axis2;
+
+import java.lang.reflect.InvocationTargetException;
+
+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.engine.AxisEngine;
+import org.apache.axis2.util.Utils;
+import org.apache.tuscany.binding.axis2.Axis2Service.InvocationContext;
+import org.apache.tuscany.binding.axis2.Axis2AsyncTargetInvoker;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.wire.InvocationRuntimeException;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.MessageId;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+public class Axis2ServiceCallbackTargetInvoker implements TargetInvoker {
+
+ private Axis2Service service;
+
+ private MessageId currentCorrelationId;
+
+ public Axis2ServiceCallbackTargetInvoker(WorkContext workContext, Axis2Service service) {
+ this.service = service;
+ }
+
+ public Object invokeTarget(final Object payload) throws InvocationTargetException {
+ try {
+ // Use current correlation id as index to retrieve inv context
+ InvocationContext invCtx = service.retrieveMapping(this.currentCorrelationId);
+
+ MessageContext outMC = Utils.createOutMessageContext(invCtx.inMessageContext);
+ outMC.getOperationContext().addMessageContext(outMC);
+
+ OMElement responseOM = null;
+ if (payload != null && !payload.getClass().isArray()) {
+ responseOM = (OMElement)payload;
+ } else {
+ responseOM = (OMElement)((Object[])payload)[0];
+ }
+ SOAPEnvelope soapEnvelope = invCtx.soapFactory.getDefaultEnvelope();
+ soapEnvelope.getBody().addChild(responseOM);
+ outMC.setEnvelope(soapEnvelope);
+ outMC.getOperationContext().setProperty(Constants.RESPONSE_WRITTEN, Constants.VALUE_TRUE);
+
+ AxisEngine engine =
+ new AxisEngine(invCtx.inMessageContext.getOperationContext().getServiceContext().getConfigurationContext());
+ engine.send(outMC);
+
+ invCtx.doneSignal.countDown();
+
+ service.removeMapping(this.currentCorrelationId);
+ } catch (AxisFault e) {
+ throw new InvocationTargetException(e);
+ } catch(Throwable t) {
+ throw new Axis2BindingRunTimeException(t);
+ }
+
+ return Axis2AsyncTargetInvoker.RESPONSE;
+ }
+
+ public Message invoke(Message msg) throws InvocationRuntimeException {
+ try {
+ this.currentCorrelationId = (MessageId)msg.getCorrelationId();
+ Object resp = invokeTarget(msg.getBody());
+ msg.setBody(resp);
+ } catch (Throwable e) {
+ msg.setBodyWithFault(e);
+ }
+ return msg;
+ }
+
+ public Axis2ServiceCallbackTargetInvoker clone() throws CloneNotSupportedException {
+ try {
+ return (Axis2ServiceCallbackTargetInvoker)super.clone();
+ } catch (CloneNotSupportedException e) {
+ // will not happen
+ return null;
+ }
+ }
+
+ public boolean isCacheable() {
+ return true;
+ }
+
+ public void setCacheable(boolean cacheable) {
+
+ }
+
+ public boolean isOptimizable() {
+ return false;
+ }
+}
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInMessageReceiver.java b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInMessageReceiver.java
new file mode 100644
index 0000000000..3b1b0d25e4
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInMessageReceiver.java
@@ -0,0 +1,67 @@
+/*
+ * 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.binding.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.spi.model.Operation;
+import org.apache.tuscany.spi.wire.InvocationRuntimeException;
+
+public class Axis2ServiceInMessageReceiver extends AbstractInMessageReceiver {
+
+ protected Operation<?> operation;
+
+ private Axis2Service axis2Service;
+
+ public Axis2ServiceInMessageReceiver(Axis2Service service, Operation<?> operation) {
+ this.axis2Service = service;
+ 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};
+
+ axis2Service.invokeTarget(operation, args);
+
+ } catch (InvocationTargetException e) {
+ Throwable t = e.getCause();
+ if (t instanceof Exception) {
+ throw AxisFault.makeFault((Exception)t);
+ }
+ throw new InvocationRuntimeException(e);
+ } catch (Throwable t) {
+ if (t instanceof Exception) {
+ throw AxisFault.makeFault((Exception)t);
+ }
+ throw new Axis2BindingRunTimeException(t);
+ }
+
+ }
+}
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutAsyncMessageReceiver.java b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutAsyncMessageReceiver.java
new file mode 100644
index 0000000000..f83862399c
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutAsyncMessageReceiver.java
@@ -0,0 +1,95 @@
+/*
+ * 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.binding.axis2;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.concurrent.CountDownLatch;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.receivers.AbstractMessageReceiver;
+import org.apache.tuscany.binding.axis2.Axis2Service.InvocationContext;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.wire.InvocationRuntimeException;
+import org.apache.tuscany.spi.wire.MessageId;
+
+public class Axis2ServiceInOutAsyncMessageReceiver extends AbstractMessageReceiver {
+
+ private Operation<?> operation;
+
+ private WorkContext workContext;
+
+ private Axis2Service service;
+
+ public Axis2ServiceInOutAsyncMessageReceiver(Axis2Service service,
+ Operation operation,
+ WorkContext workContext) {
+ this.operation = operation;
+ this.workContext = workContext;
+ this.service = service;
+ }
+
+ public Axis2ServiceInOutAsyncMessageReceiver() {
+ }
+
+ public final void receive(final MessageContext messageCtx) {
+ try {
+ // Create a new message id and hand it to
+ // JDKInboundInvocationHandler
+ // via work context
+ MessageId messageId = new MessageId();
+ workContext.setCurrentMessageId(messageId);
+ // Now use message id as index to context to be used by callback
+ // target invoker
+ CountDownLatch doneSignal = new CountDownLatch(1);
+ InvocationContext invCtx =
+ service.new InvocationContext(messageCtx, operation, getSOAPFactory(messageCtx), doneSignal);
+ service.addMapping(messageId, invCtx);
+
+ invokeBusinessLogic(messageCtx);
+
+ try {
+ doneSignal.await();
+ } catch(InterruptedException e) {
+ e.printStackTrace();
+ }
+ } catch (AxisFault e) {
+ // log.error(e);
+ }
+ }
+
+ public void invokeBusinessLogic(MessageContext inMC) throws AxisFault {
+ try {
+ OMElement requestOM = inMC.getEnvelope().getBody().getFirstElement();
+ Object[] args = new Object[] {requestOM};
+ service.invokeTarget(operation, args);
+ } catch (InvocationTargetException e) {
+ Throwable t = e.getCause();
+ if (t instanceof Exception) {
+ throw AxisFault.makeFault((Exception)t);
+ }
+ throw new InvocationRuntimeException(e);
+ } catch (Exception e) {
+ throw AxisFault.makeFault(e);
+ }
+
+ }
+}
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.java b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.java
new file mode 100644
index 0000000000..4522632d9f
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.java
@@ -0,0 +1,73 @@
+/*
+ * 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.binding.axis2;
+
+import java.lang.reflect.InvocationTargetException;
+
+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.spi.model.Operation;
+import org.apache.tuscany.spi.wire.InvocationRuntimeException;
+
+public class Axis2ServiceInOutSyncMessageReceiver extends AbstractInOutSyncMessageReceiver {
+
+ protected Operation<?> operation;
+
+ private Axis2Service axis2Service;
+
+ public Axis2ServiceInOutSyncMessageReceiver(Axis2Service service, Operation<?> operation) {
+ this.axis2Service = service;
+ this.operation = operation;
+ }
+
+ public Axis2ServiceInOutSyncMessageReceiver() {
+
+ }
+
+ @Override
+ public void invokeBusinessLogic(MessageContext inMC, MessageContext outMC) throws AxisFault {
+ try {
+ OMElement requestOM = inMC.getEnvelope().getBody().getFirstElement();
+ Object[] args = new Object[] {requestOM};
+
+ OMElement responseOM = (OMElement)axis2Service.invokeTarget(operation, args);
+
+ SOAPEnvelope soapEnvelope = getSOAPFactory(inMC).getDefaultEnvelope();
+ soapEnvelope.getBody().addChild(responseOM);
+ outMC.setEnvelope(soapEnvelope);
+ outMC.getOperationContext().setProperty(Constants.RESPONSE_WRITTEN, Constants.VALUE_TRUE);
+
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ Throwable t = e.getCause();
+ if (t instanceof Exception) {
+ throw AxisFault.makeFault((Exception)t);
+ }
+ throw new InvocationRuntimeException(e);
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw AxisFault.makeFault(e);
+ }
+
+ }
+}
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceServlet.java b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceServlet.java
new file mode 100644
index 0000000000..cab5b28ee7
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceServlet.java
@@ -0,0 +1,207 @@
+/*
+ * 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.binding.axis2;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+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.context.ConfigurationContext;
+import org.apache.axis2.transport.http.AxisServlet;
+
+/**
+ * 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 {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final ServletConfig DUMMY_CONFIG = createDummyServletConfig();
+
+ private boolean inited;
+
+ public void init(ConfigurationContext configContext) {
+ this.configContext = configContext;
+ try {
+ super.init(DUMMY_CONFIG);
+ } catch (ServletException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * 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.configContext;
+ }
+
+ /**
+ * 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;
+ }
+
+ 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
+ protected void service(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ // HACK: Get the correct context root which is not available during init() call
+ if (!inited) {
+ synchronized (configContext) {
+ configContext.setContextRoot(request.getContextPath());
+ inited = true;
+ }
+ }
+ super.service(request, response);
+ }
+
+}
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java
new file mode 100755
index 0000000000..175f995c76
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java
@@ -0,0 +1,136 @@
+/*
+ * 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.binding.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.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.wsdl.WSDLConstants;
+import org.apache.tuscany.spi.wire.InvocationRuntimeException;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+/**
+ * Axis2TargetInvoker uses an Axis2 OperationClient to invoke a remote web service
+ */
+public class Axis2TargetInvoker implements TargetInvoker {
+
+ private QName wsdlOperationName;
+
+ private Options options;
+
+ private SOAPFactory soapFactory;
+
+ private ServiceClient serviceClient;
+
+ public Axis2TargetInvoker(ServiceClient serviceClient, QName wsdlOperationName, Options options,
+ SOAPFactory soapFactory) {
+ this.wsdlOperationName = wsdlOperationName;
+ this.options = options;
+ this.soapFactory = soapFactory;
+ this.serviceClient = serviceClient;
+ }
+
+ /**
+ * Invoke a WS operation
+ *
+ * @param payload
+ * @return
+ * @throws InvocationTargetException
+ */
+ public Object invokeTarget(final Object payload) throws InvocationTargetException {
+ try {
+ Object[] args = (Object[]) payload;
+ OperationClient operationClient = createOperationClient(args);
+
+ operationClient.execute(true);
+
+ MessageContext responseMC = operationClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+ return responseMC.getEnvelope().getBody().getFirstElement();
+
+ } catch (AxisFault e) {
+ throw new InvocationTargetException(e);
+ }
+
+ }
+
+ protected OperationClient createOperationClient(Object[] args) throws AxisFault {
+ SOAPEnvelope env = soapFactory.getDefaultEnvelope();
+ 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);
+ operationClient.addMessageContext(requestMC);
+ return operationClient;
+ }
+
+ public Message invoke(Message msg) throws InvocationRuntimeException {
+ try {
+ Object resp = invokeTarget(msg.getBody());
+ msg.setBody(resp);
+ } catch (Throwable e) {
+ msg.setBodyWithFault(e);
+ }
+ return msg;
+ }
+
+ public Axis2TargetInvoker clone() throws CloneNotSupportedException {
+ try {
+ return (Axis2TargetInvoker) super.clone();
+ } catch (CloneNotSupportedException e) {
+ // will not happen
+ return null;
+ }
+ }
+
+ public boolean isCacheable() {
+ return true;
+ }
+
+ public void setCacheable(boolean cacheable) {
+
+ }
+
+ public boolean isOptimizable() {
+ return false;
+ }
+
+}
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBinding.java b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBinding.java
new file mode 100755
index 0000000000..6d4ec6eaf9
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBinding.java
@@ -0,0 +1,78 @@
+/*
+ * 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.binding.axis2;
+
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import org.apache.tuscany.spi.model.Binding;
+
+/**
+ * Represents a Celtix binding configuration in an assembly
+ *
+ * @version $Rev$ $Date$
+ */
+public class WebServiceBinding extends Binding {
+
+ private Definition definition;
+ private Port port;
+ private Service service;
+ //private String portURI;
+ private String uri;
+ public WebServiceBinding(Definition definition, Port port, String uri, String portURI, Service service) {
+ this.definition = definition;
+ this.port = port;
+ this.uri = uri;
+ //this.portURI = portURI;
+ this.service = service;
+ }
+
+ public Port getWSDLPort() {
+ return port;
+ }
+
+ public Service getWSDLService() {
+ return service;
+ }
+
+ public void setWSDLPort(Port value) {
+ port = value;
+ }
+
+ public Definition getWSDLDefinition() {
+ return definition;
+ }
+
+ public void setWSDLDefinition(Definition def) {
+ definition = def;
+ }
+
+ // public void setPortURI(String uri) {
+ // portURI = uri;
+ // }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String theUri) {
+ this.uri = theUri;
+ }
+}
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingLoader.java b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingLoader.java
new file mode 100755
index 0000000000..5535dbb5c2
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingLoader.java
@@ -0,0 +1,143 @@
+/*
+ * 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.binding.axis2;
+
+import static org.osoa.sca.Version.XML_NAMESPACE_1_0;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.WSDLException;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistry;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.LoaderExtension;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.loader.LoaderUtil;
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * Parses a <code>WebServiceBinding</code> entry in an assembly XML file
+ *
+ * @version $Rev$ $Date$
+ */
+@Scope("MODULE")
+@SuppressWarnings("deprecation")
+public class WebServiceBindingLoader extends LoaderExtension<WebServiceBinding> {
+ public static final QName BINDING_WS = new QName(XML_NAMESPACE_1_0, "binding.ws");
+
+ private WSDLDefinitionRegistry wsdlDefinitionRegistry;
+
+ @Constructor( { "loaderRegistry", "wsdlDefinitionRegistry" })
+ public WebServiceBindingLoader(@Autowire LoaderRegistry loaderRegistry,
+ @Autowire WSDLDefinitionRegistry wsdlDefinitionRegistry) {
+ super(loaderRegistry);
+ this.wsdlDefinitionRegistry = wsdlDefinitionRegistry;
+ }
+
+ public QName getXMLType() {
+ return BINDING_WS;
+ }
+
+ public WebServiceBinding load(CompositeComponent parent, XMLStreamReader reader, DeploymentContext deploymentContext)
+ throws XMLStreamException, LoaderException {
+ // not sure what uri was here ? String uri = reader.getAttributeValue(null, "uri");
+ String uri = null;
+ String endpoint = reader.getAttributeValue(null, "endpoint");
+ String wsdlLocation = reader.getAttributeValue(null, "location");
+ LoaderUtil.skipToEndElement(reader);
+ try {
+ return createBinding(uri, endpoint, wsdlLocation, deploymentContext);
+ } catch (Exception e) {
+ throw new LoaderException(e);
+ }
+
+ }
+
+ @SuppressWarnings("unchecked")
+ private WebServiceBinding createBinding(String uri, String endpoint, String wsdlLocation, DeploymentContext deploymentContext)
+ throws WSDLException, IOException, LoaderException {
+ // Get the WSDL port namespace and name
+ if (uri == null && endpoint != null) {
+ int h = endpoint.indexOf('#');
+ String serviceName;
+ String portName;
+
+ String namespace = endpoint.substring(0, h);
+ String fragment = endpoint.substring(h + 1);
+ if (fragment.startsWith("wsdl.endpoint(") && fragment.endsWith(")")) {
+ fragment = fragment.substring(14, fragment.length() - 1);
+ int slash = fragment.indexOf('/');
+ if (slash != -1) {
+ serviceName = fragment.substring(0, slash);
+ portName = fragment.substring(slash + 1);
+ } else {
+ serviceName = null;
+ portName = fragment;
+ }
+ } else {
+ serviceName = null;
+ portName = fragment;
+ }
+ // FIXME need to find out how to get wsdl and what context to use --- terrible hack attack!
+ if (null == wsdlLocation) {
+ throw new Axis2BindingRunTimeException(
+ "Failed to determine wsdl location on binding. Try specifying 'location' attribute on binding.");
+ }
+ Definition definition =
+ wsdlDefinitionRegistry.loadDefinition(namespace+" "+wsdlLocation, deploymentContext.getClassLoader());
+
+ Port thePort = null;
+ Service service = null;
+ // Find the port with the given name
+ for (Service serv : (Collection<Service>) definition.getServices().values()) {
+ QName sqn = serv.getQName();
+ if (serviceName != null && !serviceName.equals(sqn.getLocalPart())) {
+ continue;
+ }
+
+ Port p = serv.getPort(portName);
+ if (p != null) {
+ service = serv;
+ thePort = p;
+ break;
+ }
+ }
+ if (thePort == null) {
+ throw new IllegalArgumentException("Cannot find WSDL port " + endpoint);
+
+ }
+ return new WebServiceBinding(definition, thePort, uri, endpoint, service);
+ }
+ // FIXME: Find the first port?
+ throw new LoaderException("Web Service endpoint cannot be resolved: " + endpoint);
+
+ }
+
+} \ No newline at end of file
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/TuscanyAxisConfigurator.java b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/TuscanyAxisConfigurator.java
new file mode 100755
index 0000000000..c0ef46fee3
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/TuscanyAxisConfigurator.java
@@ -0,0 +1,44 @@
+/*
+ * 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.binding.axis2.util;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.deployment.URLBasedAxisConfigurator;
+import org.apache.axis2.engine.AxisConfigurator;
+
+/**
+ * Helps configure Axis2 from a resource in binding.axis2 instead of Axis2.xml
+ * <p/> TODO: Review: should there be a single global Axis
+ * ConfigurationContext
+ */
+public class TuscanyAxisConfigurator extends URLBasedAxisConfigurator implements AxisConfigurator {
+
+ public TuscanyAxisConfigurator() throws AxisFault {
+ super(TuscanyAxisConfigurator.class.getResource("/org/apache/tuscany/binding/axis2/engine/config/axis2.xml"), null);
+ }
+
+ public ConfigurationContext getConfigurationContext() throws AxisFault {
+ if (configContext == null)
+ configContext = ConfigurationContextFactory.createConfigurationContext(this);
+ return configContext;
+ }
+
+}
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/WebServiceOperationMetaData.java b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/WebServiceOperationMetaData.java
new file mode 100755
index 0000000000..2a453bdf15
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/WebServiceOperationMetaData.java
@@ -0,0 +1,491 @@
+/*
+ * 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.binding.axis2.util;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Output;
+import javax.wsdl.Part;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPHeader;
+import javax.wsdl.extensions.soap.SOAPOperation;
+import javax.xml.namespace.QName;
+
+/**
+ * Metadata for a WSDL operation
+ */
+@SuppressWarnings({"all"})
+public class WebServiceOperationMetaData implements Serializable {
+ private static final long serialVersionUID = 2425306250256227724L;
+
+ // WSDL Binding and BindingOperation
+ private Binding binding;
+ private BindingOperation bindingOperation;
+ // Fields to cache derived metadata
+ private transient Set<Part> inputHeaderParts;
+ private transient Set<Part> outputHeaderParts;
+ private transient String style;
+ private transient String use;
+ private transient String soapAction;
+ private transient List<Object> signature;
+ private String encoding;
+ private transient QName rpcOperationName;
+
+ public WebServiceOperationMetaData(Binding binding, BindingOperation bindingOperation) {
+ this.binding = binding;
+ this.bindingOperation = bindingOperation;
+ }
+
+ public WebServiceOperationMetaData(Binding binding, BindingOperation bindingOperation, String style, String use,
+ String encoding,
+ String soapAction) {
+ this.binding = binding;
+ this.bindingOperation = bindingOperation;
+ this.style = style;
+ this.use = use;
+ this.encoding = encoding;
+ this.soapAction = soapAction;
+ }
+
+ public Set<Part> getInputHeaderParts() {
+ if (inputHeaderParts == null) {
+ // Build a set of header parts that we need to exclude
+ inputHeaderParts = new HashSet<Part>();
+ BindingInput bindingInput = bindingOperation.getBindingInput();
+
+ if (bindingInput != null) {
+ Operation operation = bindingOperation.getOperation();
+ javax.wsdl.Message message = operation.getInput().getMessage();
+ List elements = bindingInput.getExtensibilityElements();
+ for (Iterator i = elements.iterator(); i.hasNext();) {
+ Object extensibilityElement = i.next();
+ Part part = getPartFromSOAPHeader(message, extensibilityElement);
+ if (part != null) {
+ inputHeaderParts.add(part);
+ }
+ }
+ }
+ }
+ return inputHeaderParts;
+ }
+
+ public Set<Part> getOutputHeaderParts() {
+ if (outputHeaderParts == null) {
+ // Build a set of header parts that we need to exclude
+ outputHeaderParts = new HashSet<Part>();
+ BindingOutput bindingOutput = bindingOperation.getBindingOutput();
+
+ if (bindingOutput != null) {
+ Operation operation = bindingOperation.getOperation();
+ javax.wsdl.Message message = operation.getOutput().getMessage();
+ List elements = bindingOutput.getExtensibilityElements();
+ for (Iterator i = elements.iterator(); i.hasNext();) {
+ Object extensibilityElement = i.next();
+ Part part = getPartFromSOAPHeader(message, extensibilityElement);
+ if (part != null) {
+ outputHeaderParts.add(part);
+ }
+ }
+ }
+ }
+ return outputHeaderParts;
+ }
+
+ private Part getPartFromSOAPHeader(Message message, Object extensibilityElement) {
+ Part part = null;
+ if (extensibilityElement instanceof SOAPHeader) {
+ SOAPHeader soapHeader = (SOAPHeader) extensibilityElement;
+ QName msgName = soapHeader.getMessage();
+ if (message.getQName().equals(msgName)) {
+ part = message.getPart(soapHeader.getPart());
+ }
+ } else if (extensibilityElement instanceof SOAPHeader) {
+ SOAPHeader soapHeader = (SOAPHeader) extensibilityElement;
+ QName msgName = soapHeader.getMessage();
+ if (message.getQName().equals(msgName)) {
+ part = message.getPart(soapHeader.getPart());
+ }
+ }
+ return part;
+ }
+
+ public String getStyle() {
+ if (style == null) {
+ SOAPOperation soapOperation = (SOAPOperation) WebServicePortMetaData
+ .getExtensibilityElement(bindingOperation.getExtensibilityElements(),
+ SOAPOperation.class);
+ if (soapOperation != null) {
+ style = soapOperation.getStyle();
+ }
+ if (style == null) {
+ SOAPBinding soapBinding = WebServicePortMetaData
+ .getExtensibilityElement(binding.getExtensibilityElements(), SOAPBinding.class);
+ if (soapBinding != null) {
+ style = soapBinding.getStyle();
+ }
+ }
+ if (style == null) {
+ style = "document";
+ }
+ }
+ return style;
+ }
+
+ /**
+ * Returns the SOAP action for the given operation.
+ */
+ public String getSOAPAction() {
+ if (soapAction == null) {
+ final List wsdlBindingOperationExtensions = bindingOperation.getExtensibilityElements();
+ final SOAPOperation soapOp =
+ WebServicePortMetaData.getExtensibilityElement(wsdlBindingOperationExtensions, SOAPOperation.class);
+ if (soapOp != null) {
+ soapAction = soapOp.getSoapActionURI();
+ }
+ }
+ return soapAction;
+ }
+
+ public QName getRPCOperationName() {
+ if (rpcOperationName == null) {
+ javax.wsdl.extensions.soap.SOAPBody soapBody = getSOAPBody(true);
+ String ns =
+ (soapBody != null) ? soapBody.getNamespaceURI() : binding.getPortType().getQName().getNamespaceURI();
+ String name = bindingOperation.getOperation().getName();
+ rpcOperationName = new QName(ns, name);
+ }
+ return rpcOperationName;
+ }
+
+ private List<String> getSOAPBodyParts(boolean input) {
+ javax.wsdl.extensions.soap.SOAPBody soapBody = getSOAPBody(input);
+ if (soapBody != null) {
+ List parts = soapBody.getParts();
+ if (parts != null) {
+ List<String> names = new ArrayList<String>();
+ for (Iterator i = parts.iterator(); i.hasNext();) {
+ Object part = i.next();
+ if (part instanceof String) {
+ names.add((String) part);
+ } else if (part instanceof Part) {
+ names.add(((Part) part).getName());
+ }
+ }
+ return names;
+ } else {
+ return null;
+ }
+ } else {
+ return null;
+ }
+ }
+
+ private javax.wsdl.extensions.soap.SOAPBody getSOAPBody(boolean input) {
+ List elements = null;
+ if (input) {
+ BindingInput bindingInput = bindingOperation.getBindingInput();
+ if (bindingInput == null) {
+ return null;
+ }
+ elements = bindingInput.getExtensibilityElements();
+ } else {
+ BindingOutput bindingOutput = bindingOperation.getBindingOutput();
+ if (bindingOutput == null) {
+ return null;
+ }
+ elements = bindingOutput.getExtensibilityElements();
+ }
+ javax.wsdl.extensions.soap.SOAPBody soapBody = WebServicePortMetaData.getExtensibilityElement(elements,
+ javax.wsdl.extensions.soap.SOAPBody.class);
+ return soapBody;
+ }
+
+ /**
+ * Returns the use attribute
+ */
+ public String getUse() {
+ if (use == null) {
+ javax.wsdl.extensions.soap.SOAPBody soapBody = getSOAPBody(true);
+ if (soapBody != null) {
+ use = soapBody.getUse();
+ }
+ if (use == null) {
+ use = "literal";
+ }
+ }
+ return use;
+ }
+
+ @SuppressWarnings("unchecked")
+ public String getEncoding() {
+ if (encoding == null) {
+ javax.wsdl.extensions.soap.SOAPBody soapBody = getSOAPBody(true);
+ if (soapBody != null) {
+ List<String> styles = (List<String>) soapBody.getEncodingStyles();
+ if (styles != null && !styles.isEmpty()) {
+ encoding = styles.get(0);
+ }
+ }
+ if (encoding == null) {
+ encoding = "";
+ }
+ }
+ return encoding;
+ }
+
+ public boolean isDocLitWrapped() {
+ boolean flag = getStyle().equals("document") && getUse().equals("literal");
+ if (!flag) {
+ return false;
+ }
+ Message msg = getMessage(true);
+ if (msg == null) {
+ return false;
+ }
+ List parts = msg.getOrderedParts(null);
+ if (parts.size() != 1) {
+ return false;
+ }
+ Part part = (Part) parts.get(0);
+ QName element = part.getElementName();
+ if (element == null) {
+ return false;
+ }
+ return element.getLocalPart().equals(bindingOperation.getOperation().getName());
+ }
+
+ /*
+ * public SOAPMediator createMediator(boolean serverMode) throws SOAPException {
+ * // create a new mediator for each invoke for thread-safety
+ * boolean rpcStyle = getStyle().equals("rpc"); boolean rpcEncoded = isEncoded();
+ *
+ * SOAPMediator mediator = null;
+ *
+ * if (!rpcStyle) { // Document mediator = new SOAPDocumentLiteralMediatorImpl(this, serverMode);
+ * } else { if (!rpcEncoded) mediator = new
+ * SOAPRPCLiteralMediatorImpl(this, serverMode); // RPC-literal else mediator =
+ * new SOAPRPCEncodedMediatorImpl(this, serverMode); // RPC-encoded }
+ * return mediator; }
+ */
+
+ /**
+ * Get the operation signature from the WSDL operation
+ */
+ public List<?> getOperationSignature() {
+ if (signature == null) {
+ signature = new ArrayList<Object>();
+
+ Operation operation = bindingOperation.getOperation();
+ if (operation == null) {
+ return signature;
+ }
+
+ final Input input = operation.getInput();
+ if (input == null) {
+ return signature;
+ }
+
+ String sstyle = getStyle();
+
+ if ("rpc".equals(sstyle)) {
+ Collection partNames = input.getMessage().getParts().values();
+ for (Iterator i = partNames.iterator(); i.hasNext();) {
+ Part part = (Part) i.next();
+ signature.add(part.getName());
+ }
+ } else {
+ /*
+ * WS-I Basic Profile 1.1 4.7.6 Operation Signatures Definition: operation signature
+ *
+ * The profile defines the "operation signature" to be the fully qualified name of the child element of
+ * SOAP body of the SOAP input
+ * message described by an operation in a WSDL binding.
+ *
+ * In the case of rpc-literal binding, the operation name is used as a wrapper for the part accessors.
+ * In the document-literal case, designed so that they meet this requirement.
+ *
+ * An endpoint that supports multiple operations must unambiguously identify the operation being
+ * invoked based on the input message
+ * that it receives. This is only possible if all the operations specified in the wsdl:binding
+ * associated with an endpoint have a
+ * unique operation signature.
+ *
+ * R2710 The operations in a wsdl:binding in a DESCRIPTION MUST result in operation signatures that are
+ * different from one another.
+ */
+ List<String> bodyParts = getSOAPBodyParts(true);
+
+ Collection<?> parts = input.getMessage().getParts().values();
+ // Exclude the parts to be transmitted in SOAP header
+ if (bodyParts == null) {
+ parts.removeAll(getInputHeaderParts());
+ }
+ for (Iterator i = parts.iterator(); i.hasNext();) {
+ Part part = (Part) i.next();
+ if (bodyParts == null) {
+ // All parts
+ QName elementName = part.getElementName();
+ if (elementName == null) {
+ elementName = new QName("", part.getName());
+ // TODO: [rfeng] throw new
+ // ServiceRuntimeException("Message part for
+ // document style must refer to an XSD element
+ // using a QName: " + part);
+ }
+ signature.add(elementName);
+ } else {
+ // "parts" in soap:body
+ if (bodyParts.contains(part.getName())) {
+ QName elementName = part.getElementName();
+ if (elementName == null) {
+ elementName = new QName("", part.getName());
+ // TODO: [rfeng] throw new
+ // ServiceRuntimeException("Message part for
+ // document style must refer to an XSD
+ // element using a QName: " + part);
+ }
+ signature.add(elementName);
+ }
+
+ }
+ }
+ }
+ }
+ return signature;
+ }
+
+ public Message getMessage(boolean isInput) {
+ Operation operation = bindingOperation.getOperation();
+ if (operation == null) {
+ return null;
+ }
+
+ if (isInput) {
+ final Input input = operation.getInput();
+ return input == null ? null : input.getMessage();
+ } else {
+ final Output output = operation.getOutput();
+ return output == null ? null : output.getMessage();
+ }
+ }
+
+ public Part getInputPart(int index) {
+ Part part = null;
+ Message message = getMessage(true);
+ if (message == null) {
+ return part;
+ }
+
+ List parts = message.getOrderedParts(null);
+ return (Part) parts.get(index);
+
+ }
+
+ public Part getOutputPart(int index) {
+ Part part = null;
+ Message message = getMessage(false);
+ if (message == null) {
+ return part;
+ }
+
+ List parts = message.getOrderedParts(null);
+ return (Part) parts.get(index);
+
+ }
+
+ /**
+ * Get a list of indexes for each part in the SOAP body
+ *
+ * @param isInput
+ */
+ public List<Integer> getBodyPartIndexes(boolean isInput) {
+ List<Integer> indexes = new ArrayList<Integer>();
+
+ Message message = getMessage(isInput);
+ if (message == null) {
+ return indexes;
+ }
+
+ List<String> bodyParts = getSOAPBodyParts(isInput);
+ List parts = message.getOrderedParts(null);
+ Set headerParts = isInput ? getInputHeaderParts() : getOutputHeaderParts();
+
+ int index = 0;
+ for (Iterator i = parts.iterator(); i.hasNext(); index++) {
+ Part part = (Part) i.next();
+ if (headerParts.contains(part)) {
+ continue;
+ }
+ if (bodyParts == null) {
+ // All parts
+ indexes.add(index);
+ } else {
+ // "parts" in soap:body
+ if (bodyParts.contains(part.getName())) {
+ indexes.add(index);
+ }
+ }
+ }
+ return indexes;
+ }
+
+ /**
+ * Get the corresponding index for a part in the SOAP header by element name
+ *
+ * @param elementName
+ * @param isInput
+ */
+ public int getHeaderPartIndex(QName elementName, boolean isInput) {
+
+ Message message = getMessage(isInput);
+ if (message == null) {
+ return -1;
+ }
+
+ List parts = message.getOrderedParts(null);
+ Set headerParts = isInput ? getInputHeaderParts() : getOutputHeaderParts();
+
+ int index = 0;
+ for (Iterator i = parts.iterator(); i.hasNext(); index++) {
+ Part part = (Part) i.next();
+ // Test if the part is in header section
+ if (headerParts.contains(part) && elementName.equals(part.getElementName())) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ public BindingOperation getBindingOperation() {
+ return bindingOperation;
+ }
+
+}
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/WebServicePortMetaData.java b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/WebServicePortMetaData.java
new file mode 100755
index 0000000000..a8d4f0f581
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/WebServicePortMetaData.java
@@ -0,0 +1,377 @@
+/*
+ * 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.binding.axis2.util;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.Definition;
+import javax.wsdl.Operation;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.idl.wsdl.WSDLServiceContract;
+
+/**
+ * Metadata for a WSDL port
+ *
+ */
+public class WebServicePortMetaData {
+
+ private Service wsdlService;
+ private QName wsdlServiceName;
+ private Port wsdlPort;
+ private Binding wsdlBinding;
+ private QName wsdlPortName;
+ private PortType wsdlPortType;
+ private QName wsdlPortTypeName;
+ private String endpoint;
+ private boolean managed;
+ private List<WebServiceOperationMetaData> allOperationMetaData;
+ private WSDLServiceContract interfaceType;
+
+ /**
+ * Constructor
+ *
+ * @param wsdlDefinition
+ */
+ public WebServicePortMetaData(Definition wsdlDefinition, Port wsdlPort, String endpoint, boolean managed) {
+
+ // Lookup the named port
+ this.wsdlPort = wsdlPort;
+ wsdlPortName = new QName(wsdlDefinition.getTargetNamespace(), wsdlPort.getName());
+ Collection services = wsdlDefinition.getServices().values();
+ for (Object serviceObj : services) {
+ Service service = (Service) serviceObj;
+ if (service.getPorts().containsValue(wsdlPort)) {
+ wsdlService = service;
+ wsdlServiceName = service.getQName();
+ break;
+ }
+ }
+
+ // Save the binding
+ wsdlBinding = wsdlPort.getBinding();
+ if (wsdlBinding == null) {
+ throw new IllegalArgumentException("WSDL binding cannot be found for " + wsdlPortName);
+ }
+
+ // Save the portType
+ wsdlPortType = wsdlBinding.getPortType();
+ if (wsdlPortType == null) {
+ throw new IllegalArgumentException("WSDL portType cannot be found for " + wsdlPortName);
+ }
+ wsdlPortTypeName = wsdlPortType.getQName();
+
+ // Save the endpoint
+ this.endpoint = endpoint;
+
+ // Track if this endpoint is managed or not
+ this.managed = managed;
+ }
+
+ /**
+ * Constructor
+ *
+ * @param serviceName
+ * @param portName
+ * @param portTypeName
+ * @param endpoint
+ */
+ public WebServicePortMetaData(QName serviceName, String portName, QName portTypeName, String endpoint) {
+ wsdlServiceName = serviceName;
+ wsdlPortName = new QName(serviceName.getNamespaceURI(), portName);
+ wsdlPortTypeName = portTypeName;
+ this.endpoint = endpoint;
+ }
+
+ /**
+ * @return Returns the wsdlPort.
+ */
+ public javax.wsdl.Port getPort() {
+ return wsdlPort;
+ }
+
+ /**
+ * @return Returns the wsdlService.
+ */
+ public QName getServiceName() {
+ return wsdlServiceName;
+ }
+
+ /**
+ * @return Returns the wsdlService.
+ */
+ public javax.wsdl.Service getService() {
+ return wsdlService;
+ }
+
+ /**
+ * @return Returns the wsdlPortType.
+ */
+ public PortType getPortType() {
+ return wsdlPortType;
+ }
+
+ /**
+ * @return Returns the wsdlPortType.
+ */
+ public QName getPortTypeName() {
+ return wsdlPortTypeName;
+ }
+
+ /**
+ * @return Returns the wsdlBinding.
+ */
+ public Binding getBinding() {
+ return wsdlBinding;
+ }
+
+ /**
+ * @return Returns the wsdlPortName.
+ */
+ public QName getPortName() {
+ return wsdlPortName;
+ }
+
+ /**
+ * Returns the endpoint of a given port.
+ */
+ public String getEndpoint() {
+
+ // Return the specified endpoint
+ if (endpoint != null) {
+ return endpoint;
+ }
+
+ // Find the target endpoint on the port
+ if (wsdlPort != null) {
+ final List wsdlPortExtensions = wsdlPort.getExtensibilityElements();
+ for (final Object extension : wsdlPortExtensions) {
+ if (extension instanceof SOAPAddress) {
+ return ((SOAPAddress) extension).getLocationURI();
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the SOAP binding style.
+ */
+ public String getStyle() {
+
+ // Find the binding style
+ String style = null;
+ if (wsdlBinding != null) {
+ final List wsdlBindingExtensions = wsdlBinding.getExtensibilityElements();
+ SOAPBinding soapBinding = getExtensibilityElement(wsdlBindingExtensions, SOAPBinding.class);
+ if (soapBinding != null) {
+ style = soapBinding.getStyle();
+ }
+ }
+
+ // Default to document
+ return (style == null) ? "document" : style;
+ }
+
+ /**
+ * Returns the use attribute
+ */
+ public String getUse() {
+ List<WebServiceOperationMetaData> list = getAllOperationMetaData();
+ return list.get(0).getUse();
+ }
+
+ /**
+ * Returns the encoding attribute
+ */
+ public String getEncoding() {
+ List<WebServiceOperationMetaData> list = getAllOperationMetaData();
+ return list.get(0).getEncoding();
+ }
+
+ /**
+ * @return Returns true if this is a managed web service.
+ */
+ public boolean isManaged() {
+ return managed;
+ }
+
+ /**
+ * Returns the first extensibility element of the given type.
+ *
+ * @param elements
+ * @param type
+ */
+ public static <T> T getExtensibilityElement(List elements, Class<T> type) {
+ for (Object element : elements) {
+ if (type.isInstance(element)) {
+ return type.cast(element);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the extensibility elements of the given type.
+ *
+ * @param elements
+ * @param type
+ * @return List
+ */
+ public static <T> List<T> getExtensibilityElements(List elements, Class<T> type) {
+ List<T> result = new ArrayList<T>();
+ for (Object element : elements) {
+ if (type.isInstance(element)) {
+ result.add(type.cast(element));
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Get the operation signature from the SOAP Body
+ *
+ * @return A list of QNames
+ */
+ // public static List getOperationSignature(javax.xml.soap.SOAPBody body) {
+ // List signature = new ArrayList();
+ // for (Iterator i = body.getChildElements(); i.hasNext();) {
+ // Object child = i.next();
+ // if (child instanceof SOAPBodyElement) {
+ // Name name = ((SOAPBodyElement) child).getElementName();
+ // QName qname = new QName(name.getURI(), name.getLocalName(), name.getPrefix());
+ // signature.add(qname);
+ // }
+ // }
+ // return signature;
+ // }
+ // public static List getRPCOperationSignature(javax.xml.soap.SOAPBody body) {
+ // List signature = new ArrayList();
+ // for (Iterator i = body.getChildElements(); i.hasNext();) {
+ // Object child = i.next();
+ // if (child instanceof SOAPBodyElement) {
+ // SOAPBodyElement op = ((SOAPBodyElement) child);
+ // for (Iterator j = op.getChildElements(); j.hasNext();) {
+ // Object part = i.next();
+ // if (part instanceof SOAPElement) {
+ // SOAPElement p = (SOAPElement) part;
+ // signature.add(p.getLocalName());
+ // }
+ // }
+ // }
+ // }
+ // return signature;
+ // }
+ // public WebServiceOperationMetaData getOperationMetaData(javax.xml.soap.SOAPBody body) {
+ // List s1 = getOperationSignature(body);
+ // // List rpcParts = getRPCOperationSignature(body);
+ // for (Iterator it = getAllOperationMetaData().iterator(); it.hasNext();) {
+ // WebServiceOperationMetaData descriptor = (WebServiceOperationMetaData) it.next();
+ //
+ // String style = descriptor.getStyle();
+ //
+ // if (style.equals("document")) {
+ // List s2 = descriptor.getOperationSignature();
+ // if (s1.equals(s2))
+ // return descriptor;
+ // } else {
+ // QName op1 = (QName) s1.get(0);
+ // QName op2 = descriptor.getRPCOperationName();
+ // if (op1.equals(op2)) {
+ // /*
+ // * // FIXME: [rfeng] We don't support method overloading
+ // * List partNames = getOperationSignature(binding,
+ // * bindingOperation); if (rpcParts.equals(partNames))
+ // */
+ // return descriptor;
+ // }
+ // }
+ // }
+ // return null;
+ // }
+ public List<WebServiceOperationMetaData> getAllOperationMetaData() {
+ if (allOperationMetaData == null) {
+ allOperationMetaData = new ArrayList<WebServiceOperationMetaData>();
+ for (Iterator it = wsdlBinding.getBindingOperations().iterator(); it.hasNext();) {
+ final BindingOperation bindingOperation = (BindingOperation) it.next();
+ if (bindingOperation.getOperation() != null) {
+ allOperationMetaData.add(new WebServiceOperationMetaData(wsdlBinding, bindingOperation));
+ }
+ }
+ }
+ return allOperationMetaData;
+ }
+
+ public WebServiceOperationMetaData getOperationMetaData(String operationName) {
+ StringBuilder sb = new StringBuilder(operationName);
+ sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
+ String capatalizedOpName = sb.toString();
+
+ for (WebServiceOperationMetaData webServiceOperationMetaData : getAllOperationMetaData()) {
+ WebServiceOperationMetaData descriptor = (WebServiceOperationMetaData) webServiceOperationMetaData;
+ String opName = descriptor.getBindingOperation().getOperation().getName();
+
+ if (opName.equals(operationName) || opName.equals(capatalizedOpName)) {
+ return descriptor;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the WSDL service contract
+ *
+ * @return WSDLServiceContract
+ */
+ public WSDLServiceContract getInterfaceType() {
+ return interfaceType;
+ }
+
+ /**
+ * Get the WSDL operation name for a Java method name
+ */
+ public String getWSDLOperationName(String methodName) {
+ StringBuilder sb = new StringBuilder(methodName);
+ sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
+ String capatalizedOpName = sb.toString();
+ for (Object o : wsdlPortType.getOperations()) {
+ Operation operation = (Operation) o;
+ String wsdlOpName = operation.getName();
+ if (wsdlOpName.equals(methodName)) {
+ return wsdlOpName;
+ }
+ if (wsdlOpName.equals(capatalizedOpName)) {
+ return wsdlOpName;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/resources/META-INF/sca/binding.axis2.scdl b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/resources/META-INF/sca/binding.axis2.scdl
new file mode 100644
index 0000000000..a4ce9f977a
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/resources/META-INF/sca/binding.axis2.scdl
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<!-- Axis2 based WebService binding extension -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://incubator.apache.org/tuscany/xmlns/system/1.0-incubator-M2"
+ name="org.apache.tuscany.binding.axis2.include">
+
+ <dependency xmlns="http://incubator.apache.org/tuscany/xmlns/1.0-incubator-M2">
+ <group>org.apache.tuscany.sca.services.bindings</group>
+ <name>axis2</name>
+ <version>1.0-incubator-M2</version>
+ </dependency>
+
+ <dependency xmlns="http://incubator.apache.org/tuscany/xmlns/1.0-incubator-M2">
+ <group>org.apache.tuscany.sca.services.databinding</group>
+ <name>databinding-axiom</name>
+ <version>1.0-incubator-M2</version>
+ </dependency>
+
+ <component name="webservice.bindingLoader">
+ <system:implementation.system class="org.apache.tuscany.binding.axis2.WebServiceBindingLoader" />
+ </component>
+
+ <component name="webservice.axis2.bindingBuilder">
+ <system:implementation.system class="org.apache.tuscany.binding.axis2.Axis2BindingBuilder" />
+ </component>
+
+ <!-- A workaround to handle inter-extension dependencies -->
+ <include name="idl.wsdl" scdlResource="META-INF/sca/idl.wsdl.scdl" />
+ <include name="databinding.axiom" scdlResource="META-INF/sca/databinding.axiom.scdl" />
+
+</composite>
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/resources/META-INF/sca/default.scdl b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..d2a6b0a5f4
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<!-- Axis2 based WebService binding extension -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://incubator.apache.org/tuscany/xmlns/system/1.0-incubator-M2"
+ name="org.apache.tuscany.binding.axis2.WebServiceBinding">
+
+ <dependency xmlns="http://incubator.apache.org/tuscany/xmlns/1.0-incubator-M2">
+ <group>org.apache.tuscany.sca.services.bindings</group>
+ <name>axis2</name>
+ <version>1.0-incubator-M2</version>
+ </dependency>
+
+ <dependency xmlns="http://incubator.apache.org/tuscany/xmlns/1.0-incubator-M2">
+ <group>org.apache.tuscany.sca.services.databinding</group>
+ <name>databinding-axiom</name>
+ <version>1.0-incubator-M2</version>
+ </dependency>
+
+ <component name="webservice.bindingLoader">
+ <system:implementation.system class="org.apache.tuscany.binding.axis2.WebServiceBindingLoader"/>
+ </component>
+
+ <component name="webservice.axis2.bindingBuilder">
+ <system:implementation.system class="org.apache.tuscany.binding.axis2.Axis2BindingBuilder"/>
+ </component>
+
+ <!-- A workaround to handle inter-extension dependencies -->
+ <include name="idl.wsdl" scdlResource="META-INF/sca/idl.wsdl.scdl"/>
+ <include name="databinding.axiom" scdlResource="META-INF/sca/databinding.axiom.scdl"/>
+
+</composite>
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/resources/org/apache/tuscany/binding/axis2/engine/config/axis2.xml b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/resources/org/apache/tuscany/binding/axis2/engine/config/axis2.xml
new file mode 100755
index 0000000000..84c86d6dfb
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/main/resources/org/apache/tuscany/binding/axis2/engine/config/axis2.xml
@@ -0,0 +1,302 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<axisconfig name="AxisJava2.0">
+ <!-- ================================================= -->
+ <!-- Parameters -->
+ <!-- ================================================= -->
+ <parameter name="hotdeployment" locked="false">false</parameter>
+ <parameter name="hotupdate" locked="false">false</parameter>
+ <parameter name="enableMTOM" locked="false">false</parameter>
+ <parameter name="enableSwA" locked="false">false</parameter>
+
+ <!--Uncomment if you want to enable file caching for attachments -->
+ <!--parameter name="cacheAttachments" locked="false">true</parameter>
+ <parameter name="attachmentDIR" locked="false"></parameter>
+ <parameter name="sizeThreshold" locked="false">4000</parameter-->
+
+ <!--This will give out the timout of the configuration contexts, in seconds-->
+ <parameter name="ConfigContextTimeoutInterval" locked="false">30</parameter>
+
+ <!--During a fault, stacktrace can be sent with the fault message. The following flag will control -->
+ <!--that behaviour.-->
+ <parameter name="sendStacktraceDetailsWithFaults" locked="false">true</parameter>
+
+ <!--If there aren't any information available to find out the fault reason, we set the message of the expcetion-->
+ <!--as the faultreason/Reason. But when a fault is thrown from a service or some where, it will be -->
+ <!--wrapped by different levels. Due to this the initial exception message can be lost. If this flag-->
+ <!--is set then, Axis2 tries to get the first exception and set its message as the faultreason/Reason.-->
+ <parameter name="DrillDownToRootCauseForFaultReason" locked="false">false</parameter>
+
+ <parameter name="userName" locked="false">admin</parameter>
+ <parameter name="password" locked="false">axis2</parameter>
+
+ <!--Following params will set the proper context paths for invocations. All the endpoints will have a commons context-->
+ <!--root which can configured using the following contextRoot parameter-->
+ <!--<parameter name="contextRoot" locked="false">axis2</parameter>-->
+
+ <!--Our HTTP endpoints can handle both REST and SOAP. Following parameters can be used to distingiush those endpoints-->
+ <!--In case of a servlet, if you change this you have to manually change the settings of your servlet container to map this -->
+ <!--context path to proper Axis2 servlets-->
+ <!--<parameter name="servicePath" locked="false">services</parameter>-->
+ <!--<parameter name="restPath" locked="false">rest</parameter>-->
+
+
+ <!--Set the flag to true if you want to enable transport level session mangment-->
+ <parameter name="manageTransportSession" locked="false">false</parameter>
+
+ <!--Following two parameters will be used to handle REST in Axis2. The default settings will make Axis2 to have two-->
+ <!--different endpoints, one for REST (AxisRESTServlet) one for SOAP message handling (AxisServlet). But following-->
+ <!--parameters help to tweak the message handling of two main servlets. -->
+
+ <!-- If the enableRESTInAxis2MainServlet is true, then Axis2MainServlet will handle both SOAP and REST messages -->
+ <parameter name="enableRESTInAxis2MainServlet" locked="true">false</parameter>
+
+ <!-- Following parameter will completely disable REST handling in both the servlets-->
+ <parameter name="disableREST" locked="true">false</parameter>
+
+ <!-- This will disable the separate servlet we have for REST handling. -->
+ <parameter name="disableSeparateEndpointForREST" locked="true">false</parameter>
+
+ <!-- If you have a frontend host which exposes this webservice using a different public URL -->
+ <!-- use this parameter to override autodetected url -->
+ <!--<parameter name="httpFrontendHostUrl" locked="false">https://someotherhost/context</parameter>-->
+
+
+ <!-- The way of adding listener to the system-->
+ <!-- <listener class="org.apache.axis2.ObserverIMPL">-->
+ <!-- <parameter name="RSS_URL" locked="false">http://127.0.0.1/rss</parameter>-->
+ <!-- </listener>-->
+
+ <!-- ================================================= -->
+ <!-- Message Receivers -->
+ <!-- ================================================= -->
+ <!--This is the Deafult Message Receiver for the system , if you want to have MessageReceivers for -->
+ <!--all the other MEP implement it and add the correct entry to here , so that you can refer from-->
+ <!--any operation -->
+ <!--Note : You can ovride this for particular service by adding the same element with your requirement-->
+ <messageReceivers>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
+ class="org.apache.tuscany.binding.axis2.Axis2ServiceInMessageReceiver"/>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
+ class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
+ class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
+ class="org.apache.tuscany.binding.axis2.Axis2ServiceInOutAsyncMessageReceiver"/>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
+ class="org.apache.tuscany.binding.axis2.Axis2ServiceInOutSyncMessageReceiver"/>
+ </messageReceivers>
+ <!-- ================================================= -->
+ <!-- Transport Ins -->
+ <!-- ================================================= -->
+ <transportReceiver name="http"
+ class="org.apache.axis2.transport.http.SimpleHTTPServer">
+ <parameter name="port" locked="false">6060</parameter>
+ <!-- Here is the complete list of supported parameters (see example settings further below):
+ port: the port to listen on (default 6060)
+ hostname: if non-null, url prefix used in reply-to endpoint references (default null)
+ originServer: value of http Server header in outgoing messages (default "Simple-Server/1.1")
+ requestTimeout: value in millis of time that requests can wait for data (default 20000)
+ requestTcpNoDelay: true to maximize performance and minimize latency (default true)
+ false to minimize bandwidth consumption by combining segments
+ requestCoreThreadPoolSize: number of threads available for request processing (unless queue fills up) (default 25)
+ requestMaxThreadPoolSize: number of threads available for request processing if queue fills us (default 150)
+ note that default queue never fills up: see HttpFactory
+ threadKeepAliveTime: time to keep threads in excess of core size alive while inactive (default 180)
+ note that no such threads can exist with default unbounded request queue
+ threadKeepAliveTimeUnit: TimeUnit of value in threadKeepAliveTime (default SECONDS) (default SECONDS)
+ -->
+ <!-- <parameter name="hostname" locked="false">http://www.myApp.com/ws</parameter> -->
+ <!-- <parameter name="originServer" locked="false">My-Server/1.1</parameter> -->
+ <!-- <parameter name="requestTimeout" locked="false">10000</parameter> -->
+ <!-- <parameter name="requestTcpNoDelay" locked="false">false</parameter> -->
+ <!-- <parameter name="requestCoreThreadPoolSize" locked="false">50</parameter> -->
+ <!-- <parameter name="RequestMaxThreadPoolSize" locked="false">100</parameter> -->
+ <!-- <parameter name="threadKeepAliveTime" locked="false">240000</parameter> -->
+ <!-- <parameter name="threadKeepAliveTimeUnit" locked="false">MILLISECONDS</parameter> -->
+ </transportReceiver>
+
+ <!--Uncomment this and configure as appropriate for JMS transport support, after setting up your JMS environment (e.g. ActiveMQ)
+ <transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
+ <parameter name="myTopicConnectionFactory" locked="false">
+ <parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
+ <parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
+ <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">TopicConnectionFactory</parameter>
+ </parameter>
+
+ <parameter name="myQueueConnectionFactory" locked="false">
+ <parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
+ <parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
+ <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
+ </parameter>
+
+ <parameter name="default" locked="false">
+ <parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
+ <parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
+ <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
+ </parameter>
+ </transportReceiver>-->
+
+ <!--Uncomment if you want to have SMTP transport support-->
+ <!--<transportReceiver name="mail" class="org.apache.axis2.transport.mail.SimpleMailListener">-->
+ <!--<parameter name="transport.mail.pop3.host" locked="false">127.0.0.1</parameter>-->
+ <!--<parameter name="transport.mail.pop3.user" locked="false">axis2</parameter>-->
+ <!--<parameter name="transport.mail.pop3.password" locked="false">axis2</parameter>-->
+ <!--<parameter name="transport.mail.pop3.port" locked="false">110</parameter>-->
+ <!--<parameter name="transport.mail.replyToAddress" locked="false">axis2@127.0.0.1</parameter>-->
+ <!--</transportReceiver>-->
+
+ <transportReceiver name="tcp"
+ class="org.apache.axis2.transport.tcp.TCPServer">
+ <parameter name="port" locked="false">6060</parameter>
+ <!--If you want to give your own host address for EPR generation-->
+ <!--uncommet following paramter , and set as you required.-->
+ <!--<parameter name="hostname" locked="false">tcp://myApp.com/ws</parameter>-->
+ </transportReceiver>
+
+ <!-- ================================================= -->
+ <!-- Transport Outs -->
+ <!-- ================================================= -->
+
+ <transportSender name="tcp"
+ class="org.apache.axis2.transport.tcp.TCPTransportSender"/>
+ <transportSender name="local"
+ class="org.apache.axis2.transport.local.LocalTransportSender"/>
+ <transportSender name="http"
+ class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+ <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
+ <parameter name="Transfer-Encoding" locked="false">chunked</parameter>
+ </transportSender>
+ <transportSender name="https"
+ class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+ <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
+ <parameter name="Transfer-Encoding" locked="false">chunked</parameter>
+ </transportSender>
+
+ <!-- Commented out by Tuscany
+ <transportSender name="jms"
+ class="org.apache.axis2.transport.jms.JMSSender"/>
+ -->
+
+ <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver
+ <transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">
+ <parameter name="transport.mail.smtp.host" locked="false">127.0.0.1</parameter>
+ <parameter name="transport.mail.smtp.user" locked="false">axis2</parameter>
+ <parameter name="transport.mail.smtp.password" locked="false">axis2</parameter>
+ <parameter name="transport.mail.smtp.port" locked="false">25</parameter>
+ </transportSender>
+ -->
+
+ <!-- ================================================= -->
+ <!-- Global Modules -->
+ <!-- ================================================= -->
+ <!-- Comment this to disable Addressing -->
+ <!-- Commented out by Tuscany
+ <module ref="addressing"/>
+ -->
+
+ <!--Configuring module , providing parameters for modules whether they refer or not-->
+ <!--<moduleConfig name="addressing">-->
+ <!--<parameter name="addressingPara" locked="false">N/A</parameter>-->
+ <!--</moduleConfig>-->
+
+ <!-- ================================================= -->
+ <!-- Phases -->
+ <!-- ================================================= -->
+ <phaseOrder type="InFlow">
+ <!-- System pre defined phases -->
+ <phase name="Transport">
+ <handler name="RequestURIBasedDispatcher"
+ class="org.apache.axis2.engine.RequestURIBasedDispatcher">
+ <order phase="Transport"/>
+ </handler>
+ <handler name="SOAPActionBasedDispatcher"
+ class="org.apache.axis2.engine.SOAPActionBasedDispatcher">
+ <order phase="Transport"/>
+ </handler>
+ </phase>
+ <phase name="Security"/>
+ <phase name="PreDispatch"/>
+ <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+ <handler name="AddressingBasedDispatcher"
+ class="org.apache.axis2.engine.AddressingBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+
+ <handler name="SOAPMessageBodyBasedDispatcher"
+ class="org.apache.axis2.engine.SOAPMessageBodyBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+ <handler name="InstanceDispatcher"
+ class="org.apache.axis2.engine.InstanceDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+ </phase>
+ <!-- System pre defined phases -->
+ <!-- After Postdispatch phase module author or or service author can add any phase he want -->
+ <phase name="OperationInPhase"/>
+ </phaseOrder>
+ <phaseOrder type="OutFlow">
+ <!-- user can add his own phases to this area -->
+ <phase name="OperationOutPhase"/>
+ <!--system predefined phase-->
+ <!--these phase will run irrespective of the service-->
+ <phase name="PolicyDetermination"/>
+ <phase name="MessageOut"/>
+ <phase name="Security"/>
+ </phaseOrder>
+ <phaseOrder type="InFaultFlow">
+ <phase name="PreDispatch"/>
+ <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+ <handler name="RequestURIBasedDispatcher"
+ class="org.apache.axis2.engine.RequestURIBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+
+ <handler name="SOAPActionBasedDispatcher"
+ class="org.apache.axis2.engine.SOAPActionBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+
+ <handler name="AddressingBasedDispatcher"
+ class="org.apache.axis2.engine.AddressingBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+
+ <handler name="SOAPMessageBodyBasedDispatcher"
+ class="org.apache.axis2.engine.SOAPMessageBodyBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+ <handler name="InstanceDispatcher"
+ class="org.apache.axis2.engine.InstanceDispatcher">
+ <order phase="PostDispatch"/>
+ </handler>
+ </phase>
+ <!-- user can add his own phases to this area -->
+ <phase name="OperationInFaultPhase"/>
+ </phaseOrder>
+ <phaseOrder type="OutFaultFlow">
+ <!-- user can add his own phases to this area -->
+ <phase name="OperationOutFaultPhase"/>
+ <phase name="PolicyDetermination"/>
+ <phase name="MessageOut"/>
+ </phaseOrder>
+</axisconfig>
+
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java
new file mode 100755
index 0000000000..9605c50c51
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java
@@ -0,0 +1,105 @@
+/*
+ * 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.binding.axis2;
+
+import java.lang.reflect.Type;
+import java.net.URL;
+import java.util.HashMap;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.idl.wsdl.WSDLServiceContract;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.idl.java.JavaServiceContract;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.wire.WireService;
+import org.easymock.EasyMock;
+import org.xml.sax.InputSource;
+
+public class Axis2ReferenceTestCase extends TestCase {
+
+ public void testInvokeService() throws Exception {
+ Axis2Reference axis2Reference = createAxis2Reference("testWebAppName", "testServiceName");
+ Operation operation = new Operation<Type>("sayHi", null, null, null, false, null);
+ TargetInvoker targetInvoker = axis2Reference.createTargetInvoker(null, operation);
+ assertNotNull(targetInvoker);
+ }
+
+ public void testAsyncTargetInvoker() throws Exception {
+ Axis2Reference axis2Reference = createAxis2Reference("testWebAppName", "testServiceName");
+ //Create a mocked InboundWire, make the call of ServiceExtension.getInterface() returns a Class
+ InboundWire inboundWire = EasyMock.createNiceMock(InboundWire.class);
+ JavaServiceContract contract = new JavaServiceContract(Greeter.class);
+ contract.setCallbackClass(GreetingCallback.class);
+ Operation<Type> callbackOp = new Operation<Type>("sayHiCallback", null, null, null, true, null);
+ HashMap<String,Operation<Type>> callbackOps = new HashMap<String,Operation<Type>>();
+ callbackOps.put("sayHiCallback", callbackOp);
+ contract.setCallbackOperations(callbackOps);
+ EasyMock.expect(inboundWire.getServiceContract()).andReturn(contract).anyTimes();
+ EasyMock.replay(inboundWire);
+
+ axis2Reference.setInboundWire(inboundWire);
+ Operation operation = new Operation<Type>("sayHi", null, null, null, true, null);
+ TargetInvoker asyncTargetInvoker = axis2Reference.createAsyncTargetInvoker(null, operation);
+ assertNotNull(asyncTargetInvoker);
+ }
+
+ private Axis2Reference createAxis2Reference(String webAppName, String serviceName) throws Exception {
+ //Create WebServiceBinding
+ 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");
+ WebServiceBinding wsBinding = new WebServiceBinding(wsdlDef, port, "uri", "portURI", wsdlService);
+ //Create a mocked WireService, make the call of ServiceExtension.getServiceInstance() returns a proxy instance.
+ WireService wireService = EasyMock.createNiceMock(WireService.class);
+ EasyMock.replay(wireService);
+ CompositeComponent parent = EasyMock.createNiceMock(CompositeComponent.class);
+ // TODO figure out what to do with the service contract
+ ServiceContract<?> contract = new WSDLServiceContract();
+ contract.setInterfaceClass(Greeter.class);
+ WorkContext workContext = EasyMock.createNiceMock(WorkContext.class);
+ EasyMock.replay(workContext);
+ return new Axis2Reference(serviceName,
+ parent,
+ wireService,
+ wsBinding,
+ contract,
+ workContext);
+ }
+}
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java
new file mode 100755
index 0000000000..6669226547
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java
@@ -0,0 +1,150 @@
+/*
+ * 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.binding.axis2;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import javax.servlet.Servlet;
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+
+import org.xml.sax.InputSource;
+
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.tuscany.binding.axis2.util.TuscanyAxisConfigurator;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.host.ServletHost;
+import org.apache.tuscany.spi.idl.java.JavaServiceContract;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.WireService;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+public class Axis2ServiceTestCase extends TestCase {
+
+ public void testInvokeService() throws Exception {
+ TestServletHost tomcatHost = new TestServletHost();
+ Axis2Service axis2Service = createAxis2Service("testServiceName", tomcatHost, false);
+ axis2Service.start();
+
+ if (true) return;
+ Servlet servlet = tomcatHost.getMapping("testWebAppName/services/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();
+ Axis2Service axis2Service = createAxis2Service("testServiceName", tomcatHost, true);
+ axis2Service.start();
+ }
+
+ private Axis2Service createAxis2Service(String serviceName, ServletHost tomcatHost, boolean callback)
+ throws Exception {
+ //Create WebServiceBinding
+ 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");
+ WebServiceBinding wsBinding = new WebServiceBinding(wsdlDef, port, "uri", "portURI", wsdlService);
+
+ //Create a mocked WireService, make the call of ServiceExtension.getServiceInstance() returns a proxy instance.
+ WireService wireService = EasyMock.createNiceMock(WireService.class);
+ wireService.createProxy(EasyMock.isA(InboundWire.class));
+ EasyMock.expectLastCall().andReturn(null);
+ EasyMock.replay(wireService);
+
+ //Create a mocked InboundWire, make the call of ServiceExtension.getInterface() returns a Class
+ InboundWire inboundWire = EasyMock.createNiceMock(InboundWire.class);
+ JavaServiceContract contract = new JavaServiceContract(Greeter.class);
+ Map<String, Operation<Type>> opMap = new HashMap<String, Operation<Type>>();
+ for(Method m: Greeter.class.getMethods()) {
+ opMap.put(m.getName(), new Operation<Type>(m.getName(), null, null, null));
+ }
+ contract.setOperations(opMap);
+ EasyMock.expect(inboundWire.getServiceContract()).andReturn(contract).anyTimes();
+ if (callback) {
+ contract.setCallbackName("");
+ }
+ EasyMock.replay(inboundWire);
+
+ OutboundWire outboundWire = EasyMock.createNiceMock(OutboundWire.class);
+ Map<Operation<?>, OutboundInvocationChain> map = new HashMap<Operation<?>, OutboundInvocationChain>();
+ EasyMock.expect(outboundWire.getInvocationChains()).andReturn(map).once();
+ EasyMock.replay(outboundWire);
+
+ TuscanyAxisConfigurator tuscanyAxisConfigurator = new TuscanyAxisConfigurator();
+ ConfigurationContext configurationContext = tuscanyAxisConfigurator.getConfigurationContext();
+ WorkContext workContext = EasyMock.createNiceMock(WorkContext.class);
+ EasyMock.replay(workContext);
+ Axis2Service axis2Service =
+ new Axis2Service(serviceName,
+ contract,
+ null,
+ wireService,
+ wsBinding,
+ tomcatHost,
+ configurationContext,
+ workContext);
+ axis2Service.setInboundWire(inboundWire);
+ axis2Service.setOutboundWire(outboundWire);
+
+ return axis2Service;
+ }
+
+ protected class TestServletHost implements ServletHost {
+ private Map<String, Servlet> mappings = new HashMap<String, Servlet>();
+
+ public void registerMapping(String mapping, Servlet servlet) {
+ mappings.put(mapping, servlet);
+ }
+
+ public void unregisterMapping(String mapping) {
+ }
+
+ public Servlet getMapping(String mapping) {
+ return mappings.get(mapping);
+ }
+
+ }
+
+}
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Greeter.java b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Greeter.java
new file mode 100755
index 0000000000..39fccdadd3
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/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.binding.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-incubator-M2/services/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/GreetingCallback.java b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/GreetingCallback.java
new file mode 100644
index 0000000000..4c3b3304ea
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/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.binding.axis2;
+
+public interface GreetingCallback {
+
+ void greetMeCallback(String greetMeResponse);
+}
diff --git a/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/test/resources/wsdl/hello_world_doc_lit.wsdl b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/test/resources/wsdl/hello_world_doc_lit.wsdl
new file mode 100755
index 0000000000..2f56217f88
--- /dev/null
+++ b/tags/java/sca/1.0-incubator-M2/services/bindings/binding.axis2/src/test/resources/wsdl/hello_world_doc_lit.wsdl
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<wsdl:definitions name="HelloWorld" targetNamespace="http://objectweb.org/hello_world_soap_http"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://objectweb.org/hello_world_soap_http"
+ xmlns:x1="http://objectweb.org/hello_world_soap_http/types"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <wsdl:types>
+ <schema targetNamespace="http://objectweb.org/hello_world_soap_http/types"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://objectweb.org/hello_world_soap_http/types"
+ elementFormDefault="qualified">
+ <simpleType name="MyStringType">
+ <restriction base="string">
+ <maxLength value="30" />
+ </restriction>
+ </simpleType>
+
+ <element name="sayHi">
+ <complexType/>
+ </element>
+ <element name="sayHiResponse">
+ <complexType>
+ <sequence>
+ <element name="responseType" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="greetMe">
+ <complexType>
+ <sequence>
+ <element name="requestType" type="tns:MyStringType"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="greetMeResponse">
+ <complexType>
+ <sequence>
+ <element name="responseType" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="greetMeOneWay">
+ <complexType>
+ <sequence>
+ <element name="requestType" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="pingMe">
+ <complexType/>
+ </element>
+ <element name="pingMeResponse">
+ <complexType/>
+ </element>
+ <element name="faultDetail">
+ <complexType>
+ <sequence>
+ <element name="minor" type="short"/>
+ <element name="major" type="short"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+ <wsdl:message name="sayHiRequest">
+ <wsdl:part element="x1:sayHi" name="in"/>
+ </wsdl:message>
+ <wsdl:message name="sayHiResponse">
+ <wsdl:part element="x1:sayHiResponse" name="out"/>
+ </wsdl:message>
+ <wsdl:message name="greetMeRequest">
+ <wsdl:part element="x1:greetMe" name="in"/>
+ </wsdl:message>
+ <wsdl:message name="greetMeResponse">
+ <wsdl:part element="x1:greetMeResponse" name="out"/>
+ </wsdl:message>
+ <wsdl:message name="greetMeOneWayRequest">
+ <wsdl:part element="x1:greetMeOneWay" name="in"/>
+ </wsdl:message>
+
+ <wsdl:portType name="Greeter">
+ <wsdl:operation name="sayHi">
+ <wsdl:input message="tns:sayHiRequest" name="sayHiRequest"/>
+ <wsdl:output message="tns:sayHiResponse" name="sayHiResponse"/>
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMe">
+ <wsdl:input message="tns:greetMeRequest" name="greetMeRequest"/>
+ <wsdl:output message="tns:greetMeResponse" name="greetMeResponse"/>
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMeOneWay">
+ <wsdl:input message="tns:greetMeOneWayRequest" name="greetMeOneWayRequest"/>
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMeWithCallback">
+ <wsdl:input message="tns:greetMeRequest" name="greetMeRequest"/>
+ <wsdl:output message="tns:greetMeResponse" name="greetMeResponse"/>
+ </wsdl:operation>
+
+ </wsdl:portType>
+ <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <wsdl:operation name="sayHi">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="sayHiRequest">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="sayHiResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMe">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="greetMeRequest">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="greetMeResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMeOneWay">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="greetMeOneWayRequest">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMeWithCallback">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="greetMeRequest">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="greetMeResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+ <wsdl:service name="SOAPService">
+ <wsdl:port binding="tns:Greeter_SOAPBinding" name="SoapPort">
+ <soap:address location="http://localhost:9000/SoapContext/SoapPort"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
+