Listing 1

- <types>
- <schema targetNamespace="java:com.etechsolutions.contact"
xmlns="http://www.w3.org/1999/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:contact="java:com.etechsolutions.contact">
+ <complexType name="ArrayOfContactInfo">
- <complexType name="ContactInfo">
<attribute name="zipCode" type="string" />
<attribute name="clientId" type="int" />
<attribute name="state" type="string" />
<attribute name="city" type="string" />
<attribute name="phone" type="string" />
<attribute name="address" type="string" />
<attribute name="firstName" type="string" />
<attribute name="lastName" type="string" />
<attribute name="companyName" type="string" />
</complexType>
</schema>
</types>

Listing 2

- <message name="getContactRequest">
<part name="arg0" type="math:BigDecimal" />
</message>
- <message name="getContactResponse">
<part name="return" type="contact:ContactInfo" />
</message>
+ <message name="getContactsMatchingRequest">
+ <message name="getContactsMatchingResponse">
<message name="getAllContactsRequest" />
+ <message name="getAllContactsResponse">

Listing 3

- <binding name="ContactListingEJBBinding"
type="tns:ContactListingEJBPortType">
<soap:binding style="rpc" transport=
"http://schemas.xmlsoap.org/soap/http/" />
- <operation name="getContact">
<soap:operation soapAction="urn:getContact" />
- <input>
<soap:body use="encoded" namespace=
"urn:ContactListingEJB" encodingStyle=
"http://schemas.xmlsoap.org/soap/encoding/" />
</input>
- <output>
<soap:body use="encoded" namespace="urn:ContactListingEJB"
encodingStyle="http://schemas.xmlsoap.org/soap/
encoding/" />
</output>
</operation>

Listing 4

// Set up properties for InitialContext
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,
"Weblogic.soap.http.SoapInitialContextFactory");
props.put("Weblogic.soap.wsdl.interface",
ContactListingEJB.class.getName());
if(debug) props.put("Weblogic.soap.verbose",
"true");

// Set up InitialContext and get a handle on
the ContactListingEJB
Context context = new
InitialContext(props);
ContactListingEJB listing =
(ContactListingEJB)context.lookup(endpoint);

// Decide which method to call based upon
command line search term
ContactInfo[] contacts = null;
if((contactName != null) &&
(contactName.length() > 0))
contacts = listing.getContactsMatching(contactName);
else
contacts = listing.getAllContacts();

Additional Source Code Zip file 31.18 KB