Search in sources :

Example 1 with ParameterDescriptionComposite

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

the class OperationDescriptionImplTests method testDetermineOperationQName.

public void testDetermineOperationQName() {
    String wsdlRelativeLocation = "test-resources/wsdl/";
    String wsdlFileName = "BindingNamespaceDefaults.wsdl";
    String targetNamespace = "http://nonanonymous.complextype.test.org";
    String wsdlLocation = wsdlRelativeLocation + wsdlFileName;
    // Build up a DBC, including the WSDL Definition and the annotation information for
    // the impl class.
    DescriptionBuilderComposite dbc = new DescriptionBuilderComposite();
    URL wsdlURL = DescriptionTestUtils.getWSDLURL(wsdlFileName);
    Definition wsdlDefn = DescriptionTestUtils.createWSDLDefinition(wsdlURL);
    assertNotNull(wsdlDefn);
    WebServiceAnnot webServiceAnnot = WebServiceAnnot.createWebServiceAnnotImpl();
    assertNotNull(webServiceAnnot);
    webServiceAnnot.setWsdlLocation(wsdlLocation);
    webServiceAnnot.setTargetNamespace(targetNamespace);
    webServiceAnnot.setServiceName("EchoMessageService");
    webServiceAnnot.setPortName("EchoMessagePort");
    MethodDescriptionComposite mdc = new MethodDescriptionComposite();
    mdc.setMethodName("echoMessage");
    mdc.setReturnType("java.lang.String");
    ParameterDescriptionComposite pdc1 = new ParameterDescriptionComposite();
    pdc1.setParameterType("java.lang.String");
    mdc.addParameterDescriptionComposite(pdc1);
    dbc.addMethodDescriptionComposite(mdc);
    dbc.setWebServiceAnnot(webServiceAnnot);
    dbc.setClassName(BindingNSImpl.class.getName());
    dbc.setWsdlDefinition(wsdlDefn);
    dbc.setwsdlURL(wsdlURL);
    HashMap<String, DescriptionBuilderComposite> dbcMap = new HashMap<String, DescriptionBuilderComposite>();
    dbcMap.put(dbc.getClassName(), dbc);
    List<ServiceDescription> serviceDescList = DescriptionFactory.createServiceDescriptionFromDBCMap(dbcMap);
    ServiceDescription sd = serviceDescList.get(0);
    EndpointInterfaceDescription eid = new EndpointInterfaceDescriptionImpl(dbc, new EndpointDescriptionImpl(null, new QName(targetNamespace, "EchoMessagePort"), (ServiceDescriptionImpl) sd));
    assertEquals(new QName(targetNamespace, "echoMessage"), OperationDescriptionImpl.determineOperationQName(eid, mdc));
}
Also used : HashMap(java.util.HashMap) ServiceDescription(org.apache.axis2.jaxws.description.ServiceDescription) QName(javax.xml.namespace.QName) Definition(javax.wsdl.Definition) MethodDescriptionComposite(org.apache.axis2.jaxws.description.builder.MethodDescriptionComposite) URL(java.net.URL) ParameterDescriptionComposite(org.apache.axis2.jaxws.description.builder.ParameterDescriptionComposite) DescriptionBuilderComposite(org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite) WebServiceAnnot(org.apache.axis2.jaxws.description.builder.WebServiceAnnot) EndpointInterfaceDescription(org.apache.axis2.jaxws.description.EndpointInterfaceDescription)

Example 2 with ParameterDescriptionComposite

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

the class WSDLGeneratorImpl method testPartialWSDL2.

/**
 * Tests the binding, service, and port not specified in the WSDL.
 * <p/>
 * This test is based on the FVT test AddNumbersImplPartial2
 */
