Hello @Koen van Wielink
Welcome to the Microsoft Q&A platform.
You are right that the XML that has been read is converted to JSON and is used by the service. You could use @xml()
to convert string to XML representation - that may not meet your goal - as it cannot be a directly consumed by other activities.
I had done small repro at my end, and I was able to replicate the behavior you have observed.
For Testing Purpose, I had created two XML for input.
I was able to overcome the behavior by having two copy activities with different mappings - one for multiple rows and one for single rows.
For XML1 - Schema : BookStore --> Book[]
You will have to create explicit Mapping for the Copy Activity 1 ( Multiple rows as per Above screenshot).
[ You can do Import Schema
in both scenarios - But you should be able to get the Multiple rows and Single row response to do it automatically. ]
The above is just an illustration per my source. You could modify as per your XML Structure
Note : Book here is an array
Now for the Copy Activity 2 ( "Single Row") - This executes on the failure of the Copy Activity 1 (Multiple Rows) .
When only one row is returned - Book will be considered as an Object and not as array - Multiple Rows Copy Activity fails as it cannot find the Book [] . Single Row Copy Activity with the below mapping executes.
For XML2 - JSON Schema -Bookstore --> Book
Note: Book here is an object.
Execution :
- When Multiple Rows are Returned as a result of HTTP Connector - Multiple Rows Copy Activity succeeds and Single Row Copy Activity is ignored
- When Single Row is Returned as a result of HTTP Connector - Multiple Rows Copy Activity fails because of schema mapping and Single Row Copy Activity is executed
In both the cases the row(s) are written to the same Sink (SQL DB in your Case)
Hope this helps. Do let us know if you any further queries.
--------------------------------------------------------------------------
- Please don't forget to click on or upvote button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
- Want a reminder to come back and check responses? Here is how to subscribe to a notification
- If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators