Example usage for javax.xml.ws Service create

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

Introduction

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

Prototype

public static Service create(QName serviceName, WebServiceFeature... features) 

Source Link

Document

Creates a Service instance.

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  .j a  v a2s  . c om*/

    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");
}