public void testPartialWSDL2() {
    String wsdlRelativeLocation = "test-resources/wsdl/";
    String wsdlFileName = "PartialWSDL2.wsdl";
    String targetNamespace = "http://serverPartial1.checkexception.webfault.annotations/";
    String wsdlLocation = wsdlRelativeLocation + wsdlFileName;
    // Build up a DBC, including the WSDL Definition and the annotation information for the impl class.
    DescriptionBuilderComposite dbc = new DescriptionBuilderComposite();
    URL wsdlURL = DescriptionTestUtils.getWSDLURL(wsdlFileName);
    Definition wsdlDefn = DescriptionTestUtils.createWSDLDefinition(wsdlURL);
    assertNotNull(wsdlDefn);
    WebServiceAnnot webServiceAnnot = WebServiceAnnot.createWebServiceAnnotImpl();
    assertNotNull(webServiceAnnot);
    webServiceAnnot.setWsdlLocation(wsdlLocation);
    webServiceAnnot.setTargetNamespace(targetNamespace);
    MethodDescriptionComposite mdc = new MethodDescriptionComposite();
    mdc.setMethodName("addTwoNumbers");
    mdc.setReturnType("int");
    ParameterDescriptionComposite pdc1 = new ParameterDescriptionComposite();
    pdc1.setParameterType("int");
    ParameterDescriptionComposite pdc2 = new ParameterDescriptionComposite();
    pdc1.setParameterType("int");
    mdc.addParameterDescriptionComposite(pdc1);
    mdc.addParameterDescriptionComposite(pdc2);
    dbc.addMethodDescriptionComposite(mdc);
    dbc.setWebServiceAnnot(webServiceAnnot);
    dbc.setClassName(AddNumbersImplPartial1.class.getName());
    dbc.setWsdlDefinition(wsdlDefn);
    dbc.setwsdlURL(wsdlURL);
    dbc.setCustomWsdlGenerator(new WSDLGeneratorImpl(wsdlDefn));
    HashMap<String, DescriptionBuilderComposite> dbcMap = new HashMap<String, DescriptionBuilderComposite>();
    dbcMap.put(AddNumbersImplPartial1.class.getName(), dbc);
    List<ServiceDescription> serviceDescList = DescriptionFactory.createServiceDescriptionFromDBCMap(dbcMap);
    assertEquals(1, serviceDescList.size());
    ServiceDescription sd = serviceDescList.get(0);
    assertNotNull(sd);
    EndpointDescription[] edArray = sd.getEndpointDescriptions();
    assertNotNull(edArray);
    assertEquals(1, edArray.length);
    EndpointDescription ed = edArray[0];
    assertNotNull(ed);
    // Test for presence of generated WSDL
    AxisService as = ed.getAxisService();
    assertNotNull(as);
    Parameter compositeParam = as.getParameter(MDQConstants.WSDL_COMPOSITE);
    assertNotNull(compositeParam);
    assertNotNull(compositeParam.getValue());
    EndpointInterfaceDescription eid = ed.getEndpointInterfaceDescription();
    assertNotNull(eid);
    OperationDescription[] odArray = eid.getOperations();
    assertNotNull(odArray);
    assertEquals(1, odArray.length);
    OperationDescription od = odArray[0];
}
Also used : HashMap(java.util.HashMap) AxisService(org.apache.axis2.description.AxisService) Definition(javax.wsdl.Definition) MethodDescriptionComposite(org.apache.axis2.jaxws.description.builder.MethodDescriptionComposite) EndpointDescription(org.apache.axis2.jaxws.description.EndpointDescription) URL(java.net.URL) ParameterDescriptionComposite(org.apache.axis2.jaxws.description.builder.ParameterDescriptionComposite) DescriptionBuilderComposite(org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite) WebServiceAnnot(org.apache.axis2.jaxws.description.builder.WebServiceAnnot) Parameter(org.apache.axis2.description.Parameter)

Example 3 with ParameterDescriptionComposite

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

the class WSDLGeneratorImpl method testPartialWSDL1.

/**
 * Tests the binding, service, and port not specified in the WSDL.
 * <p/>
 * This test is based on the FVT test AddNumbersImplPartial1
 */
