📄 jaxr4.html
字号:
<a name="wp78066"> </a><div class="pSmartList1"><li>If you are running the J2EE Application Server on a system other than your own, or if it is running on a nondefault port, change the following lines:</li></div><a name="wp149146"> </a><p class="pBodyRelative"><code class="cCode">link.uri=http://localhost:8080/hello-jaxrpc/hello?WSDL<br />...<br />wsdlorg.svcbnd.uri=http://localhost:8080/hello-jaxrpc/hello</code></p><a name="wp148513"> </a><p class="pBodyRelative">Specify the fully qualified host name instead of <code class="cCode">localhost</code>, or change <code class="cCode">8080</code> to the correct value for your system.</p><a name="wp148508"> </a><div class="pSmartList1"><li>Feel free to change any of the organization data in the remainder of the file. This data is used by the publishing and postal address examples.</li></div></ol></div><a name="wp89933"> </a><p class="pBody">You can edit the <code class="cCode">src/JAXRExamples.properties</code> file at any time. The <code class="cCode">asant</code> targets that run the client examples will use the latest version of the file.</p><a name="wp89573"> </a><h3 class="pHeading2">Compiling the Examples</h3><a name="wp77313"> </a><p class="pBody">To compile the programs, go to the<code class="cCode"> <</code><code class="cVariable">INSTALL</code><code class="cCode">>/j2eetutorial14/examples/jaxr/simple/</code> directory. A <code class="cCode">build.xm</code>l file allows you to use the command</p><div class="pPreformattedRelative"><pre class="pPreformattedRelative">asant compile<a name="wp69476"> </a></pre></div><a name="wp69477"> </a><p class="pBody">to compile all the examples. The <code class="cCode">asant</code> tool creates a subdirectory called <code class="cCode">build</code>.</p><a name="wp89798"> </a><p class="pBody">The runtime classpath setting in the <code class="cCode">build.xml</code> file includes JAR files in several directories in the J2EE Application Server installation. All JAXR client examples require this classpath setting.</p><a name="wp96272"> </a><h3 class="pHeading2">Running the Examples</h3><a name="wp96280"> </a><p class="pBody">If you are running the examples with the Java WSDP Registry Server, start the Java WSDP Tomcat (<code class="cCode"><</code><code class="cVariable">JWSDP_HOME</code><code class="cCode">></code> is the location of the Java WSDP on your system).</p><a name="wp134313"> </a><p class="pBody">On Windows, from the Start menu, choose Programs<span style="font-family: Symbol"><img src="images/arrwrite.gif" border="0" alt="Right Arrow"></span>Java Web Services Developer Pack 1.<code style="font-style: oblique" class="cVariable">x</code><span style="font-family: Symbol; font-style: normal"><img src="images/arrwrite.gif" border="0" alt="Right Arrow"></span>Start Tomcat or use the following command:</p><div class="pPreformattedRelative"><pre class="pPreformattedRelative"><<code class="cVariable">JWSDP_HOME</code>>\bin\startup<a name="wp134316"> </a></pre></div><a name="wp134314"> </a><p class="pBody">On a UNIX system, use the following command:</p><div class="pPreformattedRelative"><pre class="pPreformattedRelative"><<code class="cVariable">JWSDP_HOME</code>>/bin/startup.sh<a name="wp96318"> </a></pre></div><a name="wp96322"> </a><p class="pBody">The Registry Server is a Web application that is loaded when Tomcat starts.</p><a name="wp106288"> </a><p class="pBody">You do not need to start Tomcat in order to run the examples against public registries.</p><a name="wp77277"> </a><h4 class="pHeading3">Running the JAXRPublish Example</h4><a name="wp77335"> </a><p class="pBody">To run the <code class="cCode">JAXRPublish</code> program, use the <code class="cCode">run-publish</code> target with no command line arguments:</p><div class="pPreformattedRelative"><pre class="pPreformattedRelative">asant run-publish<a name="wp69508"> </a></pre></div><a name="wp69509"> </a><p class="pBody">The program output displays the string value of the key of the new organization, which is named "The Coffee Break."</p><a name="wp72339"> </a><p class="pBody">After you run the <code class="cCode">JAXRPublish</code> program but before you run <code class="cCode">JAXRDelete</code>, you can run <code class="cCode">JAXRQuery</code> to look up the organization you published.</p><a name="wp87157"> </a><h4 class="pHeading3">Running the JAXRQuery Example</h4><a name="wp87158"> </a><p class="pBody">To run the <code class="cCode">JAXRQuery</code> example, use the <code class="cCode">asant</code> target <code class="cCode">run-query</code>. Specify a <code class="cCode">query-string</code> argument on the command line to search the registry for organizations whose names contain that string. For example, the following command line searches for organizations whose names contain the string "coff" (searching is not case-sensitive):</p><div class="pPreformattedRelative"><pre class="pPreformattedRelative">asant -Dquery-string=coff run-query<a name="wp87159"> </a></pre></div><a name="wp77282"> </a><h4 class="pHeading3">Running the JAXRQueryByNAICSClassification Example</h4><a name="wp77339"> </a><p class="pBody">After you run the <code class="cCode">JAXRPublish</code> program, you can also run the <code class="cCode">JAXRQueryByNAICSClassification</code> example, which looks for organizations that use the "Snack and Nonalcoholic Beverage Bars" classification, the same one used for the organization created by <code class="cCode">JAXRPublish</code>. To do so, use the <code class="cCode">asant</code> target <code class="cCode">run-query-naics</code>:</p><div class="pPreformattedRelative"><pre class="pPreformattedRelative">asant run-query-naics<a name="wp77369"> </a></pre></div><a name="wp77280"> </a><h4 class="pHeading3">Running the JAXRDelete Example</h4><a name="wp85903"> </a><p class="pBody">To run the <code class="cCode">JAXRDelete</code> program, specify the key string displayed by the <code class="cCode">JAXRPublish</code> program as input to the <code class="cCode">run-delete</code> target:</p><div class="pPreformattedRelative"><pre class="pPreformattedRelative">asant -Dkey-string=<code class="cVariable">keyString</code> run-delete<a name="wp85904"> </a></pre></div><a name="wp77358"> </a><h4 class="pHeading3">Publishing a Classification Scheme</h4><a name="wp87248"> </a><p class="pBody">In order to publish organizations with postal addresses to public registries, you must publish a classification scheme for the postal address first. </p><a name="wp87253"> </a><p class="pBody">To run the <code class="cCode">JAXRSaveClassificationScheme</code> program, use the target <code class="cCode">run-save-scheme</code>:</p><div class="pPreformattedRelative"><pre class="pPreformattedRelative">asant run-save-scheme<a name="wp87254"> </a></pre></div><a name="wp87255"> </a><p class="pBody">The program returns a UUID string, which you will use in the next section.</p><a name="wp87509"> </a><p class="pBody">You do not have to run this program if you are using the Java WSDP Registry Server, because it does not validate these objects.</p><a name="wp87629"> </a><p class="pBody">The public registries allow you to own more than one classification scheme at a time (the limit is usually a total of about 10 classification schemes and concepts put together).</p><a name="wp87247"> </a><h4 class="pHeading3">Running the Postal Address Examples</h4><a name="wp87568"> </a><p class="pBody">Before you run the postal address examples, open the file <code class="cCode">postalconcepts.xml</code> in an editor. Wherever you see the string <code class="cCode">uuid-from-save</code>, replace it with the UUID string returned by the <code class="cCode">run-save-scheme</code> target (including the <code class="cCode">uuid:</code> prefix). For the Java WSDP Registry Server, you may use any string that is formatted as a UUID.</p><a name="wp87569"> </a><p class="pBody">For a given registry, you only need to publish the classification scheme and edit <code class="cCode">postalconcepts.xml</code> once. After you perform those two steps, you can run the <code class="cCode">JAXRPublishPostal</code> and <code class="cCode">JAXRQueryPostal</code> programs multiple times.</p><div class="pSmartList1"><ol type="1" class="pSmartList1"><a name="wp87191"> </a><div class="pSmartList1"><li>Run the <code class="cCode">JAXRPublishPostal</code> program. Notice that in the <code class="cCode">build.xml</code> file, the <code class="cCode">run-publish-postal</code> target contains a <code class="cCode"><sysproperty></code> tag that sets the <code class="cCode">userTaxonomyFilenames</code> property to the location of the <code class="cCode">postalconcepts.xml</code> file in the current directory:</li></div><a name="wp87272"> </a><p class="pBodyRelative"><code class="cCode"><sysproperty <br />key="com.sun.xml.registry.userTaxonomyFilenames"<br /> value="postalconcepts.xml"/></code></p><a name="wp87270"> </a><p class="pBodyRelative">Specify the string you entered in the <code class="cCode">postalconcepts.xml</code> file (including the <code class="cCode">uuid:</code> prefix) as input to the <code class="cCode">run-publish-postal</code> target:</p><a name="wp85881"> </a><p class="pBodyRelative"><code class="cCode">asant -Duuid-string=</code><code class="cVariable">uuidstring</code><code class="cCode"> run-publish-postal</code></p><a name="wp85884"> </a><p class="pBodyRelative">The program output displays the string value of the key of the new organization.</p><a name="wp85882"> </a><div class="pSmartList1"><li>Run the <code class="cCode">JAXRQueryPostal</code> program. The <code class="cCode">run-query-postal</code> target contains the same <code class="cCode"><sysproperty></code> tag as the <code class="cCode">run-publish-postal</code> target. </li></div><a name="wp87323"> </a><p class="pBodyRelative">As input to the <code class="cCode">run-query-postal</code> target, specify both a <code class="cCode">query-string</code> argument and a <code class="cCode">uuid-string</code> argument on the command line to search the registry for the organization published by the <code class="cCode">run-publish-postal</code> target:</p><a name="wp85917"> </a><p class="pBodyRelative"><code class="cCode">asant -Dquery-string=coffee <br />-Duuid-string=</code><code class="cVariable">uuidstring</code><code class="cCode"> run-query-postal</code>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -