on 2018 Mar 28 4:34 PM
Hello Guys,
I'm trying import multiple interactions using API API API_MKT_INTERACTION_SRV/Interactions and i getting the error "Error while parsing an XML stream".
This is the Json the i build:
[ { "InteractionSourceObject" : "RB_000006", "InteractionSourceObjectType" : "INVOICE", "InteractionTimeStampUTC" : "2018-02-10T09:00:00", "InteractionContactId" : "8148791", "InteractionContactOrigin" : "ZPASSPORT", "InteractionAmount" : "2000.00", "InteractionType" : "SALES_ORDER", "CommunicationMedium" : "BUSINESS_DOCUMENT", "ZZ1_SalesCost_MIA" : "1837.00", "ZZ1_OrderImcoming_MIA" : "1138.00", "ZZ1_TheoricSalesPrice_MIA" : "1927.00", "ZZ1_TotalDiscount_MIA" : "50.00", "ZZ1_Store_MIA" : "1234", "InteractionCurrency" : "BRL", "InteractionProducts" : [ { "Product" : "RB_1234", "ProductOrigin" : "SAP_HYBRIS_PRODUCT", "InteractionProductQuantity" : "2.00", "InteractionProductUnit" : "KGM", "InteractionProductAmount" : "500.00", "ZZ1_OfferId_MIP" : "123456" }, { "Product" : "RB_1235", "ProductOrigin" : "SAP_HYBRIS_PRODUCT", "InteractionProductQuantity" : "2.00", "InteractionProductUnit" : "KGM", "InteractionProductAmount" : "500.00", "ZZ1_OfferId_MIP" : "123456" } ] }, { "InteractionSourceObject" : "RB_000007", "InteractionSourceObjectType" : "INVOICE", "InteractionTimeStampUTC" : "2018-02-11T09:00:00", "InteractionContactId" : "8148791", "InteractionContactOrigin" : "ZPASSPORT", "InteractionAmount" : "2000.00", "InteractionType" : "SALES_ORDER", "CommunicationMedium" : "BUSINESS_DOCUMENT", "ZZ1_SalesCost_MIA" : "1837.00", "ZZ1_OrderImcoming_MIA" : "1138.00", "ZZ1_TheoricSalesPrice_MIA" : "1927.00", "ZZ1_TotalDiscount_MIA" : "50.00", "ZZ1_Store_MIA" : "1234", "InteractionCurrency" : "BRL", "InteractionProducts" : [ { "Product" : "RB_1234", "ProductOrigin" : "SAP_HYBRIS_PRODUCT", "InteractionProductQuantity" : "2.00", "InteractionProductUnit" : "KGM", "InteractionProductAmount" : "500.00", "ZZ1_OfferId_MIP" : "123456" }, { "Product" : "RB_1235", "ProductOrigin" : "SAP_HYBRIS_PRODUCT", "InteractionProductQuantity" : "2.00", "InteractionProductUnit" : "KGM", "InteractionProductAmount" : "500.00", "ZZ1_OfferId_MIP" : "123456" } ] } ]
This is the return:
<?xml version="1.0" encoding="utf-8"?> <error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> <code>CX_SXML_PARSE_ERROR/001560AA0E081DEB8CA398CC1690D406</code> <message xml:lang="en">Error while parsing an XML stream</message> <innererror> <application> <component_id>CEC-MKT-DM-IA</component_id> <service_namespace>/SAP/</service_namespace> <service_id>API_MKT_INTERACTION_SRV</service_id> <service_version>0001</service_version> </application> <transactionid>223B7B4444B30080E005AB98085AA93F</transactionid> <timestamp>20180328152830.2430970</timestamp> <Error_Resolution> <SAP_Transaction>For backend administrators: run transaction /IWFND/ERROR_LOG on SAP Gateway hub system and search for entries with the timestamp above for more details</SAP_Transaction> <SAP_Note>See SAP Note 1797736 for error analysis (https://service.sap.com/sap/support/notes/1797736)</SAP_Note> </Error_Resolution> <errordetails/> </innererror> </error>
I did try upload in bacth mode using atom:
--batch Content-Type: multipart/mixed; boundary=changeset --changeset Content-Type: application/http Content-Transfer-Encoding: binary POST Locations HTTP/1.1 Content-Type: application/atom+xml Content-Length: 10000 <?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:InteractionSourceObject>RB_000006</d:InteractionSourceObject> <d:InteractionSourceObjectType>INVOICE</d:InteractionSourceObjectType> <d:InteractionTimeStampUTC>2018-02-10T09:00:00</d:InteractionTimeStampUTC> <d:InteractionContactId>8148791</d:InteractionContactId> <d:InteractionContactOrigin>8148791</d:InteractionContactOrigin> </m:properties> </atom:content> </atom:entry> --changeset Content-Type: application/http Content-Transfer-Encoding: binary POST Locations HTTP/1.1 Content-Type: application/atom+xml Content-Length: 10000 <?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:InteractionSourceObject>RB_000006</d:InteractionSourceObject> <d:InteractionSourceObjectType>INVOICE</d:InteractionSourceObjectType> <d:InteractionTimeStampUTC>2018-02-10T09:00:00</d:InteractionTimeStampUTC> <d:InteractionContactId>8148791</d:InteractionContactId> <d:InteractionContactOrigin>8148791</d:InteractionContactOrigin> </m:properties> </atom:content> </atom:entry> --changeset-- --batch--
but i get the error unsuported media type
Do you have any ideia of how can i import multiple interaction using this API?
Best regards
Request clarification before answering.
Hi Rubens,
For the json file, there is an array enclosing your json payload. Can you run another test withour the array?
For batch mode, the POST is on the "Location" but this should be "Interactions".
Here's an example for a batch request with multiple interaction.
(sorry for the bad formatting)
--batch Content-Type: multipart/mixed; boundary=changeset_1 --changeset_1 content-type: application/http content-transfer-encoding: binary POST Interactions HTTP/1.1 Accept: application/json Sap-Cuan-SourceSystemType: EXT Sap-Cuan-SourceSystemId: CPI Content-Type: application/json Sap-Cuan-ForceSynchronousProcessing:X { "InteractionContactOrigin": "SAP_HYBRIS_CONSUMER", "InteractionContactId": "JHI_001", "CommunicationMedium": "ONLINE_SHOP", "InteractionType": "PROD_REVIEW_CREATED", "InteractionTimeStampUTC": "2018-03-06T12:12:24", "SourceSystemType": "COM", "SourceSystem": "SAP_MERCH_SHOP", "InteractionContent": "2018-03-28 Interaction Product Test 01" } --changeset_1 content-type: application/http content-transfer-encoding: binary POST Interactions HTTP/1.1 Accept: application/json Sap-Cuan-SourceSystemType: EXT Sap-Cuan-SourceSystemId: CPI Content-Type: application/json Sap-Cuan-ForceSynchronousProcessing:X { "InteractionContactOrigin": "SAP_HYBRIS_CONSUMER", "InteractionContactId": "JHI_001", "CommunicationMedium": "ONLINE_SHOP", "InteractionType": "PROD_REVIEW_CREATED", "InteractionTimeStampUTC": "2018-03-06T12:12:25", "SourceSystemType": "COM", "SourceSystem": "SAP_MERCH_SHOP", "InteractionContent": "2018-03-28 Interaction Product Test 02" } --changeset_1-- --batch--
br,
Johannes
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
I have similar error.
In Postman, this my request (It works)
--batch content-type: multipart/mixed; boundary=changeset_761e49b6-3146-4a57-8d10-15816fb9c751
--changeset_761e49b6-3146-4a57-8d10-15816fb9c751
content-type: application/http
POST Interactions() HTTP/1.1
Content-Type: application/json
{
"InteractionContactOrigin" : "SAP_HYBRIS_CONSUMER",
"InteractionContactId" : "92a2fc8549a4ad28",
"CommunicationMedium" : "ONLINE_SHOP",
"InteractionType" : "SHOP_ITEM_VIEW",
"InteractionTimeStampUTC":"1970-01-18T17:14:48",
"InteractionAmount" : "0",
"InteractionCurrency": "EUR",
"DeviceType": "Smartphone",
"SourceSystemType": "iOS 11.3",
"InteractionProducts" :[{
"ProductOrigin": "SAP_HYBRIS_PRODUCT",
"Product": "1288120"
}]
}
But in CPI (cloud platform integration) it says:
LastError = com.thoughtworks.xstream.converters.ConversionException: OSCI issue : OSCI issue ---- Debugging information ---- message : OSCI issue cause-exception : com.sap.gateway.core.ip.processor.exception.ODataProcessingException cause-message : OSCI issue class : java.util.ArrayList required-type : java.util.ArrayList converter-type : com.sap.gateway.core.ip.processor.converter.ConverterXMLToList path : /batchParts/batchChangeSet/batchChangeSetPart/Interactions line number : 2 version : null
Any idea?
Best Regards
Cesar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I also struggled with the payload for an interaction containing InteractionProducts; also a lot of "Error while parsing an XML stream" errors, Application Log errors like "Currency for "Amount" on interaction or product level missing", and other errors;
and finally with some help we got a working payload.
I hope this can help someone:
URL: https://host:port/sap/opu/odata/sap/API_MKT_INTERACTION_SRV/$batch
Headers:
- x-csrf-token
-Content-Type: multipart/mixed;boundary=batch
--batch
Content-Type: multipart/mixed; boundary=changeset_1
--changeset_1
content-type: application/http
content-transfer-encoding: binary
POST Interactions HTTP/1.1
Content-Length: 1035
Accept: application/json
Sap-Cuan-RequestTimestamp: '2018-04-09T08:14:14'
Sap-Cuan-SourceSystemType: EXT
Sap-Cuan-SourceSystemId: TEST
Content-Type: application/json
{
"InteractionContactOrigin" : "SAP_HYBRIS_CONSUMER",
"InteractionContactId" : "JHI_001",
"CommunicationMedium" : "BUSINESS_DOCUMENT",
"InteractionType" : "SALES_ORDER",
"InteractionTimeStampUTC" : "2018-04-09T08:14:14",
"InteractionCurrency" : "EUR",
"InteractionProducts" :
[{
"ProductOrigin":"SAP_ERP_MATNR",
"Product":"170",
"InteractionProdWeightingFactor":1,
"InteractionProductSentimentVal":1,
"InteractionProductQuantity":"2",
"InteractionProductUnit":"pc",
"InteractionProductAmount":"3.20",
"InteractionProductReason":"EF-TEST"
}]
}
--changeset_1--
--batch--
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.