}
private static void queryAddresses(WSIFPort port) {
try {
// create the operation
WSIFOperation operation =
port.createOperation("getAddressFromName");
// create the input message associated with this operation
WSIFMessage input = operation.createInputMessage();
WSIFMessage output = operation.createOutputMessage();
WSIFMessage fault = operation.createFaultMessage();
// populate the input message
input.setObjectPart("name", "John Smith");
// 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(