⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jaxr3.html

📁 j2eePDF格式的电子书
💻 HTML
📖 第 1 页 / 共 5 页
字号:
&#160;</div><a name="wp83566"> </a><div class="pCellBody">Specifies the password for the proxy host for HTTP proxy authentication, if one is required</div></td>    <td><a name="wp82485"> </a><div class="pCellBody">String</div></td>    <td><a name="wp82487"> </a><div class="pCellBody">None</div></td></tr>  <tr align="left">    <td><a name="wp88898"> </a><div class="pCellBody"><code class="cCode">com.sun.xml.registry.useCache</code></div><a name="wp88899"> </a><div class="pCellBody">&#160;</div><a name="wp88904"> </a><div class="pCellBody">Tells the JAXR implementation to look for registry objects in the cache first and then to look in the registry if not found</div></td>    <td><a name="wp88892"> </a><div class="pCellBody">Boolean, passed in as String</div></td>    <td><a name="wp88881"> </a><div class="pCellBody">True</div></td></tr></table></div><p class="pBody"></p><a name="wp84464"> </a><p class="pBody">You can set these properties as follows: </p><div class="pSmartList1"><ul class="pSmartList1"><a name="wp84466"> </a><div class="pSmartList1"><li>Most of these properties must be set in a JAXR client program. For example: </li></div><a name="wp84468"> </a><p class="pBodyRelative"><code class="cCode">Properties props = new Properties();<br />props.setProperty(&quot;javax.xml.registry.queryManagerURL&quot;,<br />&nbsp;&nbsp;&quot;http://uddi.ibm.com/testregistry/inquiryapi&quot;);<br />props.setProperty(&quot;javax.xml.registry.lifeCycleManagerURL&quot;,<br />&nbsp;&nbsp;&quot;https://uddi.ibm.com/testregistry/publishapi&quot;);<br />ConnectionFactory factory = (ConnectionFactory) <br />&nbsp;&nbsp;context.lookup(&quot;java:comp/env/eis/JAXR&quot;);<br />factory.setProperties(props);<br />connection = factory.createConnection();</code></p><a name="wp84477"> </a><div class="pSmartList1"><li>The <code class="cCode">postalAddressScheme</code> and <code class="cCode">useCache</code> properties may be set in a <code class="cCode">&lt;sysproperty&gt;</code> tag in a <code class="cCode">build.xml</code> file for the <code class="cCode">asant</code> tool. For example: </li></div><a name="wp84479"> </a><p class="pBodyRelative"><code class="cCode">&lt;sysproperty key=&quot;useCache&quot; value=&quot;true&quot;/&gt;</code></p><a name="wp84844"> </a><p class="pBodyRelative">These properties may also be set with the <code class="cCode">-D</code> option on the <code class="cCode">java</code> command line.</p></ul></div><a name="wp87438"> </a><p class="pBody">An additional system property specific to the implementation of JAXR in the J2EE Application Server is <code class="cCode">com.sun.xml.registry.userTaxonomyFilenames</code>. For details on using this property, see <a  href="JAXR3.html#wp85269">Defining a Taxonomy</a>.</p><a name="wp84847"> </a><h4 class="pHeading3">Obtaining and Using a RegistryService Object</h4><a name="wp64113"> </a><p class="pBody">After creating the connection, the client uses the connection to obtain a <code class="cCode">RegistryService</code> object and then the interface or interfaces it will use:</p><div class="pPreformattedRelative"><pre class="pPreformattedRelative">RegistryService rs = connection.getRegistryService();BusinessQueryManager bqm = rs.getBusinessQueryManager();BusinessLifeCycleManager blcm = &nbsp;&nbsp;rs.getBusinessLifeCycleManager();<a name="wp65777"> </a></pre></div><a name="wp65775"> </a><p class="pBody">Typically, a client obtains both a <code class="cCode">BusinessQueryManager</code> object and a <code class="cCode">BusinessLifeCycleManager</code> object from the <code class="cCode">RegistryService</code> object. If it is using the registry for simple queries only, it may need to obtain only a <code class="cCode">BusinessQueryManager</code> object.</p><a name="wp65842"> </a><h3 class="pHeading2">Querying a Registry</h3><a name="wp65843"> </a><p class="pBody">The simplest way for a client to use a registry is to query it for information about the organizations that have submitted data to it. The <code class="cCode">BusinessQueryManager</code> interface supports a number of find methods that allow clients to search for data using the JAXR information model. Many of these methods return a <code class="cCode">BulkResponse</code> (a collection of objects) that meets a set of criteria specified in the method arguments. The most useful of these methods are:</p><div class="pSmartList1"><ul class="pSmartList1"><a name="wp65984"> </a><div class="pSmartList1"><li><code class="cCode">findOrganizations</code>, which returns a list of organizations that meet the specified criteria--often a name pattern or a classification within a classification scheme</li></div><a name="wp65973"> </a><div class="pSmartList1"><li><code class="cCode">findServices</code>, which returns a set of services offered by a specified organization</li></div><a name="wp65997"> </a><div class="pSmartList1"><li><code class="cCode">findServiceBindings</code>, which returns the service bindings (information about how to access the service) that are supported by a specified service</li></div></ul></div><a name="wp78481"> </a><p class="pBody">The <code class="cCode">JAXRQuery</code> program illustrates how to query a registry by organization name and display the data returned. The <code class="cCode">JAXRQueryByNAICSClassification</code> and <code class="cCode">JAXRQueryByWSDLClassification</code> programs illustrate how to query a registry using classifications. All JAXR providers support at least the following taxonomies for classifications:</p><div class="pSmartList1"><ul class="pSmartList1"><a name="wp79259"> </a><div class="pSmartList1"><li>The North American Industry Classification System (NAICS). See <code class="cCode"><a  href="http://www.census.gov/epcd/www/naics.html" target="_blank">http://www.census.gov/epcd/www/naics.html</a></code> for details.</li></div><a name="wp79274"> </a><div class="pSmartList1"><li>The Universal Standard Products and Services Classification (UNSPSC). See<code class="cCode"><a  href="http://www.eccma.org/unspsc/" target="_blank"> http://www.eccma.org/unspsc/</a></code> for details.</li></div><a name="wp79267"> </a><div class="pSmartList1"><li>The ISO 3166 country codes classification system maintained by the International Organization for Standardization (ISO). See <code class="cCode"><a  href="http://www.iso.org/iso/en/prods-services/iso3166ma/index.html" target="_blank">http://www.iso.org/iso/en/prods-services/iso3166ma/index.html</a></code> for details.</li></div></ul></div><a name="wp78482"> </a><p class="pBody">The following sections describe how to perform some common queries:</p><div class="pSmartList1"><ul class="pSmartList1"><a name="wp115425"> </a><div class="pSmartList1"><li><a  href="JAXR3.html#wp65844">Finding Organizations by Name</a></li></div><a name="wp115434"> </a><div class="pSmartList1"><li><a  href="JAXR3.html#wp66170">Finding Organizations by Classification</a></li></div><a name="wp115439"> </a><div class="pSmartList1"><li><a  href="JAXR3.html#wp76394">Finding Services and ServiceBindings</a></li></div></ul></div><a name="wp65844"> </a><h4 class="pHeading3">Finding Organizations by Name</h4><a name="wp66146"> </a><p class="pBody">To search for organizations by name, you normally use a combination of find qualifiers (which affect sorting and pattern matching) and name patterns (which specify the strings to be searched). The <code class="cCode">findOrganizations</code> method takes a collection of <code class="cCode">findQualifier</code> objects as its first argument and a collection of <code class="cCode">namePattern</code> objects as its second argument. The following fragment shows how to find all the organizations in the registry whose names begin with a specified string, <code class="cCode">qString</code>, and to sort them in alphabetical order.</p><div class="pPreformattedRelative"><pre class="pPreformattedRelative">// Define find qualifiers and name patternsCollection findQualifiers = new ArrayList();findQualifiers.add(FindQualifier.SORT_BY_NAME_DESC);Collection namePatterns = new ArrayList();namePatterns.add(qString);// Find using the nameBulkResponse response = &nbsp;&nbsp;bqm.findOrganizations(findQualifiers, &nbsp;&nbsp;&nbsp;&nbsp;namePatterns, null, null, null, null);Collection orgs = response.getCollection();<a name="wp67854"> </a></pre></div><a name="wp66168"> </a><p class="pBody">A client can use percent signs (<code class="cCode">%</code>) to specify that the query string can occur anywhere within the organization name. For example, the following code fragment performs a case-sensitive search for organizations whose names contain <code class="cCode">qString</code>:</p><div class="pPreformattedRelative"><pre class="pPreformattedRelative">Collection findQualifiers = new ArrayList();findQualifiers.add(FindQualifier.CASE_SENSITIVE_MATCH);Collection namePatterns = new ArrayList();namePatterns.add(&quot;%&quot; + qString + &quot;%&quot;);// Find orgs with name containing qStringBulkResponse response = &nbsp;&nbsp;bqm.findOrganizations(findQualifiers, namePatterns, null,&nbsp;&nbsp;&nbsp;&nbsp;null, null, null);Collection orgs = response.getCollection();<a name="wp66221"> </a></pre></div><a name="wp66170"> </a><h4 class="pHeading3">Finding Organizations by Classification</h4><a name="wp65847"> </a><p class="pBody">To find organizations by classification, you need to establish the classification within a particular classification scheme and then specify the classification as an argument to the <code class="cCode">findOrganizations</code> method.</p><a name="wp87479"> </a><p class="pBody">The following code fragment finds all organizations that correspond to a particular classification within the NAICS taxonomy. (You can find the NAICS codes at <code class="cCode"><a  href="http://www.census.gov/epcd/naics/naicscod.txt" target="_blank">http://www.census.gov/epcd/naics/naicscod.txt</a></code>.)</p><div class="pPreformattedRelative"><pre class="pPreformattedRelative">ClassificationScheme cScheme = &nbsp;&nbsp;bqm.findClassificationSchemeByName(null,&nbsp;&nbsp;&nbsp;&nbsp;&quot;ntis-gov:naics&quot;);Classification classification = &nbsp;&nbsp;blcm.createClassification(cScheme, &nbsp;&nbsp;&nbsp;&nbsp;&quot;Snack and Nonalcoholic Beverage Bars&quot;, &quot;722213&quot;);Collection classifications = new ArrayList();classifications.add(classification);// make JAXR requestBulkResponse response = bqm.findOrganizations(null,&nbsp;&nbsp;null, classifications, null, null, null);Collection orgs = response.getCollection();<a name="wp66329"> </a></pre></div><a name="wp75836"> </a><p class="pBody">You can also use classifications to find organizations that offer services based on technical specifications that take the form of WSDL (Web Services Description Language) documents. In JAXR, a concept is used as a proxy to hold the information about a specification. The steps are a little more complicated than in the previous example, because the client must find the specification concepts first, then the organizations that use those concepts.</p><a name="wp77782"> </a><p class="pBody">The following code fragment finds all the WSDL specification instances used within a given registry. You can see that the code is similar to the NAICS query code except that it ends with a call to <code class="cCode">findConcepts</code> instead of <code class="cCode">findOrganizations</code>.</p><div class="pPreformattedRelative"><pre class="pPreformattedRelative">String schemeName = &quot;uddi-org:types&quot;;ClassificationScheme uddiOrgTypes =&nbsp;&nbsp;bqm.findClassificationSchemeByName(null, schemeName);/* * Create a classification, specifying the scheme *  and the taxonomy name and value defined for WSDL *  documents by the UDDI specification. */Classification wsdlSpecClassification = blcm.createClassification(uddiOrgTypes, &nbsp;&nbsp;&quot;wsdlSpec&quot;, &quot;wsdlSpec&quot;);Collection classifications = new ArrayList();classifications.add(wsdlSpecClassification);// Find conceptsBulkResponse br = bqm.findConcepts(null, null, &nbsp;&nbsp;classifications, null, null);<a name="wp77787"> </a></pre></div><a name="wp76392"> </a><p class="pBody">To narrow the search, you could use other arguments of the <code class="cCode">findConcepts</code> method (search qualifiers, names, external identifiers, or external links).</p><a name="wp77852"> </a><p class="pBody">The next step is to go through the concepts, find the WSDL documents they correspond to, and display the organizations that use each document:</p><div class="pPreformattedRelative"><pre class="pPreformattedRelative">// Display information about the concepts foundCollection specConcepts = br.getCollection();Iterator iter = specConcepts.iterator();if (!iter.hasNext()) {&nbsp;&nbsp;System.out.println(&quot;No WSDL specification concepts found&quot;);} else {&nbsp;&nbsp;while (iter.hasNext()) {&nbsp;&nbsp;Concept concept = (Concept) iter.next();&nbsp;&nbsp;String name = getName(concept);&nbsp;&nbsp;Collection links = concept.getExternalLinks();&nbsp;&nbsp;System.out.println(&quot;\nSpecification Concept:\n\tName: &quot; + &nbsp;&nbsp;&nbsp;&nbsp;name + &quot;\n\tKey: &quot; + &nbsp;&nbsp;&nbsp;&nbsp;concept.getKey().getId() + &nbsp;&nbsp;&nbsp;&nbsp;&quot;\n\tDescription: &quot; + &nbsp;&nbsp;&nbsp;&nbsp;getDescription(concept));&nbsp;&nbsp;if (links.size() &gt; 0) {&nbsp;&nbsp;&nbsp;&nbsp;ExternalLink link = &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(ExternalLink) links.iterator().next();&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(&quot;\tURL of WSDL document: &#39;&quot; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;link.getExternalURI() + &quot;&#39;&quot;);&nbsp;&nbsp;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -