gonzalob

Untitled

Feb 25th, 2020
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.75 KB | None | 0 0
  1. public static String requestNoticias(String str, String str2, String str3) throws HttpResponseException, IOException, XmlPullParserException {
  2.         SoapObject soapObject = new SoapObject(NAMESPACE, str);
  3.         soapObject.addProperty(param_cantidad, str2);
  4.         soapObject.addProperty(param_principales, str3);
  5.         SoapSerializationEnvelope soapSerializationEnvelope = new SoapSerializationEnvelope(110);
  6.         soapSerializationEnvelope.dotNet = true;
  7.         soapSerializationEnvelope.setOutputSoapObject(soapObject);
  8.         HttpTransportSE httpTransportSE = createHttpTransportSE();
  9.         httpTransportSE.debug = true;
  10.         ArrayList arrayList = new ArrayList();
  11.         StringBuilder sb = new StringBuilder();
  12.         sb.append("Basic ");
  13.         sb.append(Base64.encode(user.getBytes()));
  14.         arrayList.add(new HeaderProperty("Authorization", sb.toString()));
  15.         arrayList.add(new HeaderProperty("http.keepAlive", "false"));
  16.         //arrayList.add(new HeaderProperty("Accept-Encoding", "utf-8"));
  17.         //arrayList.add(new HeaderProperty("Accept-Charset", "utf-8"));
  18.         //arrayList.add(new HeaderProperty("Content-Type", "text/xml; charset=utf-8"));
  19.         httpTransportSE.call(SOAP_ACTION, soapSerializationEnvelope, arrayList);
  20.         String responseDump = httpTransportSE.responseDump;
  21.         String respuesta = responseDump; //StringFormatter.convertStringToUTF8(responseDump);
  22.         Log.d("response", responseDump);
  23.         return responseDump;
  24.     }
  25.  
  26.  private static HttpTransportSE createHttpTransportSE() {
  27.         HttpTransportSE httpTransportSE = new HttpTransportSE(URL);
  28.         //httpTransportSE.setXmlVersionTag("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
  29.  
  30.         return httpTransportSE;
  31.     }
Add Comment
Please, Sign In to add comment