public void testPartialWSDL1() {
    String wsdlRelativeLocation = "test-resources/wsdl/";
    String wsdlFileName = "PartialWSDL1.wsdl";
    String targetNamespace = "http://serverPartial1.checkexception.webfault.annotations/";
    String wsdlLocation = wsdlRelativeLocation + wsdlFileName;
    // Build up a DBC, including the WSDL Definition and the annotation information for the impl class.
    DescriptionBuilderComposite dbc = new DescriptionBuilderComposite();
    URL wsdlURL = DescriptionTestUtils.getWSDLURL(wsdlFileName);
    Definition wsdlDefn = DescriptionTestUtils.createWSDLDefinition(wsdlURL);
    assertNotNull(wsdlDefn);
    WebServiceAnnot webServiceAnnot = WebServiceAnnot.createWebServiceAnnotImpl();
    assertNotNull(webServiceAnnot);
    webServiceAnnot.setWsdlLocation(wsdlLocation);
    webServiceAnnot.setTargetNamespace(targetNamespace);
    MethodDescriptionComposite mdc = new MethodDescriptionComposite();
    mdc.setMethodName("addTwoNumbers");
    mdc.setReturnType("int");
    ParameterDescriptionComposite pdc1 = new ParameterDescriptionComposite();
    pdc1.setParameterType("int");
    ParameterDescriptionComposite pdc2 = new ParameterDescriptionComposite();
    pdc1.setParameterType("int");
    mdc.addParameterDescriptionComposite(pdc1);
    mdc.addParameterDescriptionComposite(pdc2);
    dbc.addMethodDescriptionComposite(mdc);
    dbc.setWebServiceAnnot(webServiceAnnot);
    dbc.setClassName(AddNumbersImplPartial1.class.getName());
    dbc.setWsdlDefinition(wsdlDefn);
    dbc.setwsdlURL(wsdlURL);
    dbc.setCustomWsdlGenerator(new WSDLGeneratorImpl(wsdlDefn));
    HashMap<String, DescriptionBuilderComposite> dbcMap = new HashMap<String, DescriptionBuilderComposite>();
    dbcMap.put(AddNumbersImplPartial1.class.getName(), dbc);
    List<ServiceDescription> serviceDescList = DescriptionFactory.createServiceDescriptionFromDBCMap(dbcMap);
    assertEquals(1, serviceDescList.size());
    ServiceDescription sd = serviceDescList.get(0);
    assertNotNull(sd);
    EndpointDescription[] edArray = sd.getEndpointDescriptions();
    assertNotNull(edArray);
    assertEquals(1, edArray.length);
    EndpointDescription ed = edArray[0];
    assertNotNull(ed);
    // Test for presence of generated WSDL
    AxisService as = ed.getAxisService();
    assertNotNull(as);
    Parameter compositeParam = as.getParameter(MDQConstants.WSDL_COMPOSITE);
    assertNotNull(compositeParam);
    assertNotNull(compositeParam.getValue());
    EndpointInterfaceDescription eid = ed.getEndpointInterfaceDescription();
    assertNotNull(eid);
    OperationDescription[] odArray = eid.getOperations();
    assertNotNull(odArray);
    assertEquals(1, odArray.length);
    OperationDescription od = odArray[0];
}
Also used : HashMap(java.util.HashMap) AxisService(org.apache.axis2.description.AxisService) Definition(javax.wsdl.Definition) MethodDescriptionComposite(org.apache.axis2.jaxws.description.builder.MethodDescriptionComposite) EndpointDescription(org.apache.axis2.jaxws.description.EndpointDescription) URL(java.net.URL) ParameterDescriptionComposite(org.apache.axis2.jaxws.description.builder.ParameterDescriptionComposite) DescriptionBuilderComposite(org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite) WebServiceAnnot(org.apache.axis2.jaxws.description.builder.WebServiceAnnot) Parameter(org.apache.axis2.description.Parameter)

Example 4 with ParameterDescriptionComposite

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

the class ValidateWSDLImpl2 method testValidatePortType.

/**
 * The SEI used by the service impl does not contain all the methods defined on the PortType
 */
