/**
* @param newPerson
*/
public static void Print( Person newPerson )
{
Object o;
if ( newPerson != null )
{
System.out.println( " Name: " + newPerson.getName() );
o = newPerson.getAddress();
if ( o != null)
{
System.out.println( " Addr: " + ( (HomeAddress)newPerson.getAddress() ).getHouseNumber() );
}
else
{
System.out.println( " Addr: is null" );
}
}
}
/**
*
*/
public static void GetAddress()
{
try
{
Address[] listOfAddress;
// Create Proxy Class
SimpleAsmxServiceSoapProxy service = new SimpleAsmxServiceSoapProxy();
listOfAddress = service.getAddressList();
System.out.println( "\nStarting GetAddress()..." );
Print( listOfAddress );
}
catch ( Exception ex )
{
System.err.println(ex);
}
}
/**
*
*/
public static void GetWorkAddress()
{
try
{
HomeAddress[] listOfAddress;
// Create Proxy Class
SimpleAsmxServiceSoapProxy service = new SimpleAsmxServiceSoapProxy();
listOfAddress = service.getHomeAddress();
System.out.println( "\nStarting GetWorkAddress()..." );
Print( listOfAddress );
}
catch ( Exception ex )
{
System.err.println(ex);
}
}
/**
* @param newPerson
*/
public static void Print( Address[] listOfAddress )
{
if (( listOfAddress != null ) && ( listOfAddress.length > 0))
{
for ( int index = 0; index < listOfAddress.length; index++)
{
System.out.println( " House Number: " +
((HomeAddress)listOfAddress[index]).getHouseNumber() );
if ( listOfAddress[index] instanceof WorkAddress )
{
System.out.println( " Phone Number: " +
((WorkAddress)listOfAddress[index]).getPhoneNumber() );
}
}
}
}
}