Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Industrial strength or suds?

A closer look at SOAP, RPC, and RMI

Return to article


Listing 2. Using SOAP to reserve airline tickets

// Create the parameters
Vector params = new Vector();
params.addElement(new Parameter("flightNumber", Integer.class, flightNumber, null));
params.addElement(new Parameter("numSeats", Integer.class, numSeats, null));
params.addElement(new Parameter("creditCardType", String.class, creditCardType, null));
params.addElement(new Parameter("creditCardNumber", Long.class, creditCardNumber, null));
// Create the Call object
Call call = new Call();
call.setTargetObjectURI("urn:xmltoday-airline-tickets");
call.setMethodName("buyTickets");
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
call.setParams(params);
// Invoke
Response res = call.invoke(new URL("http://rpc.middleearth.com"), "");
// Deal with the response

Return to article