Search in sources :

Example 1 with DescriptionBuilderComposite

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

the class ClientDBCSupportEndpointEchoServiceImplWithSEI method testCreateDispatch.

/**
 * Composite can not be specified with a CREATE_DISPATCH
 */
public void testCreateDispatch() {
    QName serviceQName = new QName(namespaceURI, svcLocalPart);
    ServiceDescription svcDesc = DescriptionFactory.createServiceDescription(null, serviceQName, ClientDBCSupportEndpointServiceSubclass.class);
    assertNotNull(svcDesc);
    ServiceDescriptionImpl svcDescImpl = (ServiceDescriptionImpl) svcDesc;
    DescriptionBuilderComposite svcDescComposite = svcDescImpl.getDescriptionBuilderComposite();
    assertNotNull(svcDescComposite);
    Class testServiceClass = svcDescComposite.getCorrespondingClass();
    assertNotNull(testServiceClass);
    assertEquals(ClientDBCSupportEndpointServiceSubclass.class, testServiceClass);
    // Now update with an SEI
    QName portQName = new QName(namespaceURI, portLocalPart);
    DescriptionBuilderComposite setEpDescComposite = new DescriptionBuilderComposite();
    Object compositeKey = "Key1";
    try {
        EndpointDescription epDesc = DescriptionFactory.updateEndpoint(svcDesc, null, /* SEI can't be specified */
        portQName, DescriptionFactory.UpdateType.CREATE_DISPATCH, setEpDescComposite, compositeKey);
        fail("Should have caught an exception");
    } catch (WebServiceException e) {
        // Expected path
        String msg = Messages.getMessage("serviceDescErr6");
        assertTrue(e.toString().contains(msg));
    }
}
Also used : DescriptionBuilderComposite(org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite) WebServiceException(javax.xml.ws.WebServiceException) QName(javax.xml.namespace.QName) ServiceDescription(org.apache.axis2.jaxws.description.ServiceDescription) EndpointDescription(org.apache.axis2.jaxws.description.EndpointDescription)

Example 2 with DescriptionBuilderComposite

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

the class ClientDBCSupportEndpointEchoServiceImplWithSEI method testPreDBCFunctionality.

/**
 * Verify that the code that doesn't use a composite continues to work correctly.
 */
public void testPreDBCFunctionality() {
    QName serviceQName = new QName(namespaceURI, svcLocalPart);
    ServiceDescription svcDesc = DescriptionFactory.createServiceDescription(null, serviceQName, ClientDBCSupportEndpointServiceSubclass.class);
    assertNotNull(svcDesc);
    ServiceDescriptionImpl svcDescImpl = (ServiceDescriptionImpl) svcDesc;
    DescriptionBuilderComposite svcDescComposite = svcDescImpl.getDescriptionBuilderComposite();
    assertNotNull(svcDescComposite);
    Class testServiceClass = svcDescComposite.getCorrespondingClass();
    assertNotNull(testServiceClass);
    assertEquals(ClientDBCSupportEndpointServiceSubclass.class, testServiceClass);
    // Now update with an SEI
    QName portQName = new QName(namespaceURI, portLocalPart);
    EndpointDescription epDesc = DescriptionFactory.updateEndpoint(svcDesc, ClientDBCSupportEndpointSEI.class, portQName, DescriptionFactory.UpdateType.GET_PORT);
    assertNotNull(epDesc);
    EndpointDescriptionImpl epDescImpl = (EndpointDescriptionImpl) epDesc;
    DescriptionBuilderComposite epDescComposite = epDescImpl.getDescriptionBuilderComposite();
    Class seiClass = epDescComposite.getCorrespondingClass();
    assertEquals(ClientDBCSupportEndpointSEI.class, seiClass);
    // Make sure we didn't overwrite the class in the ServiceDesc composite
    assertEquals(ClientDBCSupportEndpointServiceSubclass.class, svcDescComposite.getCorrespondingClass());
}
Also used : DescriptionBuilderComposite(org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite) QName(javax.xml.namespace.QName) ServiceDescription(org.apache.axis2.jaxws.description.ServiceDescription) EndpointDescription(org.apache.axis2.jaxws.description.EndpointDescription)

Example 3 with DescriptionBuilderComposite

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

