on 02-24-2014 10:57 AM
Hello,
When developing an application with the GWPAM (add sap service reference) we encounter the following problem when we create a batch request:
Although I receive this error in my C# (mvc4) application, in the gateway and the backend I receive no error (and my entities are created in the crm backend).
When I run the request from the gateway system I notice that there is in the batch headers an additional header: Content-Length. And the error is emphasizing that there should only be two headers....
Anybody has an idea on how to get the batch-processing (completely) working from Visual studio?
Can we remove the Content-Length header somewhere in the response in the gateway.?
Thanks in advance!
Kind regards,
Robin
Hi Robin,
Can you ellaborate more on how you use GWPAM API?
Did you try to update/create just a single entry and not batch ? did that work ok?
What version of WCF do you use, I suggest you install latest WCF Data Services (5.6) and try again
Regards
Roy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Roy,
Up to now i've used an old version of the gwpam tool: SAPNetWeaverGatewayDeveloperToolForVisualStudio_2.4.100.0
Here I've just added the SAP service reference.
A standalone create works, when I do an update then I have the error in C#: entity An item with the same key has already been added.
In Fiddler i see that the update has been OK (I get the correct response).
I've also installed the latest version of the WCF Data Services and here I have the same issue.
I'm going to try to get my hands on the latest gwpam api, but I wonder if this can be the solution for my issue with the batch-response?
The DataServiceResponse fails on the response of the gateway (although it is correct).
Kind regards,
Robin
Hi Robin,
In the following link you can find how to leverage Batch capabilities:
Another think that you need to check is that your Gateway service supports batch capabilities.
Please let me know if it was helped, otherwise, add your code snippet for the GW service call.
Thanks,
Alex
Hi Alex,
Besides the entities being used in the example i am doing the same thing.
Gateway service supports batch capabilities (in gateway/SAP CRM everything is OK as described in the original post).
Today I finally get the complete GWPAM-tool installed on my pc at the customer. So I can try to see if this makes a difference.
Kind regards,
Robin
Hi Roy,
That is the option I've added indeed but still i do receive: An item with the same key has already been added.
Today I finally get the complete GWPAM-tool installed on my pc at the customer. So I can try to see if this makes a difference.I'll keep you posted.
Thanks for the input.
Kind regards,
Robin
With the last GWPAM tool the Update of a single entity works, but a batch (update of 2 addresses) gives the same error as described in the original post.
This is my method for updating two addresses in batch:
public void UpdateAddress(String adNr)
{
var serviceContext = new Entities.ZLB_SRV.ZLB_SRV(new Uri("http://server:port/sap/opu/odata/sap/ZLB_SRV/"));
var q = (from add in _service.AddressSet
where add.adressNumber.Equals(adNr)
select add).First();
if (q != null)
{
var entity = new Entities.ZLB_SRV.Address();
entity.adressNumber = q.adressNumber;
entity.BusinessPartner_partnerNumber = q.BusinessPartner_partnerNumber;
entity.city = "City1";
entity.postalCode = "1010";
entity.dateFrom = q.dateFrom;
entity.dateTo = q.dateTo;
entity.street = q.street;
entity.houseNumber = q.houseNumber;
entity.houseNumber2 = q.houseNumber2;
serviceContext.AttachTo("AddressSet", entity);
serviceContext.UpdateObject(entity);
}
var q2 = (from add in _service.AddressSet
where add.adressNumber.Equals("0001075928")
select add).First();
if (q2 != null)
{
var entity = new Entities.ZLB_SRV.Address();
entity.adressNumber = q2.adressNumber;
entity.BusinessPartner_partnerNumber = q2.BusinessPartner_partnerNumber;
entity.city = "City2";
entity.postalCode = "1010";
entity.dateFrom = q2.dateFrom;
entity.dateTo = q2.dateTo;
entity.street = q2.street;
entity.houseNumber = q2.houseNumber;
entity.houseNumber2 = q2.houseNumber2;
serviceContext.AttachTo("AddressSet", entity);
serviceContext.UpdateObject(entity);
}*/
DataServiceResponse resp = null;
resp = serviceContext.SaveChanges(SaveChangesOptions.Batch);
//resp = serviceContext.SaveChanges(SaveChangesOptions.ReplaceOnUpdate);
}
This is the response coming back from the gateway:
HTTP/1.1 202 Accepted
content-type: multipart/mixed; boundary=3199567334E0D161AED680899C510CCC0
content-length: 701
dataserviceversion: 2.0
--3199567334E0D161AED680899C510CCC0
Content-Type: multipart/mixed; boundary=3199567334E0D161AED680899C510CCC1
Content-Length: 519
--3199567334E0D161AED680899C510CCC1
Content-Type: application/http
Content-Length: 111
content-transfer-encoding: binary
HTTP/1.1 204 No Content
Content-Type: text/html
Content-Length: 0
dataserviceversion: 2.0
content-id: 2
--3199567334E0D161AED680899C510CCC1
Content-Type: application/http
Content-Length: 111
content-transfer-encoding: binary
HTTP/1.1 204 No Content
Content-Type: text/html
Content-Length: 0
dataserviceversion: 2.0
content-id: 4
--3199567334E0D161AED680899C510CCC1--
--3199567334E0D161AED680899C510CCC0--
Any idea's?
Thanks in advance.
Kind regards,
Robin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Robin,
I am checking this for you.
Hope to come back with some answers as soon as possible.
Cheers,
Dalit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.