on 05-02-2012 2:14 PM
Hi All
I am able to get the collection data from gateway oData using SUP libraries, but while creating entity using below code repeatedly it is giving http code:"400"
public void onClick(View v) {
Camptype_Text = Camp_Type.getText().toString();
MktOrg_Text = MktOrg.getText().toString();
Channel_Text =Channel.getText().toString();
String postURL = serviceDocPath
+ getIntent().getExtras().get("searchCategory");
TrialApp.getInstance().getLogger()
.i("InsertBooking", "Insert Rec: " + postURL);
String data =//"x-requested-with: XMLHttpRequest\r\n"
"\r\n"
+ "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\r\n"
+ "<entry xmlns:d=\"http://schemas.microsoft.com/ado/2007/08/dataservices\" xmlns:m=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\" xmlns=\"http://www.w3.org/2005/Atom\">\r\n"
+ "<content type=\"application/xml\">\r\n"
+ "<m:properties>\r\n"
+ "<d:campType>Z021</d:campType>\r\n"
+ "<d:mktOrg>50000027</d:mktOrg>\r\n"
+ "<d:channel>ZPHN</d:channel>\r\n"
+ "</m:properties>\r\n"
+"</content>\r\n"
+ "</entry>";
ISDMRequest postRequest = TrialApp.buildRequest(postURL, self);
Map<String, String> headers = new HashMap<String, String>();
headers.put("X-Requested-With", "XMLHttpRequest");
//headers.put("Content-Type", "application/xml");
((SDMBaseRequest) postRequest).setHeaders(headers);
final byte[] theByteArray = data.getBytes();
((SDMBaseRequest) postRequest).setData(theByteArray);
postRequest.setRequestMethod(ISDMRequest.REQUEST_METHOD_POST);
TrialApp.getInstance().getRequestmanager()
.makeRequest(postRequest);
}
Am I doing wrong any where ,Request for help in resolving the issue.sh
Thanks
Santosh
Hi Santosh,
problem is String data =//"x-requested-with: XMLHttpRequest\r\n"
this might be leading to malformed xml, you need to add this XMLHttpRequest in the header while creating a POST request.
Regards,
Srinivas Divakarla
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.