Search in sources :

Example 1 with WebParamAnnot

use of org.apache.axis2.jaxws.description.builder.WebParamAnnot in project axis-axis2-java-core by apache.

the class JavaParamToPDCConverter method attachWebParamAnnotation.

/**
 * This method will attach @WebParam annotation data to the <code> ParameterDescriptionComposite</code>
 * if the annotation was found on the parameter represented by this index in the parameter list.
 *
 * @param pdc   - <code>ParameterDescriptionComposite</code>
 * @param order - the current index in the parameter list
 */
private void attachWebParamAnnotation(ParameterDescriptionComposite pdc, int order) {
    Annotation[] orderAnnots = paramAnnotations[order];
    for (Annotation annot : orderAnnots) {
        if (annot instanceof WebParam) {
            WebParam webParam = (WebParam) annot;
            WebParamAnnot wpAnnot = WebParamAnnot.createWebParamAnnotImpl();
            wpAnnot.setHeader(webParam.header());
            wpAnnot.setMode(webParam.mode());
            wpAnnot.setName(webParam.name());
            wpAnnot.setPartName(webParam.partName());
            wpAnnot.setTargetNamespace(webParam.targetNamespace());
            pdc.setWebParamAnnot(wpAnnot);
        }
    }
}
Also used : WebParam(javax.jws.WebParam) WebParamAnnot(org.apache.axis2.jaxws.description.builder.WebParamAnnot) Annotation(java.lang.annotation.Annotation)

Example 2 with WebParamAnnot

use of org.apache.axis2.jaxws.description.builder.WebParamAnnot in project axis-axis2-java-core by apache.

the class AnnotationServiceImplWithDBCTests method buildDBCNoEndpointInterface.

// TODO: Basic Test with EndpointInterface set to something valid, so another DBC must
// exist in list
// TODO: Basic Test for Provider
// TODO: Validation Tests
// - Setting WS and WSP
// - Fail just one in List, But allow successful ones to pass
/*
    * Method to return the endpoint interface description for a given implementation class.
    */
// private EndpointInterfaceDescription getEndpointInterfaceDesc(Class implementationClass) {
// // Use the description factory directly; this will be done within the JAX-WS runtime
// return (new EndpointInterfaceDescription());
// //return testEndpointInterfaceDesc;
// }
public static DescriptionBuilderComposite buildDBCNoEndpointInterface() {
    // Create a WebServiceAnnot
    String WSName = "EchoServiceAnnotated";
    String WSTargetNamespace = "http://description.jaxws.axis2.apache.org/";
    String WSServiceName = "EchoServiceName";
    // String WSWsdlLocation = "http://EchoService/wsdl";
    String WSWsdlLocation = "";
    String WSEndpointInterface = "";
    String WSPortName = "EchoServiceAnnotatedPort";
    WebServiceAnnot webServiceAnnot = WebServiceAnnot.createWebServiceAnnotImpl(WSName, WSTargetNamespace, WSServiceName, WSWsdlLocation, WSEndpointInterface, WSPortName);
    // Create a WebMethodAnnot
    String operationName = "echoStringMethod";
    String action = "urn:EchoStringMethod";
    boolean exclude = false;
    WebMethodAnnot webMethodAnnot = WebMethodAnnot.createWebMethodAnnotImpl();
    webMethodAnnot.setOperationName(operationName);
    webMethodAnnot.setAction(action);
    webMethodAnnot.setExclude(exclude);
    // Create the WebParamAnnot
    String WPName = "arg0";
    String WPPartName = "sku";
    String WPTargetNamespace = "http://description.jaxws.axis2.apache.org/";
    WebParam.Mode WPMode = WebParam.Mode.IN;
    boolean WPHeader = true;
    WebParamAnnot webParamAnnot = WebParamAnnot.createWebParamAnnotImpl();
    webParamAnnot.setName(WPName);
    webParamAnnot.setPartName(WPPartName);
    webParamAnnot.setMode(WPMode);
    webParamAnnot.setTargetNamespace(WPTargetNamespace);
    webParamAnnot.setHeader(WPHeader);
    // Build up the the DBC and all necessary composites
    ParameterDescriptionComposite pdc = new ParameterDescriptionComposite();
    pdc.setParameterType("java.lang.String");
    pdc.setWebParamAnnot(webParamAnnot);
    MethodDescriptionComposite mdc = new MethodDescriptionComposite();
    mdc.setWebMethodAnnot(webMethodAnnot);
    mdc.setMethodName(operationName);
    mdc.addParameterDescriptionComposite(pdc, 0);
    DescriptionBuilderComposite dbc = new DescriptionBuilderComposite();
    dbc.setClassName("org.apache.axis2.samples.EchoServiceAnnotated");
    dbc.setWebServiceAnnot(webServiceAnnot);
    dbc.addMethodDescriptionComposite(mdc);
    return dbc;
}
Also used : WebParam(javax.jws.WebParam) ParameterDescriptionComposite(org.apache.axis2.jaxws.description.builder.ParameterDescriptionComposite) WebMethodAnnot(org.apache.axis2.jaxws.description.builder.WebMethodAnnot) DescriptionBuilderComposite(org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite) WebServiceAnnot(org.apache.axis2.jaxws.description.builder.WebServiceAnnot) WebParamAnnot(org.apache.axis2.jaxws.description.builder.WebParamAnnot) MethodDescriptionComposite(org.apache.axis2.jaxws.description.builder.MethodDescriptionComposite)

