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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
public void PG_Login1Async(String user,String mdp) throws Exception{
if (this.eventHandler == null)
throw new Exception("Async Methods Requires IWsdl2CodeEvents");
PG_Login1Async(user, mdp, null);
}
public void PG_Login1Async(final String user,final String mdp,final List<HeaderProperty> headers) throws Exception{
new AsyncTask<Void, Void, tCl_Login>(){
@Override
protected void onPreExecute() {
eventHandler.Wsdl2CodeStartedRequest();
};
@Override
protected tCl_Login doInBackground(Void... params) {
return PG_Login1(user, mdp, headers);
}
@Override
protected void onPostExecute(tCl_Login result)
{
eventHandler.Wsdl2CodeEndedRequest();
if (result != null){
eventHandler.Wsdl2CodeFinished("PG_Login1", result);
}
}
}.execute();
}
public tCl_Login PG_Login1(String user,String mdp){
return PG_Login1(user, mdp, null);
}
public tCl_Login PG_Login1(String user,String mdp,List<HeaderProperty> headers){
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.implicitTypes = true;
soapEnvelope.dotNet = true;
SoapObject soapReq = new SoapObject("urn:WB_Focusmobile","PG_Login1");
soapReq.addProperty("user",user);
soapReq.addProperty("mdp",mdp);
soapEnvelope.setOutputSoapObject(soapReq);
HttpTransportSE httpTransport = new HttpTransportSE(url);
httpTransport.debug = true;
try{
if (headers!=null){
httpTransport.call("http://intranet.test.local/WB_FOCUSMOBILE_WEB/awws/PG_Login1", soapEnvelope,headers);
}else{
httpTransport.call("http://intranet.test.local/WB_FOCUSMOBILE_WEB/awws/PG_Login1", soapEnvelope);
//System.out.println(httpTransport.requestDump);
}
Object retObj = soapEnvelope.bodyIn;
//Object retObj = soapEnvelope.getResponse();
System.out.println(retObj);
if (retObj instanceof SoapFault){
SoapFault fault = (SoapFault)retObj;
Exception ex = new Exception(fault.faultstring);
if (eventHandler != null)
eventHandler.Wsdl2CodeFinishedWithException(ex);
}else{
SoapObject result=(SoapObject)retObj;
if (result.getPropertyCount() > 0){
Object obj = result.getProperty(0);
SoapObject j = (SoapObject)obj;
tCl_Login resultVariable = new tCl_Login (j);
return resultVariable;
}
}
}catch (Exception e) {
if (eventHandler != null)
eventHandler.Wsdl2CodeFinishedWithException(e);
e.printStackTrace();
}
return null;
} |
Partager