代码:

 

import javax.xml.namespace.QName;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;

public class IPreventIndulge {
    
public boolean getValidateInfo(String UUid) {
        
try {
        String endpoint 
= " http://game.qidian.com/RemoteWebService/IPreventIndulge.asmx";    
                    
// 创建一个服务(service)调用(call)     
                    Service service = new Service();    
                    Call call 
= (Call) service.createCall();// 通过service创建call对象     
                    
// 设置service所在URL    
                    call.setTargetEndpointAddress(new java.net.URL(endpoint));   
                    call.setUseSOAPAction(
true); 
                    call.setSOAPActionURI(
" http://tempuri.org/GetIndulgeInfo"); //这个也要注意 就是要加上要调用的方法Add,不然也会报错
                    call.setOperationName(new QName(" http://tempuri.org/","GetIndulgeInfo")); 
                    
//GetIndulgeInfo  方法名称
                    call.addParameter(new QName(" http://tempuri.org/","idType"),
                            org.apache.axis.encoding.XMLType.XSD_STRING,
                           javax.xml.rpc.ParameterMode.IN);
                   call.addParameter(
new QName(" http://tempuri.org/","UUId"), 
                           org.apache.axis.encoding.XMLType.XSD_STRING,
                           javax.xml.rpc.ParameterMode.IN);

                    call.setReturnType(org.apache.axis.encoding.XMLType.SOAP_STRING); 
//返回参数的类型
                   
                    
                    
// Object 数组封装了参数,参数为"This is Test!",调用processService(String arg)     
                    String ret = (String) call.invoke(new Object[] {UUid,"0"});    
                    System.out.println(ret);  
        } 
catch (Exception e) {
            e.printStackTrace();
        }  
        
return false;
    }
    
public static void main(String[] args) {
        
new IPreventIndulge().getValidateInfo("411668171");
    }
}

 

相关文章: