以上是xml,下面是类代码,我搞定了,绝对没问题 。这是一个验证用户存不存在的。(下载 apache的axis包就可以换到所在的类了。**********是IP地址,我去掉了,不好意思!)
import java.net.MalformedURLException;
import java.rmi.RemoteException;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import javax.xml.rpc.ServiceException;
//import org.apache.axis.Constants;
import org.apache.axis.Constants;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
public class Webservice {
public Webservice(){
try {
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new java.net.URL("http://**********/webservice.asmx"));
call.setOperationName(new QName("http://tempuri.org/","check_id_pass"));
call.addParameter(new QName("http://tempuri.org/","gamename"),XMLType.XSD_STRING, ParameterMode.IN);
call.setUseSOAPAction(true);
call.setSOAPActionURI("http://tempuri.org/check_id_pass");
call.setReturnType(XMLType.XSD_STRING);
String result = (String)call.invoke(new Object[]{"aaaa"});
System.out.println(result);
} catch (ServiceException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void main(String args[]){ new Webservice(); }}