0001: /*
0002: * Licensed to the Apache Software Foundation (ASF) under one
0003: * or more contributor license agreements. See the NOTICE file
0004: * distributed with this work for additional information
0005: * regarding copyright ownership. The ASF licenses this file
0006: * to you under the Apache License, Version 2.0 (the
0007: * "License"); you may not use this file except in compliance
0008: * with the License. You may obtain a copy of the License at
0009: *
0010: * http://www.apache.org/licenses/LICENSE-2.0
0011: *
0012: * Unless required by applicable law or agreed to in writing,
0013: * software distributed under the License is distributed on an
0014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
0015: * KIND, either express or implied. See the License for the
0016: * specific language governing permissions and limitations
0017: * under the License.
0018: */
0019:
0020: package org.apache.axis2.jaxws.description;
0021:
0022: import junit.framework.TestCase;
0023: import org.apache.axis2.description.AxisService;
0024: import org.apache.axis2.description.Parameter;
0025: import org.apache.log4j.BasicConfigurator;
0026: import org.apache.ws.axis2.tests.EchoServiceImplWithSEI;
0027:
0028: import javax.jws.Oneway;
0029: import javax.jws.WebMethod;
0030: import javax.jws.WebParam;
0031: import javax.jws.WebResult;
0032: import javax.jws.WebService;
0033: import javax.jws.soap.SOAPBinding;
0034: import javax.xml.ws.Holder;
0035: import javax.xml.ws.RequestWrapper;
0036: import javax.xml.ws.ResponseWrapper;
0037:
0038: /**
0039: * Tests the creation of the Description classes based on a service implementation bean and various
0040: * combinations of annotations
0041: */
0042: public class AnnotationServiceImplDescriptionTests extends TestCase {
0043: static {
0044: // Note you will probably need to increase the java heap size, for example
0045: // -Xmx512m. This can be done by setting maven.junit.jvmargs in project.properties.
0046: // To change the settings, edit the log4j.property file
0047: // in the test-resources directory.
0048: BasicConfigurator.configure();
0049: }
0050:
0051: /**
0052: * Create the description classes with a service implementation that contains the @WebService
0053: * JSR-181 annotation which references an SEI.
0054: */
0055: public void testServiceImplWithSEI() {
0056: // Use the description factory directly; this will be done within the JAX-WS runtime
0057: ServiceDescription serviceDesc = DescriptionFactory
0058: .createServiceDescription(EchoServiceImplWithSEI.class);
0059: assertNotNull(serviceDesc);
0060:
0061: EndpointDescription[] endpointDesc = serviceDesc
0062: .getEndpointDescriptions();
0063: assertNotNull(endpointDesc);
0064: assertEquals(endpointDesc.length, 1);
0065:
0066: assertNotNull(endpointDesc[0].getAxisService());
0067:
0068: // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)? Currently assumes [0]
0069: EndpointInterfaceDescription endpointIntfDesc = endpointDesc[0]
0070: .getEndpointInterfaceDescription();
0071: assertNotNull(endpointIntfDesc);
0072: // TODO: (JLB) Remove code
0073: // assertEquals(EchoPort.class, endpointIntfDesc.getSEIClass());
0074:
0075: OperationDescription[] operations = endpointIntfDesc
0076: .getOperationForJavaMethod("badMethodName");
0077: assertNull(operations);
0078: operations = endpointIntfDesc.getOperationForJavaMethod("");
0079: assertNull(operations);
0080: operations = endpointIntfDesc
0081: .getOperationForJavaMethod((String) null);
0082: assertNull(operations);
0083: operations = endpointIntfDesc.getOperationForJavaMethod("echo");
0084: assertNotNull(operations);
0085: assertEquals(operations.length, 1);
0086: assertEquals(operations[0].getJavaMethodName(), "echo");
0087:
0088: String[] paramTypes = operations[0].getJavaParameters();
0089: assertNotNull(paramTypes);
0090: assertEquals(paramTypes.length, 1);
0091: assertEquals("javax.xml.ws.Holder<java.lang.String>",
0092: paramTypes[0]);
0093:
0094: // Test RequestWrapper annotations
0095: assertEquals(operations[0].getRequestWrapperLocalName(), "Echo");
0096: assertEquals(operations[0].getRequestWrapperTargetNamespace(),
0097: "http://ws.apache.org/axis2/tests");
0098: assertEquals(operations[0].getRequestWrapperClassName(),
0099: "org.apache.ws.axis2.tests.Echo");
0100:
0101: // Test ResponseWrapper annotations
0102: assertEquals(operations[0].getResponseWrapperLocalName(),
0103: "EchoResponse");
0104: assertEquals(operations[0].getResponseWrapperTargetNamespace(),
0105: "http://ws.apache.org/axis2/tests");
0106: assertEquals(operations[0].getResponseWrapperClassName(),
0107: "org.apache.ws.axis2.tests.EchoResponse");
0108:
0109: // Test SOAPBinding default; that annotation is not present in the SEI
0110: // Note that annotation could occur on the operation or the type
0111: // (although on this SEI it doesn't occur either place).
0112: assertEquals(SOAPBinding.Style.DOCUMENT, operations[0]
0113: .getSoapBindingStyle());
0114: assertEquals(SOAPBinding.Style.DOCUMENT, endpointIntfDesc
0115: .getSoapBindingStyle());
0116:
0117: }
0118:
0119: public void testAxisServiceBackpointer() {
0120: // Test that the AxisService points back to the EndpointDesc
0121: // TODO: Temporary: Create an AxisService to pass in using WSDL
0122: // TODO: Eventually remove AxisService paramater from the factory; AxisService should be created (using annotations/wsdl/wsm etc)
0123:
0124: // Creating the AxisService this way is temporary; it should be created as part of creating the EndpointDescription from the
0125: // Service Impl. For now, though, create a service-request-based ServiceDesc using WSDL. Then specificy that AxisService
0126: // on the creation of the ServiceDesc from the service impl. Verify that the AxisService points to the ServiceDesc.
0127:
0128: AxisService axisService = new AxisService();
0129: ServiceDescription serviceDesc = DescriptionFactory
0130: .createServiceDescriptionFromServiceImpl(
0131: EchoServiceImplWithSEI.class, axisService);
0132: EndpointDescription endpointDesc = serviceDesc
0133: .getEndpointDescriptions()[0];
0134: assertNotNull(serviceDesc);
0135: Parameter endpointDescParam = axisService
0136: .getParameter(EndpointDescription.AXIS_SERVICE_PARAMETER);
0137: assertNotNull(endpointDescParam);
0138: assertEquals(endpointDesc, endpointDescParam.getValue());
0139:
0140: }
0141:
0142: public void testOverloadedServiceImplWithSEI() {
0143: ServiceDescription serviceDesc = DescriptionFactory
0144: .createServiceDescription(DocLitWrappedImplWithSEI.class);
0145: assertNotNull(serviceDesc);
0146:
0147: EndpointDescription[] endpointDesc = serviceDesc
0148: .getEndpointDescriptions();
0149: assertNotNull(endpointDesc);
0150: assertEquals(endpointDesc.length, 1);
0151: // TODO: Using hardcoded endpointDesc[0] from ServiceDesc
0152: EndpointInterfaceDescription endpointIntfDesc = endpointDesc[0]
0153: .getEndpointInterfaceDescription();
0154: assertNotNull(endpointIntfDesc);
0155: // TODO: (JLB) Remove code
0156: // assertEquals(endpointIntfDesc.getSEIClass(), DocLitWrappedProxy.class);
0157:
0158: // Test for overloaded methods
0159: // SEI defines two Java methods with this name
0160: OperationDescription[] operations = endpointIntfDesc
0161: .getOperationForJavaMethod("invokeAsync");
0162: assertNotNull(operations);
0163: assertEquals(operations.length, 2);
0164: assertEquals(operations[0].getJavaMethodName(), "invokeAsync");
0165: assertEquals(operations[1].getJavaMethodName(), "invokeAsync");
0166:
0167: // Check the Java parameters, WebParam names, and WebResult (actually lack thereof) for each of these operations
0168:
0169: // Note regarding WebParam names:
0170: //In the client Async Call the the WebParam name will not remove JAX-WS AsyncHandler.
0171: //Proxy invoking the the Async Call will check the input method object and if
0172: //its of type JAX-WS AsyncHandler then that WebParam will be skipped.
0173: //This is done because AsyncHandler is NOT part of the contract, and thus it is NOT part of
0174: // the JAXB object constructed for the method invocation. The AsyncHandler is part of the
0175: // JAX-WS programming model to support an asynchronous callback to receive the response.
0176:
0177: // Note regarding WebResult annotation:
0178: // The async methods on this SEI do not carry a WebResult annotations.
0179: boolean twoArgSignatureChecked = false;
0180: boolean oneArgSignatureChecked = false;
0181: for (OperationDescription operation : operations) {
0182: String[] checkParams = operation.getJavaParameters();
0183: String[] webParamNames = operation.getParamNames();
0184: if (checkParams.length == 1) {
0185: // Check the one arguement signature
0186: if (oneArgSignatureChecked) {
0187: fail("One Arg signature occured more than once");
0188: } else {
0189: oneArgSignatureChecked = true;
0190: // Check the Java parameter
0191: assertEquals(checkParams[0], "java.lang.String");
0192: // Check the WebParam Names (see note above)
0193: assertEquals(1, webParamNames.length);
0194: assertEquals("invoke_str", webParamNames[0]);
0195: // Check the lack of a WebResult annotation and the default values for
0196: // SOAPBinding Style=DOCUMENT, Use=LITERAL, ParamStyle=WRAPPED
0197: // Note that the SOAPBinding annotation is also not present and thus fully defaulted.
0198: assertNull(((OperationDescriptionJava) operation)
0199: .getAnnoWebResult());
0200: assertEquals("return", operation.getResultName());
0201: assertEquals("return", operation
0202: .getResultPartName());
0203: assertEquals("", operation
0204: .getResultTargetNamespace());
0205: assertFalse(operation.isResultHeader());
0206: }
0207: } else if (checkParams.length == 2) {
0208: // Check the two arguement signature
0209: if (twoArgSignatureChecked) {
0210: fail("Two Arg signature occured more than once");
0211: } else {
0212: twoArgSignatureChecked = true;
0213: // Check the Java parameter
0214: assertEquals(checkParams[0], "java.lang.String");
0215: assertEquals(checkParams[1],
0216: "javax.xml.ws.AsyncHandler<org.test.proxy.doclitwrapped.ReturnType>");
0217: // Check the WebParam Names (see note above)
0218: assertEquals(2, webParamNames.length);
0219: assertEquals("invoke_str", webParamNames[0]);
0220: // Check the lack of a WebResult annotation and the default values for
0221: // SOAPBinding Style=DOCUMENT, Use=LITERAL, ParamStyle=WRAPPED
0222: // Note that the SOAPBinding annotation is also not present and thus fully defaulted.
0223: assertNull(((OperationDescriptionJava) operation)
0224: .getAnnoWebResult());
0225: assertEquals("return", operation.getResultName());
0226: assertEquals("return", operation
0227: .getResultPartName());
0228: assertEquals("", operation
0229: .getResultTargetNamespace());
0230: assertFalse(operation.isResultHeader());
0231: }
0232: } else {
0233: fail("Wrong number of parameters returned");
0234: }
0235: }
0236:
0237: // Test for a method with parameters of primitive types. Note
0238: // this method IS overloaded
0239: operations = endpointIntfDesc
0240: .getOperationForJavaMethod("twoWayHolderAsync");
0241: assertNotNull(operations);
0242: assertEquals(operations.length, 2);
0243: assertEquals(operations[0].getJavaMethodName(),
0244: "twoWayHolderAsync");
0245: assertEquals(operations[1].getJavaMethodName(),
0246: "twoWayHolderAsync");
0247:
0248: // Check the parameters for each operation
0249: twoArgSignatureChecked = false;
0250: boolean threeArgSignatureChecked = false;
0251: for (OperationDescription operation : operations) {
0252: String[] checkParams = operation.getJavaParameters();
0253: String[] webParamNames = operation.getParamNames();
0254: if (checkParams.length == 3) {
0255: // Check the one arguement signature
0256: if (threeArgSignatureChecked) {
0257: fail("Three Arg signature occured more than once");
0258: } else {
0259: threeArgSignatureChecked = true;
0260: assertEquals(checkParams[0], "java.lang.String");
0261: assertEquals(checkParams[1], "int");
0262: assertEquals(checkParams[2],
0263: "javax.xml.ws.AsyncHandler<org.test.proxy.doclitwrapped.TwoWayHolder>");
0264: // Check the WebParam Names (see note above)
0265: assertEquals(3, webParamNames.length);
0266: assertEquals("twoWayHolder_str", webParamNames[0]);
0267: assertEquals("twoWayHolder_int", webParamNames[1]);
0268: // Check the lack of a WebResult annotation and the default values for
0269: // SOAPBinding Style=DOCUMENT, Use=LITERAL, ParamStyle=WRAPPED
0270: // Note that the SOAPBinding annotation is also not present and thus fully defaulted.
0271: assertNull(((OperationDescriptionJava) operation)
0272: .getAnnoWebResult());
0273: assertEquals("return", operation.getResultName());
0274: assertEquals("return", operation
0275: .getResultPartName());
0276: assertEquals("", operation
0277: .getResultTargetNamespace());
0278: assertFalse(operation.isResultHeader());
0279: }
0280: } else if (checkParams.length == 2) {
0281: // Check the two arguement signature
0282: if (twoArgSignatureChecked) {
0283: fail("Two Arg signature occured more than once");
0284: } else {
0285: twoArgSignatureChecked = true;
0286: assertEquals(checkParams[0], "java.lang.String");
0287: assertEquals(checkParams[1], "int");
0288: // Check the WebParam Names (see note above)
0289: assertEquals(2, webParamNames.length);
0290: assertEquals("twoWayHolder_str", webParamNames[0]);
0291: assertEquals("twoWayHolder_int", webParamNames[1]);
0292: // Check the lack of a WebResult annotation and the default values for
0293: // SOAPBinding Style=DOCUMENT, Use=LITERAL, ParamStyle=WRAPPED
0294: // Note that the SOAPBinding annotation is also not present and thus fully defaulted.
0295: assertNull(((OperationDescriptionJava) operation)
0296: .getAnnoWebResult());
0297: assertEquals("return", operation.getResultName());
0298: assertEquals("return", operation
0299: .getResultPartName());
0300: assertEquals("", operation
0301: .getResultTargetNamespace());
0302: assertFalse(operation.isResultHeader());
0303: }
0304: } else {
0305: fail("Wrong number of parameters returned");
0306: }
0307: }
0308:
0309: // Test for a one-way, void method with no parameters which also is not overloaded
0310: operations = endpointIntfDesc
0311: .getOperationForJavaMethod("oneWayVoid");
0312: assertNotNull(operations);
0313: assertEquals(operations.length, 1);
0314: assertEquals(operations[0].getJavaMethodName(), "oneWayVoid");
0315: String[] checkEmptyParams = operations[0].getJavaParameters();
0316: assertNotNull(checkEmptyParams);
0317: assertEquals(checkEmptyParams.length, 0);
0318: assertEquals(true, operations[0].isOneWay());
0319: // Check the lack of a WebResult annotation and the default values for
0320: // a ONE-WAY / VOID operation with a SOAPBinding Style=DOCUMENT, Use=LITERAL, ParamStyle=WRAPPED
0321: // Note that the SOAPBinding annotation is also not present and thus fully defaulted.
0322: assertNull(((OperationDescriptionJava) operations[0])
0323: .getAnnoWebResult());
0324: assertFalse(((OperationDescriptionJava) operations[0])
0325: .isWebResultAnnotationSpecified());
0326: assertFalse(operations[0].isOperationReturningResult());
0327: assertEquals(null, operations[0].getResultName());
0328: assertEquals(null, operations[0].getResultPartName());
0329: assertEquals(null, operations[0].getResultTargetNamespace());
0330: assertFalse(operations[0].isResultHeader());
0331:
0332: // Test two-way method for lack of OneWay annotation and WebResult annotation
0333: operations = endpointIntfDesc
0334: .getOperationForJavaMethod("invoke");
0335: assertNotNull(operations);
0336: assertEquals(1, operations.length);
0337: assertEquals(false, operations[0].isOneWay());
0338: assertNotNull(((OperationDescriptionJava) operations[0])
0339: .getAnnoWebResult());
0340: assertEquals("return_str", operations[0].getResultName());
0341: assertEquals("return_str", operations[0].getResultPartName());
0342: assertEquals("", operations[0].getResultTargetNamespace());
0343: assertFalse(operations[0].isResultHeader());
0344: }
0345:
0346: // ===========================================
0347: // The following tests use implementation classes defined below
0348: // in order to test various specific annotation settings
0349: // ===========================================
0350:
0351: public void testSOAPBindingDefault() {
0352: EndpointInterfaceDescription testEndpointInterfaceDesc = getEndpointInterfaceDesc(SOAPBindingDefaultTestImpl.class);
0353:
0354: assertNull(((EndpointInterfaceDescriptionJava) testEndpointInterfaceDesc)
0355: .getAnnoSoapBinding());
0356: assertEquals(javax.jws.soap.SOAPBinding.Style.DOCUMENT,
0357: testEndpointInterfaceDesc.getSoapBindingStyle());
0358: assertEquals(javax.jws.soap.SOAPBinding.Use.LITERAL,
0359: testEndpointInterfaceDesc.getSoapBindingUse());
0360: assertEquals(javax.jws.soap.SOAPBinding.ParameterStyle.WRAPPED,
0361: testEndpointInterfaceDesc
0362: .getSoapBindingParameterStyle());
0363:
0364: OperationDescription operationDesc = testEndpointInterfaceDesc
0365: .getOperationForJavaMethod("echoString")[0];
0366: // Verify WebResult annotation default values for DOC/LIT/WRAPPED from a defaulted SOAPBinding
0367: assertNull(((OperationDescriptionJava) operationDesc)
0368: .getAnnoWebResult());
0369: assertEquals("return", operationDesc.getResultName());
0370: assertEquals("return", operationDesc.getResultPartName());
0371: assertEquals("", operationDesc.getResultTargetNamespace());
0372: assertFalse(operationDesc.isResultHeader());
0373:
0374: }
0375:
0376: public void testSOAPBindingDocEncBare() {
0377: //verify that we throw an exception when SOAPBinding.Use == ENCODED is specified
0378: try {
0379: EndpointInterfaceDescription testEndpointInterfaceDesc = getEndpointInterfaceDesc(SOAPBindingDocEncBareTestImpl.class);
0380: fail("Should have caused exception");
0381: } catch (Exception e) {
0382: // Expected path, SOAPBinding.Use == ENCODED is not supported
0383: }
0384: }
0385:
0386: public void testSOAPBindingDocLitBare() {
0387: EndpointInterfaceDescription testEndpointInterfaceDesc = getEndpointInterfaceDesc(SOAPBindingDocLitBareTestImpl.class);
0388:
0389: assertNotNull(((EndpointInterfaceDescriptionJava) testEndpointInterfaceDesc)
0390: .getAnnoSoapBinding());
0391: assertEquals(javax.jws.soap.SOAPBinding.Style.DOCUMENT,
0392: testEndpointInterfaceDesc.getSoapBindingStyle());
0393: assertEquals(javax.jws.soap.SOAPBinding.Use.LITERAL,
0394: testEndpointInterfaceDesc.getSoapBindingUse());
0395: assertEquals(javax.jws.soap.SOAPBinding.ParameterStyle.BARE,
0396: testEndpointInterfaceDesc
0397: .getSoapBindingParameterStyle());
0398: }
0399:
0400: public void testSOAPBindingMethodAnnotation() {
0401: // Verify that an impl without the method annotation uses the settings from the type
0402: EndpointInterfaceDescription testEndpointInterfaceDesc = getEndpointInterfaceDesc(SOAPBindingDocLitBareTestImpl.class);
0403:
0404: assertNotNull(((EndpointInterfaceDescriptionJava) testEndpointInterfaceDesc)
0405: .getAnnoSoapBinding());
0406: assertEquals(javax.jws.soap.SOAPBinding.Style.DOCUMENT,
0407: testEndpointInterfaceDesc.getSoapBindingStyle());
0408: assertEquals(javax.jws.soap.SOAPBinding.Use.LITERAL,
0409: testEndpointInterfaceDesc.getSoapBindingUse());
0410: assertEquals(javax.jws.soap.SOAPBinding.ParameterStyle.BARE,
0411: testEndpointInterfaceDesc
0412: .getSoapBindingParameterStyle());
0413:
0414: OperationDescription operationDesc = testEndpointInterfaceDesc
0415: .getOperationForJavaMethod("echoString")[0];
0416: assertNotNull(operationDesc);
0417: assertNull(((OperationDescriptionJava) operationDesc)
0418: .getAnnoSoapBinding());
0419: assertEquals(javax.jws.soap.SOAPBinding.Style.DOCUMENT,
0420: operationDesc.getSoapBindingStyle());
0421: assertEquals(javax.jws.soap.SOAPBinding.Use.LITERAL,
0422: operationDesc.getSoapBindingUse());
0423: assertEquals(javax.jws.soap.SOAPBinding.ParameterStyle.BARE,
0424: operationDesc.getSoapBindingParameterStyle());
0425:
0426: // Verify that the method annotation setting overrides the type annotatino setting
0427: testEndpointInterfaceDesc = getEndpointInterfaceDesc(SOAPBindingDefaultMethodTestImpl.class);
0428:
0429: assertNull(((EndpointInterfaceDescriptionJava) testEndpointInterfaceDesc)
0430: .getAnnoSoapBinding());
0431: assertEquals(javax.jws.soap.SOAPBinding.Style.DOCUMENT,
0432: testEndpointInterfaceDesc.getSoapBindingStyle());
0433: assertEquals(javax.jws.soap.SOAPBinding.Use.LITERAL,
0434: testEndpointInterfaceDesc.getSoapBindingUse());
0435: assertEquals(javax.jws.soap.SOAPBinding.ParameterStyle.WRAPPED,
0436: testEndpointInterfaceDesc
0437: .getSoapBindingParameterStyle());
0438:
0439: operationDesc = testEndpointInterfaceDesc
0440: .getOperationForJavaMethod("echoString")[0];
0441: assertNotNull(operationDesc);
0442: assertNotNull(((OperationDescriptionJava) operationDesc)
0443: .getAnnoSoapBinding());
0444: assertEquals(javax.jws.soap.SOAPBinding.Style.DOCUMENT,
0445: operationDesc.getSoapBindingStyle());
0446: assertEquals(javax.jws.soap.SOAPBinding.Use.LITERAL,
0447: operationDesc.getSoapBindingUse());
0448: assertEquals(javax.jws.soap.SOAPBinding.ParameterStyle.BARE,
0449: operationDesc.getSoapBindingParameterStyle());
0450: }
0451:
0452: public void testDefaultReqRspWrapper() {
0453:
0454: // Test paramaterStyle = WRAPPED set a the type level with various combinations of method annotation setting
0455: EndpointInterfaceDescription testEndpointInterfaceDesc = getEndpointInterfaceDesc(DefaultReqRspWrapperTestImpl.class);
0456: OperationDescription operationDesc = testEndpointInterfaceDesc
0457: .getOperationForJavaMethod("wrappedParams")[0];
0458: assertNotNull(operationDesc);
0459: assertEquals("wrappedParams", operationDesc
0460: .getRequestWrapperLocalName());
0461: assertEquals("wrappedParamsResponse", operationDesc
0462: .getResponseWrapperLocalName());
0463: assertEquals("http://description.jaxws.axis2.apache.org/",
0464: operationDesc.getRequestWrapperTargetNamespace());
0465: assertEquals("http://description.jaxws.axis2.apache.org/",
0466: operationDesc.getResponseWrapperTargetNamespace());
0467: assertNull(operationDesc.getRequestWrapperClassName());
0468: assertNull(operationDesc.getResponseWrapperClassName());
0469: // Test WebResult annotation defaults
0470: assertNull(((OperationDescriptionJava) operationDesc)
0471: .getAnnoWebResult());
0472: assertFalse(((OperationDescriptionJava) operationDesc)
0473: .isWebResultAnnotationSpecified());
0474: assertTrue(operationDesc.isOperationReturningResult());
0475: assertEquals("return", operationDesc.getResultName());
0476: assertEquals("return", operationDesc.getResultPartName());
0477: assertEquals("", operationDesc.getResultTargetNamespace());
0478: assertFalse(operationDesc.isResultHeader());
0479:
0480: operationDesc = testEndpointInterfaceDesc
0481: .getOperationForJavaMethod("bareParams")[0];
0482: assertNotNull(operationDesc);
0483: assertNull(operationDesc.getRequestWrapperLocalName());
0484: assertNull(operationDesc.getResponseWrapperLocalName());
0485: assertNull(operationDesc.getRequestWrapperTargetNamespace());
0486: assertNull(operationDesc.getResponseWrapperTargetNamespace());
0487: assertNull(operationDesc.getRequestWrapperClassName());
0488: assertNull(operationDesc.getResponseWrapperClassName());
0489: // Test WebResult annotation defaults
0490: assertNull(((OperationDescriptionJava) operationDesc)
0491: .getAnnoWebResult());
0492: assertFalse(((OperationDescriptionJava) operationDesc)
0493: .isWebResultAnnotationSpecified());
0494: assertTrue(operationDesc.isOperationReturningResult());
0495: assertEquals("bareParamsResponse", operationDesc
0496: .getResultName());
0497: assertEquals("bareParamsResponse", operationDesc
0498: .getResultPartName());
0499: assertEquals("http://description.jaxws.axis2.apache.org/",
0500: operationDesc.getResultTargetNamespace());
0501: assertFalse(operationDesc.isResultHeader());
0502:
0503: // Test paramaterStyle = BARE set a the type level with various combinations of method annotation setting
0504: testEndpointInterfaceDesc = getEndpointInterfaceDesc(DefaultReqRspWrapperBareTestImpl.class);
0505: operationDesc = testEndpointInterfaceDesc
0506: .getOperationForJavaMethod("wrappedParams")[0];
0507: assertNotNull(operationDesc);
0508: assertEquals("wrappedParams", operationDesc
0509: .getRequestWrapperLocalName());
0510: assertEquals("wrappedParamsResponse", operationDesc
0511: .getResponseWrapperLocalName());
0512: assertEquals("http://description.jaxws.axis2.apache.org/",
0513: operationDesc.getRequestWrapperTargetNamespace());
0514: assertEquals("http://description.jaxws.axis2.apache.org/",
0515: operationDesc.getResponseWrapperTargetNamespace());
0516: assertNull(operationDesc.getRequestWrapperClassName());
0517: assertNull(operationDesc.getResponseWrapperClassName());
0518: operationDesc = testEndpointInterfaceDesc
0519: .getOperationForJavaMethod("bareParams")[0];
0520: assertNotNull(operationDesc);
0521: assertNull(operationDesc.getRequestWrapperLocalName());
0522: assertNull(operationDesc.getResponseWrapperLocalName());
0523: assertNull(operationDesc.getRequestWrapperTargetNamespace());
0524: assertNull(operationDesc.getResponseWrapperTargetNamespace());
0525: assertNull(operationDesc.getRequestWrapperClassName());
0526: assertNull(operationDesc.getResponseWrapperClassName());
0527: }
0528:
0529: public void testReqRspWrapper() {
0530: EndpointInterfaceDescription testEndpointInterfaceDesc = getEndpointInterfaceDesc(ReqRspWrapperTestImpl.class);
0531: OperationDescription operationDesc = testEndpointInterfaceDesc
0532: .getOperationForJavaMethod("method1")[0];
0533: assertNotNull(operationDesc);
0534: assertEquals("method1ReqWrapper", operationDesc
0535: .getRequestWrapperLocalName());
0536: assertEquals("method1RspWrapper", operationDesc
0537: .getResponseWrapperLocalName());
0538: assertEquals("http://a.b.c.method1ReqTNS", operationDesc
0539: .getRequestWrapperTargetNamespace());
0540: assertEquals("http://a.b.c.method1RspTNS", operationDesc
0541: .getResponseWrapperTargetNamespace());
0542: assertEquals(
0543: "org.apache.axis2.jaxws.description.AnnotationServiceImplDescriptionTests.ReqRspWrapperTestImpl.method1ReqWrapper",
0544: operationDesc.getRequestWrapperClassName());
0545: assertEquals(
0546: "org.apache.axis2.jaxws.description.AnnotationServiceImplDescriptionTests.ReqRspWrapperTestImpl.method1RspWrapper",
0547: operationDesc.getResponseWrapperClassName());
0548:
0549: operationDesc = testEndpointInterfaceDesc
0550: .getOperationForJavaMethod("method2")[0];
0551: assertEquals("method2", operationDesc
0552: .getRequestWrapperLocalName());
0553: assertEquals("method2RspWrapper", operationDesc
0554: .getResponseWrapperLocalName());
0555: assertEquals("http://a.b.c.method2ReqTNS", operationDesc
0556: .getRequestWrapperTargetNamespace());
0557: assertEquals("http://a.b.c.method2RspTNS", operationDesc
0558: .getResponseWrapperTargetNamespace());
0559: assertEquals(
0560: "org.apache.axis2.jaxws.description.AnnotationServiceImplDescriptionTests.ReqRspWrapperTestImpl.method2ReqWrapper",
0561: operationDesc.getRequestWrapperClassName());
0562: assertNull(operationDesc.getResponseWrapperClassName());
0563: }
0564:
0565: public void testWebMethod() {
0566: EndpointInterfaceDescription testEndpointInterfaceDesc = getEndpointInterfaceDesc(WebMethodTestImpl.class);
0567:
0568: // Test results from method with no annotation
0569: OperationDescription[] operationDescs = testEndpointInterfaceDesc
0570: .getOperationForJavaMethod("method1");
0571: assertNull(operationDescs);
0572:
0573: OperationDescription operationDesc = testEndpointInterfaceDesc
0574: .getOperationForJavaMethod("method2")[0];
0575: assertNotNull(operationDesc);
0576: assertEquals("renamedMethod2", operationDesc.getOperationName());
0577: assertEquals("", operationDesc.getAction());
0578: assertFalse(operationDesc.isExcluded());
0579:
0580: operationDesc = testEndpointInterfaceDesc
0581: .getOperationForJavaMethod("method3")[0];
0582: assertNotNull(operationDesc);
0583: assertEquals("method3", operationDesc.getOperationName());
0584: assertEquals("ActionMethod3", operationDesc.getAction());
0585: assertFalse(operationDesc.isExcluded());
0586:
0587: operationDesc = testEndpointInterfaceDesc
0588: .getOperationForJavaMethod("method4")[0];
0589: assertNotNull(operationDesc);
0590: assertEquals("renamedMethod4", operationDesc.getOperationName());
0591: assertEquals("ActionMethod4", operationDesc.getAction());
0592: assertFalse(operationDesc.isExcluded());
0593:
0594: operationDesc = testEndpointInterfaceDesc
0595: .getOperationForJavaMethod("method4")[0];
0596: assertNotNull(operationDesc);
0597: assertEquals("renamedMethod4", operationDesc.getOperationName());
0598: assertEquals("ActionMethod4", operationDesc.getAction());
0599: assertFalse(operationDesc.isExcluded());
0600:
0601: operationDescs = testEndpointInterfaceDesc
0602: .getOperationForJavaMethod("method5");
0603: assertNull(operationDescs);
0604:
0605: }
0606:
0607: public void testWebResult() {
0608: EndpointInterfaceDescription testEndpointInterfaceDesc = getEndpointInterfaceDesc(WebResultTestImpl.class);
0609:
0610: // DOCUMENT / LITERAL / WRAPPED methods
0611:
0612: OperationDescription[] operationDescs = testEndpointInterfaceDesc
0613: .getOperationForJavaMethod("method0");
0614: assertNull(operationDescs);
0615:
0616: OperationDescription operationDesc = testEndpointInterfaceDesc
0617: .getOperationForJavaMethod("method1")[0];
0618: assertNotNull(operationDesc);
0619: assertNull(((OperationDescriptionJava) operationDesc)
0620: .getAnnoWebResult());
0621: assertFalse(((OperationDescriptionJava) operationDesc)
0622: .isWebResultAnnotationSpecified());
0623: assertTrue(operationDesc.isOperationReturningResult());
0624: assertEquals("return", operationDesc.getResultName());
0625: assertEquals("return", operationDesc.getResultPartName());
0626: assertEquals("", operationDesc.getResultTargetNamespace());
0627: assertFalse(operationDesc.isResultHeader());
0628:
0629: operationDesc = testEndpointInterfaceDesc
0630: .getOperationForJavaMethod("method2")[0];
0631: assertNotNull(operationDesc);
0632: assertNotNull(((OperationDescriptionJava) operationDesc)
0633: .getAnnoWebResult());
0634: assertTrue(((OperationDescriptionJava) operationDesc)
0635: .isWebResultAnnotationSpecified());
0636: assertTrue(operationDesc.isOperationReturningResult());
0637: assertEquals("return", operationDesc.getResultName());
0638: assertEquals("return", operationDesc.getResultPartName());
0639: assertEquals("", operationDesc.getResultTargetNamespace());
0640: assertFalse(operationDesc.isResultHeader());
0641:
0642: operationDesc = testEndpointInterfaceDesc
0643: .getOperationForJavaMethod("method3")[0];
0644: assertNotNull(operationDesc);
0645: assertNotNull(((OperationDescriptionJava) operationDesc)
0646: .getAnnoWebResult());
0647: assertTrue(((OperationDescriptionJava) operationDesc)
0648: .isWebResultAnnotationSpecified());
0649: assertTrue(operationDesc.isOperationReturningResult());
0650: assertEquals("resultName", operationDesc.getResultName());
0651: assertEquals("resultName", operationDesc.getResultPartName());
0652: assertEquals("", operationDesc.getResultTargetNamespace());
0653: assertFalse(operationDesc.isResultHeader());
0654:
0655: operationDesc = testEndpointInterfaceDesc
0656: .getOperationForJavaMethod("method4")[0];
0657: assertNotNull(operationDesc);
0658: assertNotNull(((OperationDescriptionJava) operationDesc)
0659: .getAnnoWebResult());
0660: assertTrue(((OperationDescriptionJava) operationDesc)
0661: .isWebResultAnnotationSpecified());
0662: assertTrue(operationDesc.isOperationReturningResult());
0663: assertEquals("resultName", operationDesc.getResultName());
0664: assertEquals("partName", operationDesc.getResultPartName());
0665: assertEquals("http://result.test.target.namespace/",
0666: operationDesc.getResultTargetNamespace());
0667: assertFalse(operationDesc.isResultHeader());
0668:
0669: operationDesc = testEndpointInterfaceDesc
0670: .getOperationForJavaMethod("method5")[0];
0671: assertNotNull(operationDesc);
0672: assertNotNull(((OperationDescriptionJava) operationDesc)
0673: .getAnnoWebResult());
0674: assertTrue(((OperationDescriptionJava) operationDesc)
0675: .isWebResultAnnotationSpecified());
0676: assertTrue(operationDesc.isOperationReturningResult());
0677: assertEquals("resultName5", operationDesc.getResultName());
0678: assertEquals("partName5", operationDesc.getResultPartName());
0679: assertEquals("http://result.test.target.namespace.5/",
0680: operationDesc.getResultTargetNamespace());
0681: assertTrue(operationDesc.isResultHeader());
0682:
0683: operationDesc = testEndpointInterfaceDesc
0684: .getOperationForJavaMethod("method6")[0];
0685: assertNotNull(operationDesc);
0686: assertNull(((OperationDescriptionJava) operationDesc)
0687: .getAnnoWebResult());
0688: assertFalse(((OperationDescriptionJava) operationDesc)
0689: .isWebResultAnnotationSpecified());
0690: assertFalse(operationDesc.isOperationReturningResult());
0691: assertEquals(null, operationDesc.getResultName());
0692: assertEquals(null, operationDesc.getResultPartName());
0693: assertEquals(null, operationDesc.getResultTargetNamespace());
0694: assertFalse(operationDesc.isResultHeader());
0695:
0696: operationDesc = testEndpointInterfaceDesc
0697: .getOperationForJavaMethod("method7")[0];
0698: assertNotNull(operationDesc);
0699: assertNotNull(((OperationDescriptionJava) operationDesc)
0700: .getAnnoWebResult());
0701: assertTrue(((OperationDescriptionJava) operationDesc)
0702: .isWebResultAnnotationSpecified());
0703: assertTrue(operationDesc.isOperationReturningResult());
0704: assertEquals("resultName7", operationDesc.getResultName());
0705: assertEquals("partName7", operationDesc.getResultPartName());
0706: assertEquals("http://service.test.target.namespace/",
0707: operationDesc.getResultTargetNamespace());
0708: assertTrue(operationDesc.isResultHeader());
0709:
0710: // DOCUMENT / LITERAL / BARE methods
0711:
0712: operationDescs = testEndpointInterfaceDesc
0713: .getOperationForJavaMethod("method0_bare");
0714: assertNull(operationDescs);
0715:
0716: operationDesc = testEndpointInterfaceDesc
0717: .getOperationForJavaMethod("method1_bare")[0];
0718: assertNotNull(operationDesc);
0719: assertNull(((OperationDescriptionJava) operationDesc)
0720: .getAnnoWebResult());
0721: assertFalse(((OperationDescriptionJava) operationDesc)
0722: .isWebResultAnnotationSpecified());
0723: assertTrue(operationDesc.isOperationReturningResult());
0724: assertEquals("renamedMethod1BareResponse", operationDesc
0725: .getResultName());
0726: assertEquals("renamedMethod1BareResponse", operationDesc
0727: .getResultPartName());
0728: assertEquals("http://service.test.target.namespace/",
0729: operationDesc.getResultTargetNamespace());
0730: assertFalse(operationDesc.isResultHeader());
0731:
0732: operationDesc = testEndpointInterfaceDesc
0733: .getOperationForJavaMethod("method2_bare")[0];
0734: assertNotNull(operationDesc);
0735: assertNotNull(((OperationDescriptionJava) operationDesc)
0736: .getAnnoWebResult());
0737: assertTrue(((OperationDescriptionJava) operationDesc)
0738: .isWebResultAnnotationSpecified());
0739: assertTrue(operationDesc.isOperationReturningResult());
0740: assertEquals("renamedMethod2BareResponse", operationDesc
0741: .getResultName());
0742: assertEquals("renamedMethod2BareResponse", operationDesc
0743: .getResultPartName());
0744: assertEquals("http://service.test.target.namespace/",
0745: operationDesc.getResultTargetNamespace());
0746: assertFalse(operationDesc.isResultHeader());
0747:
0748: operationDesc = testEndpointInterfaceDesc
0749: .getOperationForJavaMethod("method3_bare")[0];
0750: assertNotNull(operationDesc);
0751: assertNotNull(((OperationDescriptionJava) operationDesc)
0752: .getAnnoWebResult());
0753: assertTrue(((OperationDescriptionJava) operationDesc)
0754: .isWebResultAnnotationSpecified());
0755: assertTrue(operationDesc.isOperationReturningResult());
0756: assertEquals("resultName", operationDesc.getResultName());
0757: assertEquals("resultName", operationDesc.getResultPartName());
0758: assertEquals("http://service.test.target.namespace/",
0759: operationDesc.getResultTargetNamespace());
0760: assertFalse(operationDesc.isResultHeader());
0761:
0762: operationDesc = testEndpointInterfaceDesc
0763: .getOperationForJavaMethod("method4_bare")[0];
0764: assertNotNull(operationDesc);
0765: assertNotNull(((OperationDescriptionJava) operationDesc)
0766: .getAnnoWebResult());
0767: assertTrue(((OperationDescriptionJava) operationDesc)
0768: .isWebResultAnnotationSpecified());
0769: assertTrue(operationDesc.isOperationReturningResult());
0770: assertEquals("resultName", operationDesc.getResultName());
0771: assertEquals("partName", operationDesc.getResultPartName());
0772: assertEquals("http://result.bare.test.target.namespace/",
0773: operationDesc.getResultTargetNamespace());
0774: assertFalse(operationDesc.isResultHeader());
0775:
0776: operationDesc = testEndpointInterfaceDesc
0777: .getOperationForJavaMethod("method5_bare")[0];
0778: assertNotNull(operationDesc);
0779: assertNotNull(((OperationDescriptionJava) operationDesc)
0780: .getAnnoWebResult());
0781: assertTrue(((OperationDescriptionJava) operationDesc)
0782: .isWebResultAnnotationSpecified());
0783: assertTrue(operationDesc.isOperationReturningResult());
0784: assertEquals("resultName5", operationDesc.getResultName());
0785: assertEquals("partName5", operationDesc.getResultPartName());
0786: assertEquals("http://result.bare.test.target.namespace.5/",
0787: operationDesc.getResultTargetNamespace());
0788: assertTrue(operationDesc.isResultHeader());
0789:
0790: operationDesc = testEndpointInterfaceDesc
0791: .getOperationForJavaMethod("method6_bare")[0];
0792: assertNotNull(operationDesc);
0793: assertNull(((OperationDescriptionJava) operationDesc)
0794: .getAnnoWebResult());
0795: assertFalse(((OperationDescriptionJava) operationDesc)
0796: .isWebResultAnnotationSpecified());
0797: assertFalse(operationDesc.isOperationReturningResult());
0798: assertEquals(null, operationDesc.getResultName());
0799: assertEquals(null, operationDesc.getResultPartName());
0800: assertEquals(null, operationDesc.getResultTargetNamespace());
0801: assertFalse(operationDesc.isResultHeader());
0802:
0803: operationDesc = testEndpointInterfaceDesc
0804: .getOperationForJavaMethod("method7")[0];
0805: assertNotNull(operationDesc);
0806: assertNotNull(((OperationDescriptionJava) operationDesc)
0807: .getAnnoWebResult());
0808: assertTrue(((OperationDescriptionJava) operationDesc)
0809: .isWebResultAnnotationSpecified());
0810: assertTrue(operationDesc.isOperationReturningResult());
0811: assertEquals("resultName7", operationDesc.getResultName());
0812: assertEquals("partName7", operationDesc.getResultPartName());
0813: assertEquals("http://service.test.target.namespace/",
0814: operationDesc.getResultTargetNamespace());
0815: assertTrue(operationDesc.isResultHeader());
0816: }
0817:
0818: public void testWebParamWrapped() {
0819: EndpointInterfaceDescription testEndpointInterfaceDesc = getEndpointInterfaceDesc(WebParamTestImpl.class);
0820:
0821: // DOCUMENT / LITERAL / WRAPPED methods
0822:
0823: // method0
0824: OperationDescription[] operationDescs = testEndpointInterfaceDesc
0825: .getOperationForJavaMethod("method0");
0826: assertNull(operationDescs);
0827:
0828: // method00
0829: operationDescs = testEndpointInterfaceDesc
0830: .getOperationForJavaMethod("method00");
0831: assertNull(operationDescs);
0832:
0833: // method1
0834: OperationDescription operationDesc = testEndpointInterfaceDesc
0835: .getOperationForJavaMethod("method1")[0];
0836: assertNotNull(operationDesc);
0837: ParameterDescription[] paramDesc = operationDesc
0838: .getParameterDescriptions();
0839: assertEquals(1, paramDesc.length);
0840: ParameterDescription checkParamDesc = paramDesc[0];
0841: assertNull(((ParameterDescriptionJava) checkParamDesc)
0842: .getAnnoWebParam());
0843: assertEquals("arg0", checkParamDesc.getParameterName());
0844: assertEquals("arg0", checkParamDesc.getPartName());
0845: assertEquals(checkParamDesc, operationDesc
0846: .getParameterDescription(0));
0847: assertEquals(checkParamDesc, operationDesc
0848: .getParameterDescription("arg0"));
0849: assertEquals(String.class, checkParamDesc.getParameterType());
0850: assertEquals("", checkParamDesc.getTargetNamespace());
0851: assertEquals(WebParam.Mode.IN, checkParamDesc.getMode());
0852: assertFalse(checkParamDesc.isHeader());
0853:
0854: // method2
0855: operationDesc = testEndpointInterfaceDesc
0856: .getOperationForJavaMethod("method2")[0];
0857: assertNotNull(operationDesc);
0858: paramDesc = operationDesc.getParameterDescriptions();
0859: assertEquals(1, paramDesc.length);
0860: checkParamDesc = paramDesc[0];
0861: assertNotNull(((ParameterDescriptionJava) checkParamDesc)
0862: .getAnnoWebParam());
0863: assertEquals("arg0", checkParamDesc.getParameterName());
0864: assertEquals("arg0", checkParamDesc.getPartName());
0865: assertEquals(checkParamDesc, operationDesc
0866: .getParameterDescription(0));
0867: assertEquals(checkParamDesc, operationDesc
0868: .getParameterDescription("arg0"));
0869: assertEquals(String.class, checkParamDesc.getParameterType());
0870: assertEquals("", checkParamDesc.getTargetNamespace());
0871: assertEquals(WebParam.Mode.IN, checkParamDesc.getMode());
0872: assertFalse(checkParamDesc.isHeader());
0873:
0874: // method3
0875: operationDesc = testEndpointInterfaceDesc
0876: .getOperationForJavaMethod("method3")[0];
0877: assertNotNull(operationDesc);
0878: paramDesc = operationDesc.getParameterDescriptions();
0879: assertEquals(5, paramDesc.length);
0880: checkParamDesc = paramDesc[0];
0881: assertNotNull(((ParameterDescriptionJava) checkParamDesc)
0882: .getAnnoWebParam());
0883: assertEquals("param0NameMethod3", checkParamDesc
0884: .getParameterName());
0885: assertEquals("param0NameMethod3", checkParamDesc.getPartName());
0886: assertEquals(checkParamDesc, operationDesc
0887: .getParameterDescription(0));
0888: assertEquals(checkParamDesc, operationDesc
0889: .getParameterDescription("param0NameMethod3"));
0890: assertEquals(String.class, checkParamDesc.getParameterType());
0891: assertEquals("", checkParamDesc.getTargetNamespace());
0892: assertEquals(WebParam.Mode.IN, checkParamDesc.getMode());
0893: assertFalse(checkParamDesc.isHeader());
0894:
0895: checkParamDesc = paramDesc[1];
0896: assertNotNull(((ParameterDescriptionJava) checkParamDesc)
0897: .getAnnoWebParam());
0898: assertEquals("param1NameMethod3", checkParamDesc
0899: .getParameterName());
0900: assertEquals("param1NameMethod3", checkParamDesc.getPartName());
0901: assertEquals(checkParamDesc, operationDesc
0902: .getParameterDescription(1));
0903: assertEquals(checkParamDesc, operationDesc
0904: .getParameterDescription("param1NameMethod3"));
0905: assertEquals(Holder.class, checkParamDesc.getParameterType());
0906: assertEquals(Integer.class, checkParamDesc
0907: .getParameterActualType());
0908: assertTrue(checkParamDesc.isHolderType());
0909: assertEquals("", checkParamDesc.getTargetNamespace());
0910: assertEquals(WebParam.Mode.INOUT, checkParamDesc.getMode());
0911: assertFalse(checkParamDesc.isHeader());
0912:
0913: checkParamDesc = paramDesc[2];
0914: assertNull(((ParameterDescriptionJava) checkParamDesc)
0915: .getAnnoWebParam());
0916: assertEquals("arg2", checkParamDesc.getParameterName());
0917: assertEquals("arg2", checkParamDesc.getPartName());
0918: assertEquals(checkParamDesc, operationDesc
0919: .getParameterDescription(2));
0920: assertEquals(checkParamDesc, operationDesc
0921: .getParameterDescription("arg2"));
0922: assertEquals(Object.class, checkParamDesc.getParameterType());
0923: assertEquals("", checkParamDesc.getTargetNamespace());
0924: assertEquals(WebParam.Mode.IN, checkParamDesc.getMode());
0925: assertFalse(checkParamDesc.isHeader());
0926:
0927: checkParamDesc = paramDesc[3];
0928: assertNull(((ParameterDescriptionJava) checkParamDesc)
0929: .getAnnoWebParam());
0930: assertEquals("arg3", checkParamDesc.getParameterName());
0931: assertEquals("arg3", checkParamDesc.getPartName());
0932: assertEquals(checkParamDesc, operationDesc
0933: .getParameterDescription(3));
0934: assertEquals(checkParamDesc, operationDesc
0935: .getParameterDescription("arg3"));
0936: assertEquals(Integer.TYPE, checkParamDesc.getParameterType());
0937: assertEquals("", checkParamDesc.getTargetNamespace());
0938: assertEquals(WebParam.Mode.IN, checkParamDesc.getMode());
0939: assertFalse(checkParamDesc.isHeader());
0940:
0941: checkParamDesc = paramDesc[4];
0942: assertNotNull(((ParameterDescriptionJava) checkParamDesc)
0943: .getAnnoWebParam());
0944: assertEquals("lastParamNameMethod3", checkParamDesc
0945: .getParameterName());
0946: assertEquals("lastParamNameMethod3", checkParamDesc
0947: .getPartName());
0948: assertEquals(checkParamDesc, operationDesc
0949: .getParameterDescription(4));
0950: assertEquals(checkParamDesc, operationDesc
0951: .getParameterDescription("lastParamNameMethod3"));
0952: assertEquals(String.class, checkParamDesc.getParameterType());
0953: assertEquals("", checkParamDesc.getTargetNamespace());
0954: assertEquals(WebParam.Mode.IN, checkParamDesc.getMode());
0955: assertFalse(checkParamDesc.isHeader());
0956:
0957: // method4
0958: operationDesc = testEndpointInterfaceDesc
0959: .getOperationForJavaMethod("method4")[0];
0960: assertNotNull(operationDesc);
0961: paramDesc = operationDesc.getParameterDescriptions();
0962: assertEquals(5, paramDesc.length);
0963:
0964: checkParamDesc = paramDesc[0];
0965: assertNotNull(((ParameterDescriptionJava) checkParamDesc)
0966: .getAnnoWebParam());
0967: assertEquals("param0NameMethod4", checkParamDesc
0968: .getParameterName());
0969: assertEquals("param0PartName", checkParamDesc.getPartName());
0970: assertEquals(checkParamDesc, operationDesc
0971: .getParameterDescription(0));
0972: assertEquals(checkParamDesc, operationDesc
0973: .getParameterDescription("param0NameMethod4"));
0974: assertEquals(String.class, checkParamDesc.getParameterType());
0975: assertEquals("http://param.4.0.result.test.target.namespace/",
0976: checkParamDesc.getTargetNamespace());
0977: assertEquals(WebParam.Mode.IN, checkParamDesc.getMode());
0978: assertFalse(checkParamDesc.isHeader());
0979:
0980: checkParamDesc = paramDesc[1];
0981: assertNotNull(((ParameterDescriptionJava) checkParamDesc)
0982: .getAnnoWebParam());
0983: assertEquals("param1NameMethod4", checkParamDesc
0984: .getParameterName());
0985: assertEquals("param1PartName", checkParamDesc.getPartName());
0986: assertEquals(checkParamDesc, operationDesc
0987: .getParameterDescription(1));
0988: assertEquals(checkParamDesc, operationDesc
0989: .getParameterDescription("param1NameMethod4"));
0990: assertEquals(Integer.TYPE, checkParamDesc.getParameterType());
0991: assertEquals("http://param.4.1.result.test.target.namespace/",
0992: checkParamDesc.getTargetNamespace());
0993: assertEquals(WebParam.Mode.IN, checkParamDesc.getMode());
0994: assertFalse(checkParamDesc.isHeader());
0995:
0996: checkParamDesc = paramDesc[2];
0997: assertNull(((ParameterDescriptionJava) checkParamDesc)
0998: .getAnnoWebParam());
0999: assertEquals("arg2", checkParamDesc.getParameterName());
1000: assertEquals("arg2", checkParamDesc.getPartName());
1001: assertEquals(checkParamDesc, operationDesc
1002: .getParameterDescription(2));
1003: assertEquals(checkParamDesc, operationDesc
1004: .getParameterDescription("arg2"));
1005: assertEquals(Object.class, checkParamDesc.getParameterType());
1006: assertEquals("", checkParamDesc.getTargetNamespace());
1007: assertEquals(WebParam.Mode.IN, checkParamDesc.getMode());
1008: assertFalse(checkParamDesc.isHeader());
1009:
1010: checkParamDesc = paramDesc[3];
1011: assertNull(((ParameterDescriptionJava) checkParamDesc)
1012: .getAnnoWebParam());
1013: assertEquals("arg3", checkParamDesc.getParameterName());
1014: assertEquals("arg3", checkParamDesc.getPartName());
1015: assertEquals(checkParamDesc, operationDesc
1016: .getParameterDescription(3));
1017: assertEquals(checkParamDesc, operationDesc
1018: .getParameterDescription("arg3"));
1019: assertEquals(Holder.class, checkParamDesc.getParameterType());
1020: assertEquals(Integer.class, checkParamDesc
1021: .getParameterActualType());
1022: assertTrue(checkParamDesc.isHolderType());
1023: assertEquals("", checkParamDesc.getTargetNamespace());
1024: assertEquals(WebParam.Mode.INOUT, checkParamDesc.getMode());
1025: assertFalse(checkParamDesc.isHeader());
1026:
1027: checkParamDesc = paramDesc[4];
1028: assertNotNull(((ParameterDescriptionJava) checkParamDesc)
1029: .getAnnoWebParam());
1030: assertEquals("lastParamNameMethod4", checkParamDesc
1031: .getParameterName());
1032: assertEquals("lastParamNameMethod4", checkParamDesc
1033: .getPartName());
1034: assertEquals(checkParamDesc, operationDesc
1035: .getParameterDescription(4));
1036: assertEquals(checkParamDesc, operationDesc
1037: .getParameterDescription("lastParamNameMethod4"));
1038: assertEquals(String.class, checkParamDesc.getParameterType());
1039: assertEquals("", checkParamDesc.getTargetNamespace());
1040: assertEquals(WebParam.Mode.IN, checkParamDesc.getMode());
1041: assertFalse(checkParamDesc.isHeader());
1042:
1043: // method5
1044: operationDesc = testEndpointInterfaceDesc
1045: .getOperationForJavaMethod("method5")[0];
1046: assertNotNull(operationDesc);
1047: paramDesc = operationDesc.getParameterDescriptions();
1048: assertEquals(5, paramDesc.length);
1049:
1050: checkParamDesc = paramDesc[0];
1051: assertNotNull(((ParameterDescriptionJava) checkParamDesc)
1052: .getAnnoWebParam());
1053: assertEquals("param0NameMethod5", checkParamDesc
1054: .getParameterName());
1055: assertEquals("param0PartName", checkParamDesc.getPartName());
1056: assertEquals(checkParamDesc, operationDesc
1057: .getParameterDescription(0));
1058: assertEquals(checkParamDesc, operationDesc
1059: .getParameterDescription("param0NameMethod5"));
1060: assertEquals(String.class, checkParamDesc.getParameterType());
1061: assertFalse(checkParamDesc.isHolderType());
1062: assertEquals("http://param.5.0.result.test.target.namespace/",
1063: checkParamDesc.getTargetNamespace());
1064: assertEquals(WebParam.Mode.IN, checkParamDesc.getMode());
1065: assertTrue(checkParamDesc.isHeader());
1066:
1067: checkParamDesc = paramDesc[1];
1068: assertNotNull(((ParameterDescriptionJava) checkParamDesc)
1069: .getAnnoWebParam());
1070: assertEquals("param1NameMethod5", checkParamDesc
1071: .getParameterName());
1072: assertEquals("param1PartName", checkParamDesc.getPartName());
1073: assertEquals(checkParamDesc, operationDesc
1074: .getParameterDescription(1));
1075: assertEquals(checkParamDesc, operationDesc
1076: .getParameterDescription("param1NameMethod5"));
1077: assertEquals(Integer.TYPE, checkParamDesc.getParameterType());
1078: assertFalse(checkParamDesc.isHolderType());
1079: assertEquals("http://param.5.1.result.test.target.namespace/",
1080: checkParamDesc.getTargetNamespace());
1081: assertEquals(WebParam.Mode.IN, checkParamDesc.getMode());
1082: assertFalse(checkParamDesc.isHeader());
1083:
1084: checkParamDesc = paramDesc[2];
1085: assertNull(((ParameterDescriptionJava) checkParamDesc)
1086: .getAnnoWebParam());
1087: assertEquals("arg2", checkParamDesc.getParameterName());
1088: assertEquals("arg2", checkParamDesc.getPartName());
1089: assertEquals(checkParamDesc, operationDesc
1090: .getParameterDescription(2));
1091: assertEquals(checkParamDesc, operationDesc
1092: .getParameterDescription("arg2"));
1093: assertEquals(Holder.class, checkParamDesc.getParameterType());
1094: assertEquals(Object.class, checkParamDesc
1095: .getParameterActualType());
1096: assertTrue(checkParamDesc.isHolderType());
1097: assertEquals("", checkParamDesc.getTargetNamespace());
1098: assertEquals(WebParam.Mode.INOUT, checkParamDesc.getMode());
1099: assertFalse(checkParamDesc.isHeader());
1100:
1101: checkParamDesc = paramDesc[3];
1102: assertNull(((ParameterDescriptionJava) checkParamDesc)
1103: .getAnnoWebParam());
1104: assertEquals("arg3", checkParamDesc.getParameterName());
1105: assertEquals("arg3", checkParamDesc.getPartName());
1106: assertEquals(checkParamDesc, operationDesc
1107: .getParameterDescription(3));
1108: assertEquals(checkParamDesc, operationDesc
1109: .getParameterDescription("arg3"));
1110: assertEquals(Integer.TYPE, checkParamDesc.getParameterType());
1111: assertEquals("", checkParamDesc.getTargetNamespace());
1112: assertEquals(WebParam.Mode.IN, checkParamDesc.getMode());
1113: assertFalse(checkParamDesc.isHeader());
1114:
1115: checkParamDesc = paramDesc[4];
1116: assertNotNull(((ParameterDescriptionJava) checkParamDesc)
1117: .getAnnoWebParam());
1118: assertEquals("lastParamNameMethod5", checkParamDesc
1119: .getParameterName());
1120: assertEquals("lastParamNameMethod5", checkParamDesc
1121: .getPartName());
1122: assertEquals(checkParamDesc, operationDesc
1123: .getParameterDescription(4));
1124: assertEquals(checkParamDesc, operationDesc
1125: .getParameterDescription("lastParamNameMethod5"));
1126: assertEquals(Holder.class, checkParamDesc.getParameterType());
1127: assertEquals(String.class, checkParamDesc
1128: .getParameterActualType());
1129: assertTrue(checkParamDesc.isHolderType());
1130: assertEquals("", checkParamDesc.getTargetNamespace());
1131: assertEquals(WebParam.Mode.OUT, checkParamDesc.getMode());
1132: assertFalse(checkParamDesc.isHeader());
1133:
1134: // method6
1135: operationDesc = testEndpointInterfaceDesc
1136: .getOperationForJavaMethod("method6")[0];
1137: assertNotNull(operationDesc);
1138: paramDesc = operationDesc.getParameterDescriptions();
1139: assertEquals(5, paramDesc.length);
1140:
1141: checkParamDesc = paramDesc[0];
1142: assertNotNull(((ParameterDescriptionJava) checkParamDesc)
1143: .getAnnoWebParam());
1144: assertEquals("param0NameMethod6", checkParamDesc
1145: .getParameterName());
1146: assertEquals("param0PartName", checkParamDesc.getPartName());
1147: assertEquals(checkParamDesc, operationDesc
1148: .getParameterDescription(0));
1149: assertEquals(checkParamDesc, operationDesc
1150: .getParameterDescription("param0NameMethod6"));
1151: assertEquals(String.class, checkParamDesc.getParameterType());
1152: assertEquals("http://param.service.test.target.namespace/",
1153: checkParamDesc.getTargetNamespace());
1154: assertEquals(WebParam.Mode.IN, checkParamDesc.getMode());
1155: assertTrue(checkParamDesc.isHeader());
1156:
1157: checkParamDesc = paramDesc[1];
1158: assertNotNull(((ParameterDescriptionJava) checkParamDesc)
1159: .getAnnoWebParam());
1160: assertEquals("param1NameMethod6", checkParamDesc
1161: .getParameterName());
1162: assertEquals("param1PartName", checkParamDesc.getPartName());
1163: assertEquals(checkParamDesc, operationDesc
1164: .getParameterDescription(1));
1165: assertEquals(checkParamDesc, operationDesc
1166: .getParameterDescription("param1NameMethod6"));
1167: assertEquals(Integer.TYPE, checkParamDesc.getParameterType());
1168: assertEquals("", checkParamDesc.getTargetNamespace());
1169: assertEquals(WebParam.Mode.IN, checkParamDesc.getMode());
1170: assertFalse(checkParamDesc.isHeader());
1171:
1172: checkParamDesc = paramDesc[2];
1173: assertNull(((ParameterDescriptionJava) checkParamDesc)
1174: .getAnnoWebParam());
1175: assertEquals("arg2", checkParamDesc.getParameterName());
1176: assertEquals("arg2", checkParamDesc.getPartName());
1177: assertEquals(checkParamDesc, operationDesc
1178: .getParameterDescription(2));
1179: assertEquals(checkParamDesc, operationDesc
1180: .getParameterDescription("arg2"));
1181: assertEquals(Object.class, checkParamDesc.getParameterType());
1182: assertEquals("", checkParamDesc.getTargetNamespace());
1183: assertEquals(WebParam.Mode.IN, checkParamDesc.getMode());
1184: assertFalse(checkParamDesc.isHeader());
1185:
1186: checkParamDesc = paramDesc[3];
1187: assertNull(((ParameterDescriptionJava) checkParamDesc)
1188: .getAnnoWebParam());
1189: assertEquals("arg3", checkParamDesc.getParameterName());
1190: assertEquals("arg3", checkParamDesc.getPartName());
1191: assertEquals(checkParamDesc, operationDesc
1192: .getParameterDescription(3));
1193: assertEquals(checkParamDesc, operationDesc
1194: .getParameterDescription("arg3"));
1195: assertEquals(Integer.TYPE, checkParamDesc.getParameterType());
1196: assertEquals("", checkParamDesc.getTargetNamespace());
1197: assertEquals(WebParam.Mode.IN, checkParamDesc.getMode());
1198: assertFalse(checkParamDesc.isHeader());
1199:
1200: checkParamDesc = paramDesc[4];
1201: assertNotNull(((ParameterDescriptionJava) checkParamDesc)
1202: .getAnnoWebParam());
1203: assertEquals("lastParamNameMethod6", checkParamDesc
1204: .getParameterName());
1205: assertEquals("lastParamNameMethod6", checkParamDesc
1206: .getPartName());
1207: assertEquals(checkParamDesc, operationDesc
1208: .getParameterDescription(4));
1209: assertEquals(checkParamDesc, operationDesc
1210: .getParameterDescription("lastParamNameMethod6"));
1211: assertEquals(String.class, checkParamDesc.getParameterType());
1212: assertEquals("", checkParamDesc.getTargetNamespace());
1213: assertEquals(WebParam.Mode.IN, checkParamDesc.getMode());
1214: assertFalse(checkParamDesc.isHeader());
1215: }
1216:
1217: public void testWebParamBare() {
1218: EndpointInterfaceDescription testEndpointInterfaceDesc = getEndpointInterfaceDesc(WebParamTestImpl.class);
1219:
1220: // DOCUMENT / LITERAL / BARE methods
1221: OperationDescription[] operationDescs = testEndpointInterfaceDesc
1222: .getOperationForJavaMethod("method0_bare");
1223: assertNull(operationDescs);
1224:
1225: // method00
1226: operationDescs = testEndpointInterfaceDesc
1227: .getOperationForJavaMethod("method00_bare");
1228: assertNull(operationDescs);
1229:
1230: // method1
1231: OperationDescription operationDesc = testEndpointInterfaceDesc
1232: .getOperationForJavaMethod("method1_bare")[0];
1233: assertNotNull(operationDesc);
1234: ParameterDescription[] paramDesc = operationDesc
1235: .getParameterDescriptions();
1236: assertEquals(1, paramDesc.length);
1237: ParameterDescription checkParamDesc = paramDesc[0];
1238: assertNull(((ParameterDescriptionJava) checkParamDesc)
1239: .getAnnoWebParam());
1240: assertEquals("renamedMethod1", checkParamDesc
1241: .getParameterName());
1242: assertEquals("renamedMethod1", checkParamDesc.getPartName());
1243: assertEquals(checkParamDesc, operationDesc
1244: .getParameterDescription(0));
1245: assertEquals(checkParamDesc, operationDesc
1246: .getParameterDescription("renamedMethod1"));
1247: assertEquals(String.class, checkParamDesc.getParameterType());
1248: assertEquals("http://param.service.test.target.namespace/",
1249: checkParamDesc.getTargetNamespace());
1250: assertEquals(WebParam.Mode.IN, checkParamDesc.getMode());
1251: assertFalse(checkParamDesc.isHeader());
1252:
1253: // method2
1254: operationDesc = testEndpointInterfaceDesc
1255: .getOperationForJavaMethod("method2_bare")[0];
1256: assertNotNull(operationDesc);
1257: paramDesc = operationDesc.getParameterDescriptions();
1258: assertEquals(1, paramDesc.length);
1259: checkParamDesc = paramDesc[0];
1260: assertNotNull(((ParameterDescriptionJava) checkParamDesc)
1261: .getAnnoWebParam());
1262: assertEquals("renamedMethod2", checkParamDesc
1263: .getParameterName());
1264: assertEquals("renamedMethod2", checkParamDesc.getPartName());
1265: assertEquals(checkParamDesc, operationDesc
1266: .getParameterDescription(0));
1267: assertEquals(checkParamDesc, operationDesc
1268: .getParameterDescription("renamedMethod2"));
1269: assertEquals(String.class, checkParamDesc.getParameterType());
1270: assertEquals("http://param.service.test.target.namespace/",
1271: checkParamDesc.getTargetNamespace());
1272: assertEquals(WebParam.Mode.IN, checkParamDesc.getMode());
1273: assertFalse(checkParamDesc.isHeader());
1274:
1275: // method3
1276: operationDesc = testEndpointInterfaceDesc
1277: .getOperationForJavaMethod("method3_bare")[0];
1278: assertNotNull(operationDesc);
1279: paramDesc = operationDesc.getParameterDescriptions();
1280: assertEquals(1, paramDesc.length);
1281: checkParamDesc = paramDesc[0];
1282: assertNotNull(((ParameterDescriptionJava) checkParamDesc)
1283: .getAnnoWebParam());
1284: assertEquals("param1NameMethod3", checkParamDesc
1285: .getParameterName());
1286: assertEquals("param1NameMethod3", checkParamDesc.getPartName());
1287: assertEquals(checkParamDesc, operationDesc
1288: .getParameterDescription(0));
1289: assertEquals(checkParamDesc, operationDesc
1290: .getParameterDescription("param1NameMethod3"));
1291: assertEquals(Holder.class, checkParamDesc.getParameterType());
1292: assertEquals(Integer.class, checkParamDesc
1293: .getParameterActualType());
1294: assertTrue(checkParamDesc.isHolderType());
1295: assertEquals("http://param.service.test.target.namespace/",
1296: checkParamDesc.getTargetNamespace());
1297: assertEquals(WebParam.Mode.INOUT, checkParamDesc.getMode());
1298: assertFalse(checkParamDesc.isHeader());
1299:
1300: // method4
1301: operationDesc = testEndpointInterfaceDesc
1302: .getOperationForJavaMethod("method4_bare")[0];
1303: assertNotNull(operationDesc);
1304: paramDesc = operationDesc.getParameterDescriptions();
1305: assertEquals(1, paramDesc.length);
1306:
1307: checkParamDesc = paramDesc[0];
1308: assertNull(((ParameterDescriptionJava) checkParamDesc)
1309: .getAnnoWebParam());
1310: assertEquals("renamedMethod4", checkParamDesc
1311: .getParameterName());
1312: assertEquals("renamedMethod4", checkParamDesc.getPartName());
1313: assertEquals(checkParamDesc, operationDesc
1314: .getParameterDescription(0));
1315: assertEquals(checkParamDesc, operationDesc
1316: .getParameterDescription("renamedMethod4"));
1317: assertEquals(Holder.class, checkParamDesc.getParameterType());
1318: assertEquals(Integer.class, checkParamDesc
1319: .getParameterActualType());
1320: assertEquals("http://param.service.test.target.namespace/",
1321: checkParamDesc.getTargetNamespace());
1322: assertEquals(WebParam.Mode.INOUT, checkParamDesc.getMode());
1323: assertFalse(checkParamDesc.isHeader());
1324:
1325: // method5
1326: operationDesc = testEndpointInterfaceDesc
1327: .getOperationForJavaMethod("method5_bare")[0];
1328: assertNotNull(operationDesc);
1329: paramDesc = operationDesc.getParameterDescriptions();
1330: assertEquals(1, paramDesc.length);
1331:
1332: checkParamDesc = paramDesc[0];
1333: assertNotNull(((ParameterDescriptionJava) checkParamDesc)
1334: .getAnnoWebParam());
1335: assertEquals("lastParamNameMethod5", checkParamDesc
1336: .getParameterName());
1337: assertEquals("lastParamNameMethod5", checkParamDesc
1338: .getPartName());
1339: assertEquals(checkParamDesc, operationDesc
1340: .getParameterDescription(0));
1341: assertEquals(checkParamDesc, operationDesc
1342: .getParameterDescription("lastParamNameMethod5"));
1343: assertEquals(Holder.class, checkParamDesc.getParameterType());
1344: assertEquals(String.class, checkParamDesc
1345: .getParameterActualType());
1346: assertTrue(checkParamDesc.isHolderType());
1347: assertEquals(
1348: "http://method5.bare.result.test.target.namespace.5/",
1349: checkParamDesc.getTargetNamespace());
1350: assertEquals(WebParam.Mode.OUT, checkParamDesc.getMode());
1351: assertFalse(checkParamDesc.isHeader());
1352:
1353: // method6
1354: operationDesc = testEndpointInterfaceDesc
1355: .getOperationForJavaMethod("method6_bare")[0];
1356: assertNotNull(operationDesc);
1357: paramDesc = operationDesc.getParameterDescriptions();
1358: assertEquals(1, paramDesc.length);
1359:
1360: checkParamDesc = paramDesc[0];
1361: assertNotNull(((ParameterDescriptionJava) checkParamDesc)
1362: .getAnnoWebParam());
1363: assertEquals("param0NameMethod6", checkParamDesc
1364: .getParameterName());
1365: assertEquals("param0PartName", checkParamDesc.getPartName());
1366: assertEquals(checkParamDesc, operationDesc
1367: .getParameterDescription(0));
1368: assertEquals(checkParamDesc, operationDesc
1369: .getParameterDescription("param0NameMethod6"));
1370: assertEquals(Holder.class, checkParamDesc.getParameterType());
1371: assertEquals(String.class, checkParamDesc
1372: .getParameterActualType());
1373: assertEquals("http://param.service.test.target.namespace/",
1374: checkParamDesc.getTargetNamespace());
1375: assertEquals(WebParam.Mode.INOUT, checkParamDesc.getMode());
1376: assertTrue(checkParamDesc.isHeader());
1377: }
1378:
1379: /*
1380: * Method to return the endpoint interface description for a given implementation class.
1381: */
1382: private EndpointInterfaceDescription getEndpointInterfaceDesc(
1383: Class implementationClass) {
1384: // Use the description factory directly; this will be done within the JAX-WS runtime
1385: ServiceDescription serviceDesc = DescriptionFactory
1386: .createServiceDescription(implementationClass);
1387: assertNotNull(serviceDesc);
1388:
1389: EndpointDescription[] endpointDesc = serviceDesc
1390: .getEndpointDescriptions();
1391: assertNotNull(endpointDesc);
1392: assertEquals(1, endpointDesc.length);
1393:
1394: // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)? Currently assumes [0]
1395: EndpointDescription testEndpointDesc = endpointDesc[0];
1396: EndpointInterfaceDescription testEndpointInterfaceDesc = testEndpointDesc
1397: .getEndpointInterfaceDescription();
1398: assertNotNull(testEndpointInterfaceDesc);
1399:
1400: return testEndpointInterfaceDesc;
1401: }
1402: }
1403:
1404: // ============================================================================
1405: // SOAPBindingDefaultTest service implementation class
1406: // @SOAPBinding values: style=DOCUMENT, use=LITERAL, paramaterStyle=WRAPPED
1407: // @WebResult values: are all defaulted
1408: // ============================================================================
1409:
1410: @WebService()
1411: class SOAPBindingDefaultTestImpl {
1412: public String echoString(String s) {
1413: return s;
1414: }
1415: }
1416:
1417: // ============================================================================
1418: // SOAPBindingDocLiBareTestImpl service implementation class
1419: // Note that Style should default
1420: // ============================================================================
1421:
1422: @WebService()
1423: @SOAPBinding(use=javax.jws.soap.SOAPBinding.Use.LITERAL,parameterStyle=javax.jws.soap.SOAPBinding.ParameterStyle.BARE)
1424: class SOAPBindingDocLitBareTestImpl {
1425: public String echoString(String s) {
1426: return s;
1427: }
1428: }
1429:
1430: //============================================================================
1431: //SOAPBindingDocEncBareTestImpl service implementation class
1432: //Note that Style should default
1433: //============================================================================
1434:
1435: @WebService()
1436: @SOAPBinding(use=javax.jws.soap.SOAPBinding.Use.ENCODED,parameterStyle=javax.jws.soap.SOAPBinding.ParameterStyle.BARE)
1437: class SOAPBindingDocEncBareTestImpl {
1438: public String echoString(String s) {
1439: return s;
1440: }
1441: }
1442:
1443: // ============================================================================
1444: // SOAPBindingDefaultMethodTest service implementation class
1445: // Note that style will default to DOCUMENT based on Type annotation
1446: // ============================================================================
1447:
1448: @WebService()
1449: class SOAPBindingDefaultMethodTestImpl {
1450: @SOAPBinding(use=javax.jws.soap.SOAPBinding.Use.LITERAL,parameterStyle=javax.jws.soap.SOAPBinding.ParameterStyle.BARE)
1451: public String echoString(String s) {
1452: return s;
1453: }
1454: }
1455:
1456: // =============================================================================
1457: // testDefaultReqRspWrapper service implementation classes
1458: // =============================================================================
1459:
1460: @WebService
1461: //Note the default parameterStyle is WRAPPED, so no type-level annotation is required.
1462: class DefaultReqRspWrapperTestImpl {
1463: public String wrappedParams(String s) {
1464: return s;
1465: }
1466:
1467: @SOAPBinding(parameterStyle=javax.jws.soap.SOAPBinding.ParameterStyle.BARE)
1468: public String bareParams(String s) {
1469: return s;
1470: }
1471: }
1472:
1473: @WebService
1474: @SOAPBinding(parameterStyle=javax.jws.soap.SOAPBinding.ParameterStyle.BARE)
1475: class DefaultReqRspWrapperBareTestImpl {
1476: @SOAPBinding(parameterStyle=javax.jws.soap.SOAPBinding.ParameterStyle.WRAPPED)
1477: public String wrappedParams(String s) {
1478: return s;
1479: }
1480:
1481: public String bareParams(String s) {
1482: return s;
1483: }
1484: }
1485:
1486: // =============================================================================
1487: // testReqRspWrapper service implementation class
1488: // =============================================================================
1489:
1490: @WebService
1491: //Note the default parameterStyle is WRAPPED, so no type-level annotation is required.
1492: class ReqRspWrapperTestImpl {
1493: @RequestWrapper(localName="method1ReqWrapper",targetNamespace="http://a.b.c.method1ReqTNS",className="org.apache.axis2.jaxws.description.AnnotationServiceImplDescriptionTests.ReqRspWrapperTestImpl.method1ReqWrapper")
1494: @ResponseWrapper(localName="method1RspWrapper",targetNamespace="http://a.b.c.method1RspTNS",className="org.apache.axis2.jaxws.description.AnnotationServiceImplDescriptionTests.ReqRspWrapperTestImpl.method1RspWrapper")
1495: public String method1(String s) {
1496: return s;
1497: }
1498:
1499: @RequestWrapper(targetNamespace="http://a.b.c.method2ReqTNS",className="org.apache.axis2.jaxws.description.AnnotationServiceImplDescriptionTests.ReqRspWrapperTestImpl.method2ReqWrapper")
1500: @ResponseWrapper(localName="method2RspWrapper",targetNamespace="http://a.b.c.method2RspTNS")
1501: public String method2(String s) {
1502: return s;
1503: }
1504:
1505: public class method1ReqWrapper {
1506:
1507: }
1508:
1509: public class method2ReqWrapper {
1510:
1511: }
1512:
1513: public class method1RspWrapper {
1514:
1515: }
1516: }
1517:
1518: // =============================================================================
1519: // testWebMethod service implementaiton class
1520: // =============================================================================
1521:
1522: @WebService
1523: class WebMethodTestImpl {
1524: // No web method annotation
1525: public String method1(String s) {
1526: return s;
1527: }
1528:
1529: @WebMethod(operationName="renamedMethod2")
1530: public String method2(String s) {
1531: return s;
1532: }
1533:
1534: @WebMethod(action="ActionMethod3")
1535: public String method3(String s) {
1536: return s;
1537: }
1538:
1539: @WebMethod(operationName="renamedMethod4",action="ActionMethod4")
1540: public String method4(String s) {
1541: return s;
1542: }
1543:
1544: @WebMethod(exclude=true)
1545: public String method5(String s) {
1546: return s;
1547: }
1548: }
1549:
1550: // ===============================================
1551: // Web Result
1552: // ===============================================
1553:
1554: @WebService(targetNamespace="http://service.test.target.namespace/")
1555: // Default SOAPBinding Style=DOCUMENT, Use=LITERAL, ParamStyle=WRAPPED
1556: class WebResultTestImpl {
1557: // DOCUMENT / LITERAL / WRAPPED methods
1558: public String method0(String s) {
1559: return s;
1560: }
1561:
1562: @WebMethod(operationName="renamedMethod1")
1563: public String method1(String s) {
1564: return s;
1565: }
1566:
1567: @WebMethod(operationName="renamedMethod2")
1568: @WebResult()
1569: public String method2(String s) {
1570: return s;
1571: }
1572:
1573: @WebMethod(operationName="renamedMethod3")
1574: @WebResult(name="resultName")
1575: public String method3(String s) {
1576: return s;
1577: }
1578:
1579: @WebMethod(operationName="renamedMethod4")
1580: @WebResult(name="resultName",partName="partName",targetNamespace="http://result.test.target.namespace/")
1581: public String method4(String s) {
1582: return s;
1583: }
1584:
1585: @WebMethod(operationName="renamedMethod5")
1586: @WebResult(name="resultName5",partName="partName5",targetNamespace="http://result.test.target.namespace.5/",header=true)
1587: public String method5(String s) {
1588: return s;
1589: }
1590:
1591: @WebMethod(operationName="renamedMethod6")
1592: @Oneway
1593: public void method6(String s) {
1594: return;
1595: }
1596:
1597: @WebMethod(operationName="renamedMethod7")
1598: @WebResult(name="resultName7",partName="partName7",header=true)
1599: public String method7(String s) {
1600: return s;
1601: }
1602:
1603: // DOCUMENT / LITERAL / BARE methods
1604: @SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.BARE)
1605: public String method0_bare(String s) {
1606: return s;
1607: }
1608:
1609: @WebMethod(operationName="renamedMethod1Bare")
1610: @SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.BARE)
1611: public String method1_bare(String s) {
1612: return s;
1613: }
1614:
1615: @WebMethod(operationName="renamedMethod2Bare")
1616: @SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.BARE)
1617: @WebResult()
1618: public String method2_bare(String s) {
1619: return s;
1620: }
1621:
1622: @WebMethod(operationName="renamedMethod3Bare")
1623: @SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.BARE)
1624: @WebResult(name="resultName")
1625: public String method3_bare(String s) {
1626: return s;
1627: }
1628:
1629: @WebMethod(operationName="renamedMethod4Bare")
1630: @SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.BARE)
1631: @WebResult(name="resultName",partName="partName",targetNamespace="http://result.bare.test.target.namespace/")
1632: public String method4_bare(String s) {
1633: return s;
1634: }
1635:
1636: @WebMethod(operationName="renamedMethod5Bare")
1637: @SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.BARE)
1638: @WebResult(name="resultName5",partName="partName5",targetNamespace="http://result.bare.test.target.namespace.5/",header=true)
1639: public String method5_bare(String s) {
1640: return s;
1641: }
1642:
1643: @WebMethod(operationName="renamedMethod6Bare")
1644: @SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.BARE)
1645: @Oneway
1646: public void method6_bare(String s) {
1647: return;
1648: }
1649:
1650: @WebMethod(operationName="renamedMethod7Bare")
1651: @SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.BARE)
1652: @WebResult(name="resultName7",partName="partName7",header=true)
1653: public String method7_bare(String s) {
1654: return s;
1655: }
1656: }
1657:
1658: // ===============================================
1659: // Web Param test impl
1660: // ===============================================
1661:
1662: @WebService(targetNamespace="http://param.service.test.target.namespace/")
1663: //Default SOAPBinding Style=DOCUMENT, Use=LITERAL, ParamStyle=WRAPPED
1664: class WebParamTestImpl {
1665:
1666: // DOCUMENT / LITERAL / WRAPPED methods
1667: public String method0(String s) {
1668: return s;
1669: }
1670:
1671: public void method00() {
1672: return;
1673: }
1674:
1675: @WebMethod(operationName="renamedMethod1")
1676: public String method1(String s) {
1677: return s;
1678: }
1679:
1680: @WebMethod(operationName="renamedMethod2")
1681: @WebResult()
1682: public String method2(@WebParam()
1683: String s) {
1684: return s;
1685: }
1686:
1687: @WebMethod(operationName="renamedMethod3")
1688: @WebResult(name="resultName")
1689: public String method3(@WebParam(name="param0NameMethod3")
1690: String s, @WebParam(name="param1NameMethod3")
1691: javax.xml.ws.Holder<Integer> holderInteger,
1692: Object objNoWebParamAnno, int intNoWebParamAnno,
1693: @WebParam(name="lastParamNameMethod3")
1694: String last) {
1695: return s;
1696: }
1697:
1698: @WebMethod(operationName="renamedMethod4")
1699: @WebResult(name="resultName",partName="partName",targetNamespace="http://result.test.target.namespace/")
1700: public String method4(
1701: @WebParam(name="param0NameMethod4",partName="param0PartName",targetNamespace="http://param.4.0.result.test.target.namespace/")
1702: String s,
1703: @WebParam(name="param1NameMethod4",partName="param1PartName",targetNamespace="http://param.4.1.result.test.target.namespace/")
1704: int i, Object objNoWebParamAnno,
1705: javax.xml.ws.Holder<Integer> intNoWebParamAnno,
1706: @WebParam(name="lastParamNameMethod4")
1707: String last) {
1708:
1709: return s;
1710: }
1711:
1712: @WebMethod(operationName="renamedMethod5")
1713: @WebResult(name="resultName5",partName="partName5",targetNamespace="http://result.test.target.namespace.5/",header=true)
1714: public String method5(
1715: @WebParam(name="param0NameMethod5",partName="param0PartName",targetNamespace="http://param.5.0.result.test.target.namespace/",header=true)
1716: String s,
1717: @WebParam(name="param1NameMethod5",partName="param1PartName",targetNamespace="http://param.5.1.result.test.target.namespace/",header=false)
1718: int i,
1719: javax.xml.ws.Holder<Object> objNoWebParamAnno,
1720: int intNoWebParamAnno,
1721: @WebParam(name="lastParamNameMethod5",mode=WebParam.Mode.OUT)
1722: javax.xml.ws.Holder<String> last) {
1723: return s;
1724: }
1725:
1726: @WebMethod(operationName="renamedMethod6")
1727: @WebResult(name="resultName5",partName="partName5",header=true)
1728: public String method6(
1729: @WebParam(name="param0NameMethod6",partName="param0PartName",header=true)
1730: String s,
1731: @WebParam(name="param1NameMethod6",partName="param1PartName",header=false)
1732: int i, Object objNoWebParamAnno, int intNoWebParamAnno,
1733: @WebParam(name="lastParamNameMethod6")
1734: String last) {
1735: return s;
1736: }
1737:
1738: // DOCUMENT / LITERAL / BARE methods
1739: @SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.BARE)
1740: public String method0_bare(String s) {
1741: return s;
1742: }
1743:
1744: @SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.BARE)
1745: public void method00_bare() {
1746: return;
1747: }
1748:
1749: @WebMethod(operationName="renamedMethod1")
1750: @SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.BARE)
1751: public String method1_bare(String s) {
1752: return s;
1753: }
1754:
1755: @WebMethod(operationName="renamedMethod2")
1756: @SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.BARE)
1757: @WebResult()
1758: public String method2_bare(@WebParam()
1759: String s) {
1760: return s;
1761: }
1762:
1763: @WebMethod(operationName="renamedMethod3")
1764: @SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.BARE)
1765: @WebResult(name="resultName")
1766: public String method3_bare(@WebParam(name="param1NameMethod3")
1767: javax.xml.ws.Holder<Integer> holderInteger) {
1768: return null;
1769: }
1770:
1771: @WebMethod(operationName="renamedMethod4")
1772: @SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.BARE)
1773: @WebResult(name="resultName",partName="partName",targetNamespace="http://result.test.target.namespace/")
1774: public String method4_bare(
1775: javax.xml.ws.Holder<Integer> intNoWebParamAnno) {
1776:
1777: return null;
1778: }
1779:
1780: @WebMethod(operationName="renamedMethod5")
1781: @SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.BARE)
1782: @WebResult(name="resultName5",partName="partName5",targetNamespace="http://result.test.target.namespace.5/",header=true)
1783: public void method5_bare(
1784: @WebParam(name="lastParamNameMethod5",mode=WebParam.Mode.OUT,targetNamespace="http://method5.bare.result.test.target.namespace.5/")
1785: javax.xml.ws.Holder<String> last) {
1786: return;
1787: }
1788:
1789: @WebMethod(operationName="renamedMethod6")
1790: @SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.BARE)
1791: @WebResult(name="resultName5",partName="partName5",header=true)
1792: public String method6_bare(
1793: @WebParam(name="param0NameMethod6",partName="param0PartName",header=true)
1794: javax.xml.ws.Holder<String> s) {
1795: return null;
1796: }
1797: }
|