60 lines
1.6 KiB
Java
60 lines
1.6 KiB
Java
/*
|
|
* Creado el 16-jul-07
|
|
*
|
|
* Para cambiar la plantilla para este archivo generado vaya a
|
|
* Ventana>Preferencias>Java>Generación de código>Código y comentarios
|
|
*/
|
|
package com.tarisan.chipcard.tpvvs.webservicetrayicon;
|
|
import com.tarisan.chipcard.tpvvs.ws.*;
|
|
import es.chipcard.util.*;
|
|
import java.io.*;
|
|
import java.net.URL;
|
|
/**
|
|
*
|
|
* @author jjrider
|
|
*/
|
|
public class EasyClient {
|
|
|
|
static{
|
|
File f=new File("./conf/cacerts");
|
|
//System.out.println(f.getAbsolutePath());
|
|
System.setProperty("javax.net.ssl.trustStore",f.getAbsolutePath());
|
|
System.setProperty("javax.net.ssl.trustStorePassword","changeit");
|
|
|
|
}
|
|
|
|
|
|
/***
|
|
* En base a una cadena y la URL, envia la peticion
|
|
* @param sPeticion
|
|
* @param url
|
|
* @return
|
|
* @throws Exception
|
|
*/
|
|
public String enviarPeticion(String sPeticion,String url) throws Exception{
|
|
String sResponse=null;
|
|
String sUniqueID=calculateUniqueId();
|
|
try{
|
|
SerClsChipCardWSPuntoEntradaSoapBindingStub service=new SerClsChipCardWSPuntoEntradaSoapBindingStub();
|
|
service.setEndPoint(new URL(url) );
|
|
service.setTimeout(60*1000);
|
|
sResponse=service.requestService(sPeticion);
|
|
}catch(Exception err){
|
|
err.printStackTrace();
|
|
}
|
|
return sResponse;
|
|
}
|
|
|
|
private String calculateUniqueId(){
|
|
SerClsFecha fecha=new SerClsFecha();
|
|
String sRetorno=fecha.toString("yyyyMMdd_HHmmssSSS");
|
|
return sRetorno;
|
|
}
|
|
|
|
public static void main(String args[]) throws Exception{
|
|
EasyClient client=new EasyClient();
|
|
String sRespuesta=client.enviarPeticion(args[1],args[0]);
|
|
System.out.println(sRespuesta);
|
|
}
|
|
}
|