Guest User

Untitled

a guest
Mar 18th, 2011
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.40 KB | None | 0 0
  1. public String[] doSOAPRequest(){       
  2.         String[] results = null;
  3.        
  4.         String NAMESPACE = "http://www.wizards.com/";
  5.         String METHOD_NAME = "KeywordSearch";
  6.         String SOAP_ACTION = "KeywordSearch";
  7.         String URL = "http://www.wizards.com/dndinsider/compendium/compendiumsearch.asmx";
  8.    
  9.         SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME);
  10.                
  11.         PropertyInfo pi = new PropertyInfo();
  12.        
  13.         pi.setName("Operand1");
  14.         pi.setValue(2);
  15.         pi.setType(int.class);
  16.         Request.addProperty(pi);     
  17.        
  18.         PropertyInfo pi2 = new PropertyInfo();
  19.         pi2.setName("Operand2");
  20.         pi2.setValue(5);
  21.         pi2.setType(int.class);
  22.         Request.addProperty(pi2);    
  23.        
  24.         SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
  25.                
  26.         envelope.dotNet = true;
  27.         envelope.setOutputSoapObject(Request);     
  28.        
  29.         AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport(URL);
  30.        
  31.         try
  32.         {
  33.             androidHttpTransport.call(SOAP_ACTION, envelope);
  34.             SoapObject response = (SoapObject)envelope.getResponse();
  35.             Object soapresult = (Object)response;
  36.          
  37.             results = (String[]) soapresult;
  38.             Log.d("worked out","worked");
  39.         }
  40.         catch(Exception e)
  41.         {
  42.             e.printStackTrace();
  43.             Log.d(e.toString(),"debug soap");
  44.         }
  45.      
  46.         return results;
  47.     }
Advertisement
Add Comment
Please, Sign In to add comment