package com.segsec.gisap.webservice;import java.util.Vector;import javax.xml.namespace.QName;import org.apache.axis.client.Call;import org.apache.axis.client.Service;import org.apache.axis.encoding.XMLType;public class LbsRescue {private String url = "http://IP地址/LbsRescue.asmx";// 提供介面的地址private String soapaction = "http://www.***.net:7005/"; // 網域名稱,這是在server定義的public LbsRescue() {String City = "北京";Service service = new Service();try {Call call = (Call) service.createCall();call.setTargetEndpointAddress(new java.net.URL(url));call.getMessageContext().setUsername("ygbx");// axis中的使用者名稱。call.getMessageContext().setPassword("5kY3XhfxyNnHPtwrhvDycQ==");// 密碼call.setUseSOAPAction(true);call.setSOAPActionURI(soapaction + "sendList");call.setOperationName(new QName(soapaction, "sendList")); // 設定要調用哪個方法call.addParameter(new QName(soapaction, "companyid"), // 設定要傳遞的參數org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);call.addParameter(new QName(soapaction, "companypwd"), // 設定要傳遞的參數org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);call.addParameter(new QName(soapaction, "mobile"), // 設定要傳遞的參數org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);call.addParameter(new QName(soapaction, "flag"), // 設定要傳遞的參數org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);call.setReturnType(XMLType.XSD_STRING); // 要返回的資料類型(自訂類型)// call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);//(標準的類型)call.setUseSOAPAction(true);call.setSOAPActionURI(soapaction + "sendList");String s = (String) call.invoke(new Object[] {"ygbx","pfAo/msenzv8lChXTPa9yw==","15910510352",1});// 調用方法並傳遞參數System.out.println("註冊手機:"+s);} catch (Exception ex) {ex.printStackTrace();}}public static void main(String args[]) {LbsRescue LR = new LbsRescue();}}