Skip to Content
0
Nov 20, 2012 at 08:54 AM

Making request error from android via sap gateway services

21 Views

hi,

i'm getting following error while work with post gateway service from the android. HTTP request error. I'm using the following code to update the data via POST gateway service.

mParameters = new SDMConnectivityParameters();

mParameters.setUserName(<username>);

mParameters.setUserPassword(<password>);

mPreferences = new SDMPreferences(_context, Utility.getLogger());

ISDMRequestManager mRequestManager = new SDMRequestManager(Utility.getLogger(), mPreferences, mParameters, 3, mSecurity);

ISDMRequest request = new SDMBaseRequest();

request.setListener(this);

request.setRequestUrl(_serviceURL);

request.setRequestMethod(ISDMRequest.REQUEST_METHOD_POST);

request.setPriority(ISDMRequest.PRIORITY_HIGH);

Map<String, String> headers = new HashMap<String, String>();

headers.put("Content-Type", "application/atom+xml");

headers.put("X-Requested-With", "XMLHttpRequest");

request.setHeaders(headers);

request.setData(requestBody.getBytes());

request.setRequestUrl(_serviceURL);

mRequestManager.makeRequest(request);

_response = "pending";

while (true)

{

if (_response != "pending")

{

break;

}

}

if (_response.equalsIgnoreCase("error"))

{

ThrowServiceException(_ISDMRequestStateElement);

}

else if (_response.equalsIgnoreCase("error400"))

{

throw new CustomException(respBody);

}

return _response;