Package ejb.service.addressbook.wsiftypes

Examples of ejb.service.addressbook.wsiftypes.Address


public class Run {
    private static void addFirstAddress(AddressBook addressBook) {
        try {
         
            // create an address object to populate the input
            Address address = new Address();
            address.setStreetNum(25);
            address.setStreetName("Willow Road");
            address.setCity("MyTown");
            address.setState("PA");
            address.setZip(28382);
            Phone phone = new Phone();
            phone.setAreaCode(288);
            phone.setExchange("555");
            phone.setNumber("9891");
            address.setPhoneNumber(phone);

            // do the invocation
            System.out.println("Adding address for John Smith...");
            addressBook.addEntry("John Smith", address);
View Full Code Here


    private static void addSecondAddress(AddressBook addressBook) {
        try {
         
            // create an address object to populate the input
            Address address = new Address();
            address.setStreetNum(20);
            address.setStreetName("Peachtree Avenue");
            address.setCity("Atlanta");
            address.setState("GA");
            address.setZip(39892);
            Phone phone = new Phone();
            phone.setAreaCode(701);
            phone.setExchange("555");
            phone.setNumber("8721");
            address.setPhoneNumber(phone);

            // do the invocation
            System.out.println("Adding address for Jane White...");
            addressBook.addEntry("Jane", "White", address);
View Full Code Here

    private static void queryAddresses(AddressBook addressBook) {
        try {

            // do the invocation
            System.out.println("Querying address for John Smith...");
            Address address = addressBook.getAddressFromName("John Smith");

            System.out.println("Service returned the following address:");
            System.out.println(
                address.getStreetNum()
                    + " "
                    + address.getStreetName()
                    + ", "
                    + address.getCity()
                    + " "
                    + address.getState()
                    + " "
                    + address.getZip()
                    + "; Phone: ("
                    + address.getPhoneNumber().getAreaCode()
                    + ") "
                    + address.getPhoneNumber().getExchange()
                    + "-"
                    + address.getPhoneNumber().getNumber());

            System.out.println("Querying address for Jane White...");
            address = addressBook.getAddressFromName("Jane White");

            System.out.println("Service returned the following address:");
            System.out.println(
                address.getStreetNum()
                    + " "
                    + address.getStreetName()
                    + ", "
                    + address.getCity()
                    + " "
                    + address.getState()
                    + " "
                    + address.getZip()
                    + "; Phone: ("
                    + address.getPhoneNumber().getAreaCode()
                    + ") "
                    + address.getPhoneNumber().getExchange()
                    + "-"
                    + address.getPhoneNumber().getNumber());

        } catch (WSIFException we) {
            System.out.println("Got exception from WSIF, details:");
            we.printStackTrace();
        } catch (RemoteException re) {
View Full Code Here

      // create the input message associated with this operation
      WSIFMessage input = operation.createInputMessage();
      // populate the input message
      input.setObjectPart("name","John Smith");
      // create an address object to populate the input
      Address address = new Address();
      address.setStreetNum(25);
      address.setStreetName("Willow Road");
      address.setCity("MyTown");
      address.setState("PA");
      address.setZip(28382);
      Phone phone = new Phone();
      phone.setAreaCode(288);
      phone.setExchange("555");
      phone.setNumber("9891");
      address.setPhoneNumber(phone);
      input.setObjectPart("address",address);
      // do the invocation
      System.out.println("Adding address for John Smith...");
      operation.executeInputOnlyOperation(input);
  } catch (WSIFException we) {
View Full Code Here

      WSIFMessage input = operation.createInputMessage();
      // populate the input message
      input.setObjectPart("firstName","Jane");
      input.setObjectPart("lastName","White");
      // create an address object to populate the input
      Address address = new Address();
      address.setStreetNum(20);
      address.setStreetName("Peachtree Avenue");
      address.setCity("Atlanta");
      address.setState("GA");
      address.setZip(39892);
      Phone phone = new Phone();
      phone.setAreaCode(701);
      phone.setExchange("555");
      phone.setNumber("8721");
      address.setPhoneNumber(phone);
      input.setObjectPart("address",address);
      // do the invocation
      System.out.println("Adding address for Jane White...");
      operation.executeInputOnlyOperation(input);
  } catch (WSIFException we) {
View Full Code Here

      // do the invocation
      System.out.println("Querying address for John Smith...");
      if (operation.executeRequestResponseOperation(input,output,fault)) {
    // invocation succeeded
    // extract the address from the output message
    Address address = (Address) output.getObjectPart("address");
    System.out.println("Service returned the following address:");
    System.out.println(address.getStreetNum()+" "+address.getStreetName()+
           ", "+address.getCity()+" "+address.getState()+" "+
           address.getZip()+"; Phone: ("+
           address.getPhoneNumber().getAreaCode()+") "+
           address.getPhoneNumber().getExchange()+"-"+
           address.getPhoneNumber().getNumber());
      } else {
    // invocation failed, check fault message
      }
      // create the operation
      operation = port.createOperation("getAddressFromName");
      // create the input message associated with this operation
      input = operation.createInputMessage();
      output = operation.createOutputMessage();
      fault = operation.createFaultMessage();
      // populate the input message
      input.setObjectPart("name","Jane White");
      // do the invocation
      System.out.println("Querying address for Jane White...");
      if (operation.executeRequestResponseOperation(input,output,fault)) {
    // invocation succeeded
    // extract the address from the output message
    Address address = (Address) output.getObjectPart("address");
    System.out.println("Service returned the following address:");
    System.out.println(address.getStreetNum()+" "+address.getStreetName()+
           ", "+address.getCity()+" "+address.getState()+" "+
           address.getZip()+"; Phone: ("+
           address.getPhoneNumber().getAreaCode()+") "+
           address.getPhoneNumber().getExchange()+"-"+
           address.getPhoneNumber().getNumber());
      } else {
    // invocation failed, check fault message
      }
  } catch (WSIFException we) {
      System.out.println("Got exception from WSIF, details:");
View Full Code Here

    }

    private static Address createAndAddAddress(String name,String streetNum, String streetName,
        String city, String state, String zip) throws Exception {
  // create an address
  Address address = new Address();
  address.setStreetNum(new Integer(streetNum).intValue());
  address.setStreetName(streetName);
  address.setCity(city);
  address.setState(state);
  address.setZip(new Integer(zip).intValue());
  address.setPhoneNumber(null);
  // add an entry to the addressbook
  addressBook.addEntry(name,address);
  return address;
    }
View Full Code Here

      String state = reader.readLine();
      System.out.print("Zip: ");
      String zip = reader.readLine();
      System.out.println();
      System.out.println();
      Address address = null;
      // if street is blank, look for name in addressbook service
      // otherwise assume this is a new user and add information to addressbook
      if (streetName==null || streetName.equals("")) {
    System.out.println("Looking up address...");
    address = lookupAddress(name);
    if (address==null) {
        // if address wasn't found, we have a problem
        printError("Address for "+name+" wasn't found");
    }
      } else {
    // create address from provided information and add to address book
    System.out.println("Adding address to records...");
    address = createAndAddAddress(name,streetNum,streetName,city,state,zip);
      }
      // verify that address is correct
      System.out.println();
      System.out.println();
      System.out.println("Verifying validity of address...");
      verifyAddress(address);
      System.out.println();
      System.out.println();
      // check if we offer DSL service in that zip code
      System.out.println("Customer: "+name);
      System.out.println("Address: "+
             address.getStreetNum()
             + " "
             + address.getStreetName()
             + ", "
             + address.getCity()
             + " "
             + address.getState()
             + " "
             + address.getZip());
      System.out.println("Checking service availability...");
      if (serviceIsAvailable(address.getZip()).equals("true")) {
    System.out.println("Yes, we offer service in your area,"+
           "please call 800 555 FST-DSL to order");
      } else {
    System.out.println("No, we do not offer service in your area");
      }
View Full Code Here

TOP

Related Classes of ejb.service.addressbook.wsiftypes.Address

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.