Example 3 with WebParamAnnot

use of org.apache.axis2.jaxws.description.builder.WebParamAnnot in project axis-axis2-java-core by apache.

the class AbstractService method testSEIParams.

public static void testSEIParams() {
    assertNotNull(seiDBC);
    List<MethodDescriptionComposite> mdcList = sortList(seiDBC.getMethodDescriptionsList());
    assertNotNull(mdcList);
    assertEquals(mdcList.size(), 2);
    MethodDescriptionComposite mdc = mdcList.get(0);
    assertNotNull(mdc);
    List<ParameterDescriptionComposite> pdcList = mdc.getParameterDescriptionCompositeList();
    assertNotNull(pdcList);
    assertEquals(pdcList.size(), 1);
    ParameterDescriptionComposite pdc = pdcList.get(0);
    assertNotNull(pdc);
    assertEquals("java.util.List<java.lang.String>", pdc.getParameterType());
    WebParamAnnot wpAnnot = pdc.getWebParamAnnot();
    assertNotNull(wpAnnot);
    assertEquals("echoString", wpAnnot.name());
    mdc = mdcList.get(1);
    assertNotNull(mdc);
    pdcList = mdc.getParameterDescriptionCompositeList();
    assertNotNull(pdcList);
    assertEquals(pdcList.size(), 2);
    pdc = pdcList.get(0);
    assertNotNull(pdc);
    assertEquals("int", pdc.getParameterType());
    assertNull(pdc.getWebParamAnnot());
    pdc = pdcList.get(1);
    assertNotNull(pdc);
    assertEquals("int", pdc.getParameterType());
    assertNull(pdc.getWebParamAnnot());
}
Also used : ParameterDescriptionComposite(org.apache.axis2.jaxws.description.builder.ParameterDescriptionComposite) WebParamAnnot(org.apache.axis2.jaxws.description.builder.WebParamAnnot) MethodDescriptionComposite(org.apache.axis2.jaxws.description.builder.MethodDescriptionComposite)

Aggregations

WebParamAnnot (org.apache.axis2.jaxws.description.builder.WebParamAnnot)3 WebParam (javax.jws.WebParam)2 MethodDescriptionComposite (org.apache.axis2.jaxws.description.builder.MethodDescriptionComposite)2 ParameterDescriptionComposite (org.apache.axis2.jaxws.description.builder.ParameterDescriptionComposite)2 Annotation (java.lang.annotation.Annotation)1 DescriptionBuilderComposite (org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite)1 WebMethodAnnot (org.apache.axis2.jaxws.description.builder.WebMethodAnnot)1 WebServiceAnnot (org.apache.axis2.jaxws.description.builder.WebServiceAnnot)1