Example usage for javax.xml.ws Service getPort

List of usage examples for javax.xml.ws Service getPort

Introduction

In this page you can find the example usage for javax.xml.ws Service getPort.

Prototype

public <T> T getPort(Class<T> serviceEndpointInterface) 

Source Link

Document

The getPort method returns a proxy.

Usage

From source file:org.wso2.appserver.integration.tests.javaee.jpa.JpaJaxWsTestCase.java

@Test(groups = "wso2.as", description = "test jpa and jax-ws", enabled = true)
public void testJpaWsGet() throws Exception {

    String serviceName = "CustomersDatabaseServiceService";
    String wsdlUrl = webAppURL + "/" + serviceName + "?wsdl";

    Service customerDataService = Service.create(new URL(wsdlUrl),
            new QName("http://jaxws.jpa.cdi.ee.sample.appserver.wso2.org/", serviceName));

    assertNotNull(customerDataService);/*  w  ww. jav a2s .  c  o m*/

    CustomersDatabase customersDatabase = customerDataService.getPort(CustomersDatabase.class);
    ContactDTO contact = new ContactDTO("Bob", "(012)345-6789", 25, "bob@bob.com", new Date());

    String response = customersDatabase.addContact(contact);
    log.info("Response : " + response);

    assertEquals("Contact was saved successfully.", response,
            "AddContact response doesn't contain the expected success message");

    ContactsDTO contacts = customersDatabase.getContacts();

    ContactDTO contact1 = contacts.getContacts().get(0);
    log.info("Contact details retrieved, name: " + contact1.getName() + ", email: " + contact1.getEmail());

    assertEquals(contact.getName(), contact1.getName(), "Contact name doesn't match");
}