Public feed
#601663
public Busqueda busqueda(Vector tags){
// creo el mensaje
SoapMessage message = new SoapMessage();
SoapMethod method = null;
// creo un metodo
if(tags.size() == 1){
method = new SoapMethod( "simpleSearch", "ser", "http://servicio/" );
method.addParameter( new SoapParameter( "arg0", (String)tags.get(0) ));
}
else{
// <negrada>
String result;
String javadeltoor = "";
for(int i=0; i < tags.size(); i++){
javadeltoor += tags.get(i) + ";" ;
}
// </negrada>
method = new SoapMethod( "multipleSearch", "ser", "http://servicio/" );
method.addParameter( new SoapParameter( "arg0", javadeltoor ) );
}
try
{
//agrego el metodo al mensaje
message.addMethod( method );
}
catch( Exception ex )
{
System.err.println( "could not create message " + ex.toString() );
System.exit( -1 );
}
// un poco de debug
System.out.println( message.toString() );
// creo el cliente que consume el ws apuntando a mi host
// lo que puede ser cambiado :)
Client client = new Client( "http://172.16.18.113:8765/Gpi/Servicio", "Servicio", "ServicioPort", "http://172.16.18.113:8765/Gpi/Servicio" );
// invoco el metodo pidiendole a message que genere el xml
SOAPMessage response = client.invoke( message.getMessage() );
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try
{
// imprimo la salida
response.writeTo( baos );
String result = baos.toString();
System.out.println(result);
Busqueda b = Busqueda.fromXml(result);
return b;
}
catch( Exception ex )
{
// mensaje estilo "gato" :P
System.err.println( "error masivo" );
System.exit( -1 );
}
return null;
}