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.