chapter52.htm

来自「这是一个学写JAVA的好东西」· HTM 代码 · 共 468 行 · 第 1/2 页

HTM
468
字号
}.g1 {	FONT-SIZE: 14px}.g2 {	PADDING-LEFT: 21px; PADDING-TOP: 5px}.g3 {	FONT-WEIGHT: bold; COLOR: #ab6503}.g4 {	COLOR: #ff0000}.img {	BORDER-RIGHT: #800000 1px solid; BORDER-TOP: #800000 1px solid; BORDER-LEFT: #800000 1px solid; BORDER-BOTTOM: #800000 1px solid}.img1 {	BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid}.f14 {	FONT-SIZE: 14px; LINE-HEIGHT: 26px}.f20 {	FONT-WEIGHT: bold; FONT-SIZE: 20px}.top_red {	COLOR: #d70709; TEXT-DECORATION: none}.center01 {	COLOR: #000000; LINE-HEIGHT: 20px}.center01 TD {	COLOR: #000000; LINE-HEIGHT: 20px}.center01 A:link {	COLOR: #000000; TEXT-DECORATION: none}.center01 A:visited {	COLOR: #000000; TEXT-DECORATION: none}.center01 A:hover {	COLOR: #2b7128; TEXT-DECORATION: underline}.center02 {	COLOR: #194e00; LINE-HEIGHT: 20px}.center02 TD {	COLOR: #194e00; LINE-HEIGHT: 20px}.center02 A:link {	COLOR: #194e00; TEXT-DECORATION: none}.center02 A:visited {	COLOR: #194e00; TEXT-DECORATION: none}.center02 A:hover {	COLOR: #194e00; TEXT-DECORATION: underline}--></style><TABLE width=760 border=0 align=center cellPadding=0 cellSpacing=0 bgcolor="#F3F3F3" valign="top">	<tr class="center01"> 		<td width="488" style="padding-left:10px;padding-top:10px">			<a href="index.php">连载</a>       &gt; <a href="slist.php?class1=6">程序设计</a>      &gt; <a href="slist.php?class2=7">Java</a>      &gt; <a href="serialize.php?id=387">Java网络编程专辑</a>		</td>		<td width="280" style="padding-left:10px;padding-top:10px">			<div align="center">			<font color=#0000FF><a href='chapter.php?id=387&volume=4&chapter=3'>上一页</a></font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;			<font color=#0000FF><a href="serialize.php?id=387">回书目</a></font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;			<font color=#0000FF><a href='chapter.php?id=387&volume=4&chapter=5'>下一页</a></font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;			</div>		</td>	</tr>	<tr class="center01">		<td colspan="2" align="center" style="padding-left:10px;padding-top:10px">&nbsp;</td>	</tr>	<TBODY>	<TR> 		<TD colspan="2" align=middle>			<BR>			<div style="FONT-SIZE: 18pt; COLOR: #990000; FONT-FAMILY: 楷体_GB2312" align=center><B>相关API</b></div><br><div style="COLOR: #990000; font-family: ; font-size: 18px;宋体;" align=center>WebLogic UDDI Client API实例学习(一1)</div>			<DIV style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; FONT-SIZE: 10.5pt; COLOR: black; LINE-HEIGHT: 180%" align=left>                         <br>&nbsp;&nbsp;&nbsp;&nbsp;<P>  在开发UDDI的客户端程序时,我们一般考虑的都是IBM提供的UDDI4J,但不知道大家注意到没有,在BEA的WebLogic中也提供了一个非常方便的UDDI Client API。只是它被包含在weblogic.jar文件中而没有单独发布。WebLogic UDDI Client API的结构完全遵循了UDDI的体系结构,所以,通过对这套API类库的学习和实践,相信也有助于我们更好地理解UDDI的体系架构。<BR><BR>  <STRONG><FONT color=#f73809>Inquiry和Publish的基础</FONT></STRONG><BR><BR>  对UDDI注册中心的操作不外乎两大类:查询和发布(删除)。所以WebLogic定义了二个类,分别对应查询与发布的操作:Inquiry类用于查询,Publish类用于发布。这两个类位于weblogic.uddi.client.service包里,它们都继承于UDDIService类。在UDDIService类里定义了一个URL属性,保存着查询或发布的URL地址。<BR><BR>  Inquiry和Publish类通过父类UDDIService的setURL方法来设置它们的查询或发布地址。<BR><BR></P>
<TABLE width=100 align=center>
<TBODY>
<TR>
<TD><IMG src="/book/images/upload/1100142025-1.jpg" align=baseline border=0></TD></TR></TBODY></TABLE><BR>  <B><FONT color=#ac000>查询 Inquiry</FONT></B><BR><BR>  向UDDI注册中心查询的目标有四类:商业实体(BusinessEntity)、商业服务(BusinessService)、绑定模板信息(BindingTemplate)和tModel。我们来看Inquiry类里的方法,不难发现,这四种目标的查询,正对应Inquiry类里的四个find方法:<BR><BR>
<TABLE width=100 align=center>
<TBODY>
<TR>
<TD><IMG src="/book/images/upload/1100142031-2.jpg" align=baseline border=0></TD></TR></TBODY></TABLE><BR>  它包括两类方法find和get,其中find类方法用于查找与发现,而get类方法用于获取详细信息。<BR><BR>  四个find方法对应四种查询,五个get方法对应UDDI定义的四个数据模型(商业实体对应两个方法)。<BR><BR>  一般查询的步骤是先通过find方法得到数据模型的基本信息,以及它的一个唯一标识Key。然后就可以根据这个Key调用get方法获取这个模型的详细信息。<BR><BR>  <B><FONT color=#ac000>商业实体(BusinessEntity)查询</FONT></B><BR><BR>  通过Inquiry类定义的findBusiness方法结合getBusinessDetail方法可以在UDDI注册中心数据库中查询商业实体的各种信息。<BR><BR>
<TABLE width=100 align=center>
<TBODY>
<TR>
<TD><IMG src="/book/images/upload/1100142038-3.jpg" align=baseline border=0></TD></TR></TBODY></TABLE><BR>  findBusiness方法要求一个FindBusiness对象作为参数,用来定义查询的条件。<BR><BR>  构建FindBusiness对象并设置它的一些属性,比如setName(new Name(“IBM”),查询以IBM命名的商业实体。<BR><BR>  查询结果可以得到所有满足查询条件的BusinessInfo对象的Vector。<BR><BR>  BusinessInfo定义了商业实体的基本信息,比较重要的是Name和BusinessKey。<BR><BR>  getBusinessDetail方法根据BusinessKey的值可以得到BusinessEntity对象的Vector。<BR><BR>  在BusinessEntity对象中定义了多个商业实体的详细信息,包括Contact、Operator、DiscoveryURL、Description,以及Category和Identifier信息。<BR><BR>  下面是一段简化的代码,演示了如何根据参数查询BusinessEntity的信息。<BR><BR>
<TABLE width="100%" bgColor=#ffffff>
<TBODY>
<TR>
<TD>void echoBusiness(String parm){<BR><BR>try {<BR><BR>FindBusiness fb = new FindBusiness();<BR><BR>fb.setName(new Name(parm));<BR><BR>Vector vBusinessInfo = <BR><BR>finder.findBusiness(fb).getBusinessInfos().getBusinessInfoVector();<BR><BR>for(int i=0;i<VBUSINESSINFO.SIZE();I++){<BR> <BR>BusinessInfo bInfo = (BusinessInfo)vBusinessInfo.elementAt(i);<BR><BR>log(bInfo.getName().getValue()+" ["+bInfo.getBusinessKey()+"]");<BR><BR>GetBusinessDetail gbt = new GetBusinessDetail();<BR><BR>gbt.addBusinessKey(bInfo.getBusinessKey());<BR><BR>Vector vBusinessEntity = finder.getBusinessDetail(gbt).getBusinessEntityVector();<BR><BR>for(int j=0;j<VBUSINESSENTITY.SIZE();J++){<BR> <BR>BusinessEntity bEntity = (BusinessEntity)vBusinessEntity.elementAt(j);<BR><BR>log( "authorizedname is "+bEntity.getAuthorizedName()<BR><BR>+" operator is "+bEntity.getOperator());<BR><BR>}<BR><BR>}<BR><BR>}<BR><BR>catch (Exception ex) {<BR><BR>ex.printStackTrace();<BR><BR>}<BR><BR>}</TD></TR></TBODY></TABLE><br><br>          </DIV>		</TD>	</TR>	<TR> 		<TD class=center01>			<div align="center">来源:天极网 作者:<div>		</TD>		<TD width="280" class=center01>			<div align="center">			<font color=#0000FF><a href='chapter.php?id=387&volume=4&chapter=3'>上一页</a></font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;			<font color=#0000FF><a href="serialize.php?id=387">回书目</a></font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;			<font color=#0000FF><a href='chapter.php?id=387&volume=4&chapter=5'>下一页</a></font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;			</div>		</TD>	</TR>	</TBODY></TABLE><table><tr><td width="760"> <table width="760" height="10" border="0" cellpadding="0" cellspacing="0">                        <tr>                                <td></td>                        </tr>                </table>                <!------------ 评论 ---------------->                <table width="760" border="0" cellpadding="0" cellspacing="0">                        <tr>                                <td><iframe width="100%" id=vs frameborder=0 scrolling=no src="comment_list1.php?id=387"></iframe>                                </td>                        </tr>                </table><br><script language=javascript>function CheckNetwordForm(theForm){        if("" == theForm.content.value)        {                alert("写两句吧~~");                theForm.content.focus();                return false;        }        var index;        for(index=0;index<theForm.content.value.length;index++)        {                if(" " != theForm.content.value.charAt(index))                        break;        }        if(index == theForm.content.value.length) {                alert("写两句吧~~");                theForm.content.focus();                return false;        }        if (theForm.content.value.length>100){                alert("评论字数不能超过100哦");                theForm.content.focus();                return false;        }        return true;}</script>                <!------------------ 评论 --------------->                <form name=netword method=post action="insertnetword.php" onsubmit="javascript: return CheckNetwordForm(this);">                <table width="760" border="0" cellpadding="0" cellspacing="0">                        <tr>                                <td height="25" class="text6">&nbsp;给此书打分:<a name="1"></a>                                        <select name="score">                                                <option value=5 selected>非常好</option>                                                <option value=4>还凑合</option>                                                <option value=3>一般吧</option>                                                <option value=2>不太行</option>                                                <option value=1>太差了</option>                                        </select> &nbsp; 用户名:                                        <input name="id" value=387 type="hidden" id="id">                                        <input name="backurl" value=/book/chapter.php?id=387&volume=4&chapter=4 type="hidden">                                        <input name="username" type="text" id="username" size="20" maxlength="20">                                        <font color="#666666">*评论字数请控制在一百字以内</font> </td>                        </tr>                </table>                <br>&nbsp;<textarea name="content" cols="80" rows="4" wrap="OFF" id="description"></textarea>                <input type="submit" name="Submit" value="提交">                </form>        </td> </tr></table></td></tr></table> <TABLE cellSpacing=0 cellPadding=0 width=760 border=0>  <TBODY>    <TR>       <TD width="1003" height=9 background=images/t_bj01.gif><IMG height=1     src="images/ccc.gif" width=1></TD>    </TR>  </TBODY></TABLE><TABLE cellSpacing=0 cellPadding=0 width=760 bgColor=#ffffff border=0>  <TBODY>    <TR>       <TD><HR width=760 noShade SIZE=1> </TD>    </TR>    <TR>       <TD align=middle><A class=black href="http://www.chinaren.com/"     target=_blank>ChinaRen</A> - <A class=black     href="http://big5.www.sohu.com/" target=_blank>繁体版</A> - <A class=black     href="http://hr.sohu.com/hrm.html" target=_blank>搜狐招聘</A> - <A class=black     href="http://add.sohu.com/" target=_blank>网站登录</A> - <A class=black     href="http://help.sohu.com/" target=_blank>帮助中心</A> - <A class=black     href="http://book.news.sohu.com/onClick=this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.sohu.com');return"     target=_blank false;>设置首页</A> - <A class=black     href="http://adinfo.sohu.com/" target=_blank>广告服务</A> - <A class=black     href="http://www.sohu.com/about/lianxi.htm" target=_blank>联系方式</A> - <A     class=black href="http://www.sohu.com/about/privacy.html"     target=_blank>保护隐私权</A> - <A class=black href="http://www.sohu.com/about/"     target=_blank>About SOHU</A> - <A class=black     href="http://www.sohu.com/about/" target=_blank>公司介绍</A><BR> <SPAN     class=eng>Copyright &copy; 2004 Sohu.com Inc. All rights reserved. 搜狐公司         版权所有</SPAN> </TD>    </TR>  </TBODY></TABLE></center></body></html><script language="JavaScript" src="http://nielsen.js.sohu.com/nnselect.js"></script><noscript><img src='http://ping.nnselect.com/ping.gif?c=119' height='1' width='1'></noscript>

⌨️ 快捷键说明

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