日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

轉(zhuǎn):用Java調(diào)用WebService接口 - jinesin隨筆 - jinesin - 和訊博客

 ShangShujie 2010-07-24

這是一個(gè)用Java調(diào)用C#版WebService接口的例子:

C#接口:

0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" align="top"> using  System;
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" align="top">
using  System.Web;
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" align="top">
using  System.Web.Services;
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" align="top">
using  System.Web.Services.Protocols;
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" align="top">
using  System.Web.Services.Description;
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" align="top">
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" align="top">
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" align="top"> [WebService(Namespace 
=   " http://www./ " )]
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" align="top"> [WebServiceBinding(ConformsTo 
=  WsiProfiles.BasicProfile1_1)]
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" align="top">
public   class  Service : System.Web.Services.WebService
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" id="_303_939_Open_Image" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" align="top"> 0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" id="_303_939_Closed_Image" style="display: none;" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" align="top">
{
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" id="_327_398_Open_Image" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"> 0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" id="_327_398_Closed_Image" style="display: none;" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" align="top">     
public  Service ()  {
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">         
// 如果使用設(shè)計(jì)的組件,請(qǐng)取消注釋以下行 
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">         
// InitializeComponent(); 
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top">
    }

0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">     [SoapRpcMethod(Action 
=   " http://www./Add " , RequestNamespace  =   " http://www./T " , ResponseNamespace  =   " http://www./T " , Use  =  SoapBindingUse.Literal)]
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">     [WebMethod]
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">     
public   int  Add( int  a,  int  b)
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" id="_632_660_Open_Image" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"> 0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" id="_632_660_Closed_Image" style="display: none;" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" align="top">     
{
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">         
return  a  +  b;
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top">     }

0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">     [SoapRpcMethod(Action 
=   " http://www./Hello " , RequestNamespace  =   " http://www./T " , ResponseNamespace  =   " http://www./T " , Use  =  SoapBindingUse.Literal)]
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">     [WebMethod]
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">     
public  String HelloWorld()
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" id="_894_932_Open_Image" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"> 0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" id="_894_932_Closed_Image" style="display: none;" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" align="top">     
{
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">         
return   " Hello, world! " ;
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top">     }

0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">     
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif" align="top"> }

0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" align="top">


Java調(diào)用這個(gè)Webservice中的Add方法和HelloWorld方法:

1.有參方法:Add

0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" id="_29_1019_Open_Image" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" align="top"> public   static   void  addTest()  {
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" id="_37_964_Open_Image" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"> 0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" id="_37_964_Closed_Image" style="display: none;" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" align="top">         
try   {
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             Integer i 
=   1 ;
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             Integer j 
=   2 ;
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             
// WebService URL
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">
            String service_url  =   " http://localhost:4079/ws/Service.asmx " ;
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             Service service 
=   new  Service();
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             Call call 
=  (Call) service.createCall();
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             call.setTargetEndpointAddress(
new  java.net.URL(service_url));
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             
// 設(shè)置要調(diào)用的方法
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">
            call.setOperationName( new  QName( " http://www./T " " Add " ));
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             
// 該方法需要的參數(shù)
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">
            call.addParameter( " a " , org.apache.axis.encoding.XMLType.XSD_INT,
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">                     javax.xml.rpc.ParameterMode.IN);
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             call.addParameter(
" b " , org.apache.axis.encoding.XMLType.XSD_INT,
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">                     javax.xml.rpc.ParameterMode.IN);
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             
// 方法的返回值類型
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">
            call.setReturnType(org.apache.axis.encoding.XMLType.XSD_INT);
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             call.setUseSOAPAction(
true );
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             call.setSOAPActionURI(
" http://www./Add " );
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             
// 調(diào)用該方法
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">
            Integer res  =  (Integer)call.invoke(
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" id="_875_893_Open_Image" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"> 0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" id="_875_893_Closed_Image" style="display: none;" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" align="top">                     
new  Object[] {
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">                         i, j
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top">                     }

0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             );
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             System.out.println( 
" Result:  "   +  res.toString());
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" id="_986_1016_Open_Image" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"> 0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" id="_986_1016_Closed_Image" style="display: none;" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" align="top">         }
  catch  (Exception e)  {
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             System.err.println(e);
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top">         }

0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif" align="top">     }
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" id="_29_1019_Closed_Image" style="display: none;" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" align="top">

運(yùn)行,結(jié)果返回:Result:3

2.無(wú)參方法:HelloWorld

0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" id="_31_621_Open_Image" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" align="top"> public   static   void  helloTest()  {
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" id="_39_555_Open_Image" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"> 0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" id="_39_555_Closed_Image" style="display: none;" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" align="top">         
try   {
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             String endpoint 
=   " http://localhost:4079/ws/Service.asmx " ;
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             Service service 
=   new  Service();
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             Call call 
=  (Call) service.createCall();
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             call.setTargetEndpointAddress(
new  java.net.URL(endpoint));
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             call.setOperationName(
new  QName( " http://www./T " " HelloWorld " ));
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             call.setUseSOAPAction(
true );
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             call.setSOAPActionURI(
" http://www./Hello " );
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             String res 
=  (String)call.invoke(
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" id="_477_495_Open_Image" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"> 0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" id="_477_495_Closed_Image" style="display: none;" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" align="top">                     
new  Object[] {
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">                         
null
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top">                     }

0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             );
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             System.out.println( 
" Result:  "   +  res);
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" id="_577_618_Open_Image" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"> 0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" id="_577_618_Closed_Image" style="display: none;" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" align="top">         }
  catch  (Exception e)  {
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">             System.err.println(e.toString());
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top">         }

0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif" align="top">     }
0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" id="_31_621_Closed_Image" style="display: none;" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" src_cetemp="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" align="top">

可以看到,調(diào)用無(wú)參的webservice和有參的基本相同,不過(guò)無(wú)參調(diào)用時(shí),不需要調(diào)用Call的addParameter方法和setReturnType方法
執(zhí)行結(jié)果返回:Hello, world!

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多