Cloud Data Source: Data Integration using SOAP webservice – Part 2 of 2
My part 2 of this blog will continue on how to use a Custom Data Source in C4C – specifically loading data by a SAP standard web service.
We will actually send a payload using the AnalyticsDataUpload webservice to update our Custom Data Source (CDS). If you remember in Part 1, last time we walked through setting up a communication system and arrangement and then exporting the WSDL.
We will use a tool to demonstrate how to use the webservice. It’s called soapUI, and it’s open source software (aka free !) There is a paid version, if you feel you need a lot of features and support. I recommend soapUI version 5.0.0. (the free version, of course).
- First, let’s load the WSDL we got back in Part 1.
In soapUI, click on File -> New SOAP Project. Don’t fill in the Project Name yet – the Browse will autofill that.
So click on Browse, and find the WSDL. The Project Name auto-fills. The screenshot below shows an example.
Click OK to create the project.
2. In the Request 1, I edited the given template and filled in the needed XML. This is the following payload XML I got:
Line 13 contains the technical name of my CDS
Line 15 says we are using the Merge Operation
Line 17 to 19 is the actual rows of the data. Line 17 begins the <Data>node and IMMEDIATELY lists the columns our XML intends to use.
– DO NOT PUT a new line after <Data> node !
Line 18 and 19 is the actual rows of CSV using a semi-colon delimiter. Do not change the delimiter to comma or other character.
Of course, you have as many data rows as you need. I’m just using 2 for my blog here.
Line 19 shows that the last row of data must NOT have a newline, but rather IMMEDIATELY is joined by the </Data> node.
If you are not careful about the special situation on <Data> and </Data> tags, your web service call will NOT work.
BEFORE – Below is a quick view of my CDS BEFORE the webservice:
So comparing with my payload, TC09 is a new key. TC05 does exist in the CDS. My payload is specified for a MERGE operation, and I click the RUN !
AFTER – Below is a quick view of my CDS after the web service updated the CDS:
As you can see, when existing IDs match a row in CDS, the payload data row overwrites the CDS data row.
When no match IDs, the row is inserted to the CDS.
So this method allows for updates to existing data rows as long as you have the ID.
Lastly if you use “OVERWRITE” as method (see line 15 of the payload), you will cause the clearing of all data rows in the CDS, and an upload of your data.
BTW, in one of my current projects, we are putting CDS web services through its paces with a record count of 200k to upload. I may add updates on what I find.
Enjoy !
Hi Tim
Thanks for this blog and the previous blogs on cloud data source. We were going to write a how-to guide for this - but for now I'll point to your blogs and the one Rishbah did - thank you so much!!
Regards
Ginger
Is there any way we could do it for standard data source ? or BO.
Like for mass update to Accounts with physical file attachments etc..
Hey Tim (or anyone else who can help us), just wondering if we can trace the web service messages from SAP BW to C4C just as inbound traffic in the web service message monitoring tool. The reason why I ask this is because we've setup a SOAP connection as such, we get a positive feedback on the BW side (as in data has been successfully transferred) but the data source is not updated at the C4C side. We also do not see any inbound traffic in the web service message monitor. How can we troubleshoot / trace this?
Thanks,
Rogier
Hey Smith,
You should see the incoming messages @ Web Service Message Monitoring untill and unless it is a Synchronous call. However in your case, make sure that communication arrangment in C4C is Active with Successful Connectivity as the first step.
Hi Tim,
Do you have any documentation regarding how this should be done with HCI-DS?
Or how to connect HCI to BW an import an ODS to C4C?
Thanks,
Anton
Hi Anton,
HCI-DS will have documentation on help.sap.com. We do have customers using HCI-DS to load data into C4C, but I'm not sure that it is a cloud data source. I don't think we have written anything up from that experience. Please check help.sap.com for HCi-DS details.
-ginger
The problem that I havn't found any solution in is that the SOAP interface for uploading data to C4C is basically an CSV embedded in an SOAP message, all the date is in one field with headers.
When using HCI-DS I havn't found a way to perform that conversion. It is possible to concatenate fields using || but not merging rows.
Hi Anton
I'm using HCI DS to load C4C Cloud Datasource. Unfortunately we have to call the web-service once per source record. So in each call we pass one line for the column headers and one line of data. I have not found any faster method unfortunately.
If someone knows a more efficient approach, please help!
Thanks
Hi,
I tried to solve it using HCI-DS but never got it working.
What I finally did was to export the data using HCI-DS to an CSV file, this file was then picked up by HCI using SFTP and imported in the cloud data source.
To get the data into the right format we used an content modifier with this body:
<glob:AnalyticsDataUploadRequest xmlns:glob="http://sap.com/xi/SAPGlobal20/Global">
<BusinessDocumentBasicMessageHeader/>
<AnalyticsDataUploadRequestContent>
<MDAVName>${file:name.noext}</MDAVName>
<AnalyticsImportMethod>OVERWRITE</AnalyticsImportMethod>
<Data>${in.body}</Data>
</AnalyticsDataUploadRequestContent>
</glob:AnalyticsDataUploadRequest>
Hello,
i used HCI-DS in mutilpe projects to fill in the Cloud DataSource. It is a little bit tricky with an intermediate step, where you generate an intermediate output file.
1. read in the source file / db as one string per record
2. add to every xth record (based on how many records you want to transfer to C4C an end flag)
3. create an output txt file which is an xml file. Therefore you have to append add the first record the xml header, the <data> start tag and the header information of the datasource. Afterwards a line break and the first record of the source.
on each endflag add the closing </data> tag and a new starting <data> and {header} and {linebreak}
ensure that at the end you close the xml file with an </data> tag. I therefore added a flag on the last record.
4. Read in the file as an array with multiple <data> tags. Map it to the ws and done.
Hope this helps.
Kind Regards
ah I see the question was from Remy, i was on that project to solve the issue as mentioned above.
kind regards
Hi Ginger Gatling,
We have similar requirement of extracting data from BW system to C4C using HCI-DS, but we are facing issue in posting data from HCI-DS to C4C.
Kindly help us in solving the issue
https://answers.sap.com/questions/133023/changing-of-custom-odata-url-version-from-v1-to-v2.html
Above is the url of requirement in detail.
Thanks and regards,
Lokesh
Hi Tim,
The Blog was very useful. We have tried Data Integration by getting a response from ECC system. The trick part here is we have got responses with multiple rows of data (sales orders for a year) but only one row appears in the Overview page(Accounts Screen) of the standard UI.
This process of loading data occurs after a button click (Event-After Modify). Each time this button is clicked the same data loads. Please help us in providing a solution to load these multiple data.
Thanks.
Srinivasan.S
Hi Srinivasan,
So - have you created custom cloud data source objects you are loading from ERP? Would you please describe your scenario a bit more?
-ginger
Hi Ginger,
We are trying to get responses from ECC System using SOAP web service for Open Deliveries. We have created the communication arrangement and communication scenario and we are getting the response properly from the system.
We are trying to display this in a custom facet in the Accounts page. This action is triggered with a button click. When the button is clicked we are not able to view multiple data even though the response contains multiple data.
Only the first data displays. Please help!
Thanks,
Srinivasan
Hi Tim.
Is it possible to read data from the custom Data Source using sdk ?.
Thanks!.