the class ClientDBCSupportEndpointEchoServiceImplWithSEI method testSimpleComposite.

/**
 * Verify that the code that uses a simple empty sparse composite to create an endpoint.
 */
public void testSimpleComposite() {
    QName serviceQName = new QName(namespaceURI, svcLocalPart);
    ServiceDescription svcDesc = DescriptionFactory.createServiceDescription(null, serviceQName, ClientDBCSupportEndpointServiceSubclass.class);
    assertNotNull(svcDesc);
    ServiceDescriptionImpl svcDescImpl = (ServiceDescriptionImpl) svcDesc;
    DescriptionBuilderComposite svcDescComposite = svcDescImpl.getDescriptionBuilderComposite();
    assertNotNull(svcDescComposite);
    Class testServiceClass = svcDescComposite.getCorrespondingClass();
    assertNotNull(testServiceClass);
    assertEquals(ClientDBCSupportEndpointServiceSubclass.class, testServiceClass);
    // Now update with an SEI
    QName portQName = new QName(namespaceURI, portLocalPart);
    DescriptionBuilderComposite setEpDescComposite = new DescriptionBuilderComposite();
    Object compositeKey = "Key1";
    EndpointDescription epDesc = DescriptionFactory.updateEndpoint(svcDesc, ClientDBCSupportEndpointSEI.class, portQName, DescriptionFactory.UpdateType.GET_PORT, setEpDescComposite, compositeKey);
    assertNotNull(epDesc);
    EndpointDescriptionImpl epDescImpl = (EndpointDescriptionImpl) epDesc;
    DescriptionBuilderComposite epDescComposite = epDescImpl.getDescriptionBuilderComposite();
    // The sparse composite should NOT be equal to the composite in the EndpointDescription
    // The sparse composite SHOULD be equal to the sparse composite contained in the EndpointDescription
    assertNotSame(setEpDescComposite, epDescComposite);
    assertEquals(setEpDescComposite, epDescComposite.getSparseComposite(compositeKey));
    Class seiClass = epDescComposite.getCorrespondingClass();
    assertEquals(ClientDBCSupportEndpointSEI.class, seiClass);
    // Make sure we didn't overwrite the class in the ServiceDesc composite
    assertEquals(ClientDBCSupportEndpointServiceSubclass.class, svcDescComposite.getCorrespondingClass());
}
Also used : DescriptionBuilderComposite(org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite) QName(javax.xml.namespace.QName) ServiceDescription(org.apache.axis2.jaxws.description.ServiceDescription) EndpointDescription(org.apache.axis2.jaxws.description.EndpointDescription)

Example 4 with DescriptionBuilderComposite

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

the class ClientDBCSupportEndpointEchoServiceImplWithSEI method testMultipleGetPort.

/**
 * Do multiple GET_PORT on the same service.  This should share the same EndpointDescription
 * but the sparse composite specified on GET_PORT should be unique to each key.
 */
public void testMultipleGetPort() {
    QName serviceQName = new QName(namespaceURI, svcLocalPart);
    ServiceDescription svcDesc = DescriptionFactory.createServiceDescription(getWsdlURL(), serviceQName, Service.class);
    QName portQName = new QName(namespaceURI, portLocalPart);
    // Do the first GetPort using sd1 as a key for the sparse composite
    DescriptionBuilderComposite sd1Composite = new DescriptionBuilderComposite();
    Object sd1 = "SD1";
    EndpointDescription epDescForGetPort1 = DescriptionFactory.updateEndpoint(svcDesc, ClientDBCSupportEndpointSEI.class, portQName, DescriptionFactory.UpdateType.GET_PORT, sd1Composite, sd1);
    assertNotNull(epDescForGetPort1);
    EndpointDescriptionImpl epDescImpl1 = (EndpointDescriptionImpl) epDescForGetPort1;
    assertEquals(sd1Composite, epDescImpl1.getDescriptionBuilderComposite().getSparseComposite(sd1));
    // Do the second GetPort using sd2 as a key for the sparse composite
    DescriptionBuilderComposite sd2Composite = new DescriptionBuilderComposite();
    Object sd2 = "SD2";
    EndpointDescription epDescForGetPort2 = DescriptionFactory.updateEndpoint(svcDesc, ClientDBCSupportEndpointSEI.class, portQName, DescriptionFactory.UpdateType.GET_PORT, sd2Composite, sd2);
    assertNotNull(epDescForGetPort2);
    assertEquals(epDescForGetPort1, epDescForGetPort2);
    EndpointDescriptionImpl epDescImpl2 = (EndpointDescriptionImpl) epDescForGetPort2;
    assertNotSame(sd1Composite, sd2Composite);
    assertEquals(sd2Composite, epDescImpl2.getDescriptionBuilderComposite().getSparseComposite(sd2));
    assertEquals(sd1Composite, epDescImpl1.getDescriptionBuilderComposite().getSparseComposite(sd1));
}
Also used : DescriptionBuilderComposite(org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite) QName(javax.xml.namespace.QName) ServiceDescription(org.apache.axis2.jaxws.description.ServiceDescription) EndpointDescription(org.apache.axis2.jaxws.description.EndpointDescription)

