Wednesday, October 17, 2012

SOAP Service Caller Method Which will return Response as OBJECT




public Object call(String soapAction, SoapSerializationEnvelope envelope,
                     String URL) {

              Object result = null;

              Marshal dateMarshal = new MarshalDate();
              dateMarshal.register(envelope);
              Marshal floatMarshal = new MarshalFloat();
              floatMarshal.register(envelope);

              final HttpTransportSE transportSE = new HttpTransportSE(URL);

              transportSE.debug = false;

              try {
                     transportSE.call(soapAction, envelope);
                     if (!isResultVector) {
                           result = envelope.getResponse();
                     } else {
                           result = envelope.bodyIn;
                     }
              } catch (final IOException e) {
                     e.printStackTrace();
              } catch (final XmlPullParserException e) {
                     e.printStackTrace();
              } catch (final Exception e) {
                     e.printStackTrace();
              }
              return result;
       }

No comments:

Post a Comment