import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;
import org.apache.axis.encoding.XMLType;
public class testsoap {
//keytool -import -keystore c:\\test.keystore -file world2_ca.cer
public static void main(String[] args) {
try{
System.setProperty("javax.net.ssl.trustStore","c:\\test.keystore"); // 这个就是我们用keytool生成的keystore文件的路径
String[] ret=null;
mdencode md=new mdencode();
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL("https://esales.world2.com.cn/services/UseCardManage"));
call.setProperty(Call.SEND_TYPE_ATTR, Boolean.FALSE);
call.setProperty(org.apache.axis.transport.http.HTTPConstants.HEADER_SOAP_ACTION, "NameSoap");
call.addParameter("businessId", XMLType.SOAP_INT, javax.xml.rpc.ParameterMode.IN);
call.addParameter("playerAccount", XMLType.SOAP_STRING, javax.xml.rpc.ParameterMode.IN);
call.addParameter("cardType", XMLType.SOAP_INT, javax.xml.rpc.ParameterMode.IN);
call.addParameter("number", XMLType.SOAP_INT, javax.xml.rpc.ParameterMode.IN);
call.addParameter("zoneId", XMLType.SOAP_INT, javax.xml.rpc.ParameterMode.IN);
call.addParameter("tranSeq", XMLType.SOAP_INT, javax.xml.rpc.ParameterMode.IN);
call.addParameter("md5Info", XMLType.SOAP_STRING, javax.xml.rpc.ParameterMode.IN);
call.addParameter("time", XMLType.SOAP_LONG, javax.xml.rpc.ParameterMode.IN);
call.setOperationName("useCard");
call.setReturnType(org.apache.axis.encoding.XMLType.SOAP_ARRAY);
String md5info=md.testDigest("10008&luanru&1&4&2&3&1&FKINSVBY137NKCV");
ret = (String[]) call.invoke(new Object[]{new Integer(10008),"luanru",new Integer(1),new Integer(4),new Integer(2),new Integer(3),md5info,new Integer(1)});
System.out.println("-------------ret="+ret[0]+ret[1]);
}catch(Exception e)
{ System.err.println(e.toString());
}
}
}
===========================================================================================
keytool -import -keystore c:\\test.keystore -file world2_ca.cer (蓝字是我们要生成的keystore文件的路径,红字部分是我们从浏览器导出的证书文件路径)
Trackback: http://tb.donews.net/TrackBack.aspx?PostId=1242535