AngelJanniee
AngelJanniee

Reputation: 623

how to pass the SOAP request in Android?

I am trying to do the SOAP request like this below.

 public Request[] getPatronAccountInfo(String appCode, String AppPwd , String patronID) {
Request getAccountInfo = new Request();
SoapObject accountInfoSO = new SoapObject(AppConstants.NAMESPACE, AppConstants.function);
accountInfoSO.addProperty(AppConstants.AppCode, appCode);
accountInfoSO.addProperty(AppConstants.AppPwd, AppPwd);
accountInfoSO.addProperty(AppConstants.ClientIP, "");
accountInfoSO.addProperty(AppConstants.EndUserId, "");
accountInfoSO.addProperty(AppConstants.PatronID, patronID);
accountInfoSO.addProperty(AppConstants.AccessToken, "");

getAccountInfo.setRequestSoapObject(accountInfoSO);
getAccountInfo.setSoapAction(AppConstants.NAMESPACE + "/" + AppConstants.function);
Request[] reqParams = {getAccountInfo};
return reqParams;

}

But I need to add the PatronID outside the ServiceContext tag.

My SOAP request are like this,

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:over="*********">
   <soapenv:Header/>
   <soapenv:Body>
      <over:GetPatronAccountInfoRequest>
         <over:ServiceContext>
            <over:AppCode>123</over:AppCode>
            <over:AppPwd>123</over:AppPwd>
            <over:ClientIP></over:ClientIP>
            <over:EndUserId></over:EndUserId>
         </over:ServiceContext>
         <over:PatronID>1234R</over:PatronID>
         <over:AccessToken></over:AccessToken>
      </over:GetPatronAccountInfoRequest>
   </soapenv:Body>
</soapenv:Envelope>

outside the ServiceContext tag I need to pass the parans PatronID and AccessToken HOW TO REQUEST THESE PARAMS AS I MENTIONED ABOVE?

Upvotes: 0

Views: 57

Answers (1)

kiran Biradar
kiran Biradar

Reputation: 12732

Try the following sequence. Add getPatronAccountInfo to your Soap Body.

SoapObject  getPatronAccountInfo = new SoapObject (NAMESPACE, METHOD_NAME);

SoapObject serviceContext = new SoapObject(NAMESPACE, METHOD_NAME);
serviceContext.addProperty("appcode", "123");
serviceContext.addProperty("AppPwd", "AppPwd");
serviceContext.addProperty("clientIp", "Ip");
serviceContext.addProperty("EndUserId", "Id");

getPatronAccountInfo.addProperty("serviceContext",serviceContext);
getPatronAccountInfo.addProperty("PatronId","1234R");
getPatronAccountInfo.addProperty("AccessToken","token");

Upvotes: 2

Related Questions