Saludos a todo el mundo:
Si alguien puede echarme una mano, se lo agradezco por adelantado.estoy creando un web service con el siguiente WSDL: http://resultsservice.lottery.ie/resultsservice.asmx?WSDL
He conseguido sacar resultado por consola,de los "Euromillones" para el método GetProjectedJackpot, con el que obtengo el amount,drawDate y Guaranteed, pero, necesito sacar por consola los resultados de los sorteos de euromillones y crear una aplicacion que contacte con este WS y que compruebe una combinacion de euromillones.
La main es la siguiente:
import javax.xml.soap.*;
public class SOAPClientSAAJ {
public static void main(String args[]) throws Exception {
// Create SOAP Connection
SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
SOAPConnection soapConnection = soapConnectionFactory.createConnection();
// Send SOAP Message to SOAP Server
String url = "http://resultsservice.lottery.ie/resultsservice.asmx";
SOAPMessage soapResponse = soapConnection.call(createSOAPRequest(), url);
// print SOAP Response
System.out.print("Response SOAP Message:");
soapResponse.writeTo(System.out);
soapConnection.close();
}
private static SOAPMessage createSOAPRequest() throws Exception {
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage soapMessage = messageFactory.createMessage();
SOAPPart soapPart = soapMessage.getSOAPPart();
String serverURI = "http://www.lottery.ie/resultsservice/";
// SOAP Envelope
SOAPEnvelope envelope = soapPart.getEnvelope();
envelope.addNamespaceDeclaration("gpj", serverURI);
/*
Constructed SOAP Request Message:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:gpj="http://www.lottery.ie/resultsservice">
<soapenv:Header/>
<soapenv:Body>
<gpj:GetProjectedJackpot>
<gpj:drawType>Lotto</gpj:drawType>
</gpj:Message>
</soapenv:Body>
</soapenv:Envelope>
*/
// SOAP Body
SOAPBody soapBody = envelope.getBody();
SOAPElement soapBodyElem = soapBody.addChildElement("GetProjectedJackpot", "gpj");
SOAPElement soapBodyElem1 = soapBodyElem.addChildElement("drawType", "gpj");
soapBodyElem1.addTextNode("EuroMillions");
MimeHeaders headers = soapMessage.getMimeHeaders();
headers.addHeader("SOAPAction", serverURI + "GetProjectedJackpot");
soapMessage.saveChanges();
/* Print the request message */
System.out.print("Request SOAP Message:");
soapMessage.writeTo(System.out);
System.out.println();
return soapMessage;
}
}
Graacias y un saludo, nuevamente