這是一個(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.tangs.com/ " )]
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.tangs.com/Add " , RequestNamespace = " http://www.tangs.com/T " , ResponseNamespace = " http://www.tangs.com/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.tangs.com/Hello " , RequestNamespace = " http://www.tangs.com/T " , ResponseNamespace = " http://www.tangs.com/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.tangs.com/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.tangs.com/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.tangs.com/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.tangs.com/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!
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)
點(diǎn)擊舉報(bào)。