Example 5 with DescriptionBuilderComposite

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

the class ClientDBCSupportEndpointEchoServiceImplWithSEI method testAddPort.

/**
 * A composite can not be specified when doing an AddPort
 */
public void testAddPort() {
    QName serviceQName = new QName(namespaceURI, svcLocalPart);
    ServiceDescription svcDesc = DescriptionFactory.createServiceDescription(null, serviceQName, ClientDBCSupportEndpointServiceSubclass.class);
    assertNotNull(svcDesc);
    ServiceDescriptionImpl svcDescImpl = (ServiceDescriptionImpl) svcDesc;
    DescriptionBuilderComposite svcDescComposite = svcDescImpl.getDescriptionBuilderComposite();
    assertNotNull(svcDescComposite);
    Class testServiceClass = svcDescComposite.getCorrespondingClass();
    assertNotNull(testServiceClass);
    assertEquals(ClientDBCSupportEndpointServiceSubclass.class, testServiceClass);
    // Now update with an SEI
    QName portQName = new QName(namespaceURI, portLocalPart);
    DescriptionBuilderComposite setEpDescComposite = new DescriptionBuilderComposite();
    Object compositeKey = "Key1";
    try {
        EndpointDescription epDesc = DescriptionFactory.updateEndpoint(svcDesc, ClientDBCSupportEndpointSEI.class, portQName, DescriptionFactory.UpdateType.ADD_PORT, setEpDescComposite, compositeKey);
        fail("Should have caught an exception");
    } catch (WebServiceException e) {
    // Expected path
    }
}
Also used : DescriptionBuilderComposite(org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite) WebServiceException(javax.xml.ws.WebServiceException) QName(javax.xml.namespace.QName) ServiceDescription(org.apache.axis2.jaxws.description.ServiceDescription) EndpointDescription(org.apache.axis2.jaxws.description.EndpointDescription)

Aggregations

DescriptionBuilderComposite (org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite)143 QName (javax.xml.namespace.QName)88 Service (javax.xml.ws.Service)68 ServiceDescription (org.apache.axis2.jaxws.description.ServiceDescription)64 URL (java.net.URL)58 HashMap (java.util.HashMap)47 WebService (javax.jws.WebService)42 MethodDescriptionComposite (org.apache.axis2.jaxws.description.builder.MethodDescriptionComposite)33 ArrayList (java.util.ArrayList)30 EndpointDescription (org.apache.axis2.jaxws.description.EndpointDescription)30 Annotation (java.lang.annotation.Annotation)22 List (java.util.List)20 WebServiceClient (javax.xml.ws.WebServiceClient)20 WebServiceAnnot (org.apache.axis2.jaxws.description.builder.WebServiceAnnot)20 JavaClassToDBCConverter (org.apache.axis2.jaxws.description.builder.converter.JavaClassToDBCConverter)18 Definition (javax.wsdl.Definition)15 HandlerChainsType (org.apache.axis2.jaxws.description.xml.handler.HandlerChainsType)15 ParameterDescriptionComposite (org.apache.axis2.jaxws.description.builder.ParameterDescriptionComposite)14 WebServiceException (javax.xml.ws.WebServiceException)13 SOAPBinding (org.apache.axis2.jaxws.binding.SOAPBinding)13