Implementing UDDI's Find Qualifiers
Each of UDDI's Find Qualifiers is a separate findQualifier tag, all of which are bundled together in a findQualifiers parent tag. Here's the complete FindQualifiers structure extracted from Listing 3:
<findQualifiers>
<findQualifier>exactNameMatch</findQualifier>
<findQualifier>caseSensitiveMatch</findQualifier>
<findQualifier>sortByNameAsc</findQualifier>
<findQualifier>sortByNameDsc</findQualifier>
<findQualifier>andAllKeys</findQualifier>
<findQualifier>sortByDateAsc</findQualifier>
<findQualifier>sortByDateDsc</findQualifier>
</findQualifiers>
Listing 1 shows the inner class FindQualifiers containing seven static integer variables, one against each qualifier. This class also has an Element named findQualifier. The AddQualifier() method takes an integer as an argument and adds a new Element to the parent findQualifier. By calling this method with different integer values, you set these qualifiers inside the main findQualifier Element. Each integer value corresponds to a different qualifier. The GetFindQualifiers() method returns the complete constructed and populated FindQualifiers element.
Contacting the UDDI Registry
The find_Business XML structure is passed to the findBusiness() method of the UddiClient class along with a UDDI URL and a port number, which are hard-coded in the sample code. I tested this implementation against IBM's UDDI registry, which is why its address is used as a hard-coded value. Because the UddiClient is reusable, this hard coding is done only at the GUI level.
| |
 |
Figure 2. Here's the sequence of events followed when you invoke UDDI's find_business method.
|
The SoapTransport class (Listing 7) sends the XML structure to the specified URL and receives its response. Internally, this class uses the SoapCall and HttpConnection classes (both in Listing 8). The SetBody() method of SoapTransport sets the given XML inside the SoapCall. The send(,) method of this class sends the complete SOAP message to its destination. The SoapCall class is a small footprint implementation of SOAP. It builds the SOAP ENVELOPE and BODY tags.
The FindBusiness() method of the UDDIClient class handles all functionality required by the corresponding method of UDDI's Inquiry API internally. It hides all the SOAP and HTTP details from the user. The FindBusiness() method returns a BusinessList class object instance (see Listing 2). The returned BusinessList object returned contains all the information that the UDDI registry sends back in response to findBusiness call.