public void testValidatePortType() {
    String wsdlRelativeLocation = System.getProperty("basedir", ".") + "/" + "test-resources/wsdl/";
    String wsdlFileName = "ValidateWSDL1.wsdl";
    String targetNamespace = "http://serverPartial1.checkexception.webfault.annotations/";
    String wsdlLocation = wsdlRelativeLocation + wsdlFileName;
    // Build up a DBC, including the WSDL Definition and the annotation information for the impl class.
    DescriptionBuilderComposite dbc = new DescriptionBuilderComposite();
    URL wsdlURL = DescriptionTestUtils.getWSDLURL(wsdlFileName);
    Definition wsdlDefn = DescriptionTestUtils.createWSDLDefinition(wsdlURL);
    assertNotNull(wsdlDefn);
    WebServiceAnnot webServiceAnnot = WebServiceAnnot.createWebServiceAnnotImpl();
    assertNotNull(webServiceAnnot);
    webServiceAnnot.setWsdlLocation(wsdlLocation);
    webServiceAnnot.setTargetNamespace(targetNamespace);
    MethodDescriptionComposite mdc = new MethodDescriptionComposite();
    mdc.setMethodName("addTwoNumbers");
    mdc.setReturnType("int");
    ParameterDescriptionComposite pdc1 = new ParameterDescriptionComposite();
    pdc1.setParameterType("int");
    ParameterDescriptionComposite pdc2 = new ParameterDescriptionComposite();
    pdc1.setParameterType("int");
    mdc.addParameterDescriptionComposite(pdc1);
    mdc.addParameterDescriptionComposite(pdc2);
    dbc.addMethodDescriptionComposite(mdc);
    dbc.setWebServiceAnnot(webServiceAnnot);
    dbc.setClassName(ValidateWSDLImpl1.class.getName());
    dbc.setWsdlDefinition(wsdlDefn);
    dbc.setwsdlURL(wsdlURL);
    HashMap<String, DescriptionBuilderComposite> dbcMap = new HashMap<String, DescriptionBuilderComposite>();
    dbcMap.put(ValidateWSDLImpl1.class.getName(), dbc);
    try {
        List<ServiceDescription> serviceDescList = DescriptionFactory.createServiceDescriptionFromDBCMap(dbcMap);
    // Removing the fail() call here as we removed the Valdiation Error from
    // EndpointInterfaceDescriptionValidator.
    // Expected code path
    } catch (WebServiceException e) {
    // Expected code path
    }
}
Also used : WebServiceException(javax.xml.ws.WebServiceException) HashMap(java.util.HashMap) Definition(javax.wsdl.Definition) MethodDescriptionComposite(org.apache.axis2.jaxws.description.builder.MethodDescriptionComposite) URL(java.net.URL) ParameterDescriptionComposite(org.apache.axis2.jaxws.description.builder.ParameterDescriptionComposite) DescriptionBuilderComposite(org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite) WebServiceAnnot(org.apache.axis2.jaxws.description.builder.WebServiceAnnot)

Example 5 with ParameterDescriptionComposite

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

the class AbstractService method testImplParams.

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

Aggregations

ParameterDescriptionComposite (org.apache.axis2.jaxws.description.builder.ParameterDescriptionComposite)20 MethodDescriptionComposite (org.apache.axis2.jaxws.description.builder.MethodDescriptionComposite)18 DescriptionBuilderComposite (org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite)14 WebServiceAnnot (org.apache.axis2.jaxws.description.builder.WebServiceAnnot)14 HashMap (java.util.HashMap)13 URL (java.net.URL)12 Definition (javax.wsdl.Definition)12 AxisService (org.apache.axis2.description.AxisService)6 WebServiceException (javax.xml.ws.WebServiceException)3 WebParamAnnot (org.apache.axis2.jaxws.description.builder.WebParamAnnot)3 ArrayList (java.util.ArrayList)2 WebParam (javax.jws.WebParam)2 AxisFault (org.apache.axis2.AxisFault)2 ConfigurationContext (org.apache.axis2.context.ConfigurationContext)2 Parameter (org.apache.axis2.description.Parameter)2 EndpointDescription (org.apache.axis2.jaxws.description.EndpointDescription)2 Annotation (java.lang.annotation.Annotation)1 Constructor (java.lang.reflect.Constructor)1 Method (java.lang.reflect.Method)1 Type (java.lang.reflect.Type)1