1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
private static final String NAMESPACE = "http://www.monsite.com/axis2/services/StockQuoteService/";
private static final String METHOD_NAME = "getPrice";
private static final String SOAP_ACTION = "http://www.monsite.com/axis2/services/StockQuoteService/getPrice";
private static final String URL = "http://www.monsite.com/axis2/services/StockQuoteService?wsdl";
SoapObject reqWS(String property, String value) throws IOException, XmlPullParserException {
// Création de la requête SOAP
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("getPrice", "ABCD");
//Toutes les données demandées sont mises dans une enveloppe
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
//Préparation de la requête
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.debug = true;
//Envoi de la requête
androidHttpTransport.call(SOAP_ACTION, envelope);
Toast.makeText(this.context, "dump : "+androidHttpTransport.requestDump, Toast.LENGTH_LONG).show();
Toast.makeText(this.context, "dump : "+androidHttpTransport.responseDump, Toast.LENGTH_LONG).show();
//Obtention du résultat
SoapObject soapResult = (SoapObject) envelope.getResponse();
return soapResult;
} |
Partager