on 07-30-2014 2:45 PM
Hi Experts,
As we came to know that POST, PUT, DELETE OData call functionality have been added in SMP 3.0 SP03 PL02 recently. And we are able to execute the same.
Now we are trying with implementing POST method for more than one entry. We have tried with the below payload
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<atom:content type="application/xml">
<m:properties>
<d:DEPT_ID>136</d:DEPT_ID>
<d:DEPT_NAME>FINANCE</d:DEPT_NAME>
<d:DEPT_LOCATION>ITC-1</d:DEPT_LOCATION>
</m:properties>
</atom:content>
<atom:link rel="https://localhost:8084/gateway/odata/SAP/HSQLDBDEPT;v=1/DEPARTMENT" type="application/xml;type=feed" title="DEPARTMENT" href='self'>
<m:inline>
<atom:feed>
<atom:entry>
<atom:content type="application/xml">
<m:properties>
<d:DEPT_ID>137</d:DEPT_ID>
<d:DEPT_NAME>FINANCE</d:DEPT_NAME>
<d:DEPT_LOCATION>ITC-1</d:DEPT_LOCATION>
</m:properties>
</atom:content>
</atom:entry>
</atom:feed>
</m:inline>
</atom:link>
</atom:entry>
But only 1st record is getting updated in the HSQLDB database not both. What do you suggest for this kind of scenarios how to POST more than one entry?
Rgrds,
JK
yes, it worked with BATCH request.
Request body:
--batch
Content-Type: multipart/mixed; boundary=changeset
--changeset
Content-Type: application/http
Content-Transfer-Encoding: binary
POST DEPARTMENT HTTP/1.1
Content-Type: application/atom+xml
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<atom:content type="application/xml">
<m:properties>
<d:DEPT_ID>136</d:DEPT_ID>
<d:DEPT_NAME>CanvasM</d:DEPT_NAME>
<d:DEPT_LOCATION>ITC-5</d:DEPT_LOCATION>
</m:properties>
</atom:content>
</atom:entry>
--changeset
Content-Type: application/http
Content-Transfer-Encoding: binary
POST DEPARTMENT HTTP/1.1
Content-Type: application/atom+xml
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<atom:content type="application/xml">
<m:properties>
<d:DEPT_ID>137</d:DEPT_ID>
<d:DEPT_NAME>CanvasM</d:DEPT_NAME>
<d:DEPT_LOCATION>ITC-5</d:DEPT_LOCATION>
</m:properties>
</atom:content>
</atom:entry>
--changeset--
--batch--
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Update:
This issue still has not been resolved in latest release of smp 3.0 SP04 PL01
Regards
JK
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jitendra,
Batch requests allow you to group multiple Odata requests into single HTTP request.
GET, POST, PUT, DELETE requests can be added to a batch request. You have to manage it from the device code.
Ex.
private static final String ODATA_BATCH_VERB = "$batch";
...
//Create the Batch Request
BatchRequest mBatchRequest = new BatchRequest(appEndPoint + ODATA_BATCH_VERB);
mBatchRequest.setListener(this);
mBatchRequest.setPriority(IRequest.PRIORITY_HIGH);
//Create the Batch Request
mBatchRequest.addRetrieveRequestToBatch(getRequest);
mBatchRequest.addRequestToChangeset(deleteRequest);
mBatchRequest.addRequestToChangeset(createRequest);
mBatchRequest.addRequestToChangeset(updateRequest);
//Close change Requests
mBatchRequest.closeExistingChangeSet();
//Execute the batch request
requestManager().makeRequest(mBatchRequest);
Regards,
Midhun VP
Hi Jithendra,
Have you found a solution for the above problem? Right now I am also stuck with the same problem without any solution.
Regards,
Dhani
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.