📄 jax2.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0098)http://gceclub.sun.com.cn/staticcontent/html/webservices/web_services_tutorial/jax-rpc.11/11.2.htm -->
<HTML><HEAD><TITLE>Sun eCommunity</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<SCRIPT language=JavaScript>
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</SCRIPT>
<SCRIPT language=JavaScript>
var thisButton;
var disabled = false;
function isDisabled(button){
if (!disabled){
button.disabled = true;
disabled = true;
}
thisButton = button;
Timer = setTimeout("setEnable()", 4000);
return disabled;
}
function setEnable(){
thisButton.disabled = false;
disabled = false;
}
</SCRIPT>
<LINK href="jax2.files/default.css" type=text/css rel=stylesheet>
<META content="MSHTML 6.00.2800.1492" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0
onload="MM_preloadImages('/NASApp/sme/docroot/ecommunity/pics/ar_lg_yell_r_pad1.gif','/NASApp/sme/docroot/ecommunity/pics/ar_lg_red_r_pad1.gif')"
marginwidth="0" marginheight="0"><!-- BEGIN HOMEPAGE CODE --><!-- BEGIN HOMEPAGE TOP NAVIGATION TOOLBAR -->
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD>
<P align=left><SPAN class=sp2><FONT
face=Arial></FONT></SPAN> </P></TD></TR>
<FORM action=http://search.sun.com/search/global/index.jsp>
<TR>
<TD vAlign=center noWrap width="100%">
<DIV class=sitelinks>
<P align=left> 中国 <FONT
face=Arial> | </FONT>热线电话:<FONT
face=Arial>800-810-3786</FONT></P></DIV></TD>
<TD vAlign=center noWrap>
<DIV class=sitelinks>
<P align=left><A href="http://www.sun.com.cn/howtobuy/">如何购买</A><FONT
face=Arial> | <A href="http://www.sun.com/MySun/">My
Sun</A> | <A
href="http://www.sun.com.cn/worldwide/"></A></FONT><A
href="http://www.sun.com.cn/worldwide/">各地网站</A></P></DIV></TD>
<TD>
<P align=left><FONT
face=Arial> </FONT></P></TD>
<TD vAlign=center>
<P align=left><FONT face=Arial><INPUT class=medium
onfocus="if(this.value==this.defaultValue) this.value='';" size=10
value=搜索 name=qt> <INPUT type=hidden value=PRC name=country> <INPUT
type=hidden value=zh name=language> <INPUT type=hidden value=gb2312
name=charset> <INPUT type=hidden name=variant> </FONT></P></TD>
<TD>
<P align=left><FONT face=Arial> </FONT></P></TD>
<TD vAlign=center align=left>
<P align=left><FONT face=Arial><INPUT class=buttonred onmouseover="this.style.color='#fbe249';" onmouseout="this.style.color='#FFF';" type=submit value=">>" border=0>
</FONT></P></TD>
<TD>
<P align=left><FONT face=Arial><IMG height=1 alt="" src="" width=10
border=0></FONT></P></TD></TR></FORM>
<TR>
<TD>
<P align=left><SPAN class=sp2><FONT
face=Arial></FONT></SPAN> </P></TD></TR></TBODY></TABLE><!-- END HOMEPAGE TOP NAVIGATION TOOLBAR -->
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD height=90>
<DIV align=center>
<TABLE style="BORDER-COLLAPSE: collapse" borderColor=#111111 cellSpacing=8
cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD class=sunblue vAlign=top width="20%" bgColor=#0000ff height=60>
<P align=left><FONT face=Arial><IMG height=38
src="jax2.files/logo_sun_home.gif" width=84> </FONT></P></TD>
<TD class=sunyellow vAlign=bottom width="40%" bgColor=#fbe249
height=60>
<P align=left><A
onmouseover="MM_swapImage('Image25211','','http://gceclub.sun.com.cn/NASApp/sme/docroot/ecommunity/pics/ar_lg_red_r_pad1.gif',1)"
onmouseout=MM_swapImgRestore()
href="http://gceclub.sun.com.cn/NASApp/sme/controller/techtopcatquery?cat_id=03"><FONT
face=Arial><IMG height=21 src="jax2.files/ar_lg_red_r_pad.gif"
width=24 border=0 name=Image25211></FONT></A><A
onmouseover="MM_swapImage('Image25','','/NASApp/sme/docroot/ecommunity/pics/ar_lg_red_r_pad1.gif',1)"
onmouseout=MM_swapImgRestore()
href="http://gceclub.sun.com.cn/NASApp/sme/controller/sublearning?cat_level=1&cat_id=01"><FONT
face=Arial><IMG height=21 src="jax2.files/zxxx0.gif" width=97
border=0></FONT></A></P></TD>
<TD class=sunred vAlign=bottom width="40%" bgColor=#d12124
height=60><P align=left><A
onmouseover="MM_swapImage('Image26111','','http://gceclub.sun.com.cn/NASApp/sme/docroot/ecommunity/pics/ar_lg_yell_r_pad1.gif',1)"
onmouseout=MM_swapImgRestore()
href="http://gceclub.sun.com.cn/NASApp/sme/controller/subresource?cat_level=1&cat_id=02"><IMG
height=21 src="jax2.files/ar_lg_yell_r_pad.gif" width=24 border=0
name=Image26111></A><A
onmouseover="MM_swapImage('Image261','','/NASApp/sme/docroot/ecommunity/pics/ar_lg_yell_r_pad1.gif',1)"
onmouseout=MM_swapImgRestore()
href="http://gceclub.sun.com.cn/NASApp/sme/docroot/ecommunity/support/index.jsp"><FONT
face=Arial><IMG height=21 src="jax2.files/zczx0.gif" width=97
border=0></FONT></A>
</P></TD></TR></TBODY></TABLE></DIV></TD></TR></TBODY></TABLE>
<TABLE>
<TBODY>
<TR>
<TD vAlign=bottom width=1142>
<TABLE cellSpacing=2 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD vAlign=top width="1%">
<P align=left> </P>
<P align=left> </P></TD>
<TD vAlign=top width="77%">
<DIV>
<DIV class=navbar align=center>
<TABLE dir=ltr cellSpacing=0 cellPadding=0 width="100%"
summary="Navigation bar, includes the book title and navigation buttons"
border=0>
<TBODY>
<TR bgColor=#cccccc>
<TD class=navbartitle align=left abbr=ChapTitle>
<P align=left><FONT
face=Arial> </FONT>用JAX-RPC构建Web服务</P></TD>
<TD vAlign=top align=right abbr=NavButtons><A
href="http://gceclub.sun.com.cn/staticcontent/html/webservices/web_services_tutorial/index.htm"><IMG
height=26 alt="Table of Contents" src="jax2.files/toc01.htm"
width=30 border=0> </A><A
href="http://gceclub.sun.com.cn/staticcontent/html/webservices/web_services_tutorial/jax-rpc.11/11.1.htm"><IMG
height=26 alt="Previous Chapter" src="" width=30 border=0></A>
<A
href="http://gceclub.sun.com.cn/staticcontent/html/webservices/web_services_tutorial/jaxm.12/12.1.htm"><IMG
height=26 alt="Next Chapter" src="" width=30 border=0></A>
</TD></TR></TBODY></TABLE></DIV></DIV>
<DIV>
<DIV>
<TABLE dir=ltr width="100%" summary="Chapter Title" border=0
abbr="ChapTitle">
<COLGROUP width="100%">
<COL id=1 width="100%"></COLGROUP>
<TBODY>
<TR>
<TD>
<H4><B><A name=bu></A><BR>部署服务</B></H4>
<P>要部署服务,键入如下命令:</P>
<P>ant deploy</P>
<P>对于随后的部署,按“<A
href="http://gceclub.sun.com.cn/staticcontent/html/webservices/web_services_tutorial/jax-rpc.11/11.2.htm#die">迭代开发</A>”部分所描述的来运行ant
redeploy命令。</P>
<P><B><A name=yang></A>验证部署</B></P>
<P>要验证服务是否已经成功部署,打开一个浏览器窗口,然后验证服务端点的URL:</P>
<P>http://localhost:8080/hello-jaxrpc/hello</P>
<P>浏览器应该显示标题为Web
Service的页面,它列出了带有状态ACTIVE的端口名MyHello。该页面还有一个URL指向服务的WSDL文件。</P>
<P>URL的hello-jaxrpc部分是实现了HelloWorld服务的servlet的上下文路径。这部分与hello-jaxrpc.war文件的前缀相对应。URL的/hello字符串与jaxrpc-ri.xml文件的urlPattern属性的值相匹配。注意/hello前的斜杠是urlPattern值所必需的。关于完整的jaxrpc-ri.xml文件清单,请参见“<A
href="http://gceclub.sun.com.cn/staticcontent/html/webservices/web_services_tutorial/jax-rpc.11/11.1.htm#da">打包WAR文件</A>”。</P>
<P><B>撤销部署服务</B></P>
<P>指南中到此为止没有撤销部署服务。完成这个例子后,可以通过键入如下命令来撤销部署服务:</P>
<P>ant undeploy</P>
<P><B>构建运行客户端</B></P>
<P>按照这些步骤来开发一个JAX-RPC客户端:</P>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -