问题
My situation is like this:
I need to get CSV data from a REST API using the Wcf-WebHttp adapter, map this data to XML using a map I have deployed (along with the CSV and XML schema) and store it in an SQL Server database.
For now I have created a two-way send port, a static one way send port, a receive port and a receive location.
The two-way send port polls the data from the API, and the static one way send port subscribes using a filter to this send port and receives the data.
I tried putting the map as an inbound and outbound map on the two-way send port, and as an outbound map on the static one way send port, but no transformation occurs. I simple get a "Data at the root level is invalid. Line 1, position 1." warning when attempting to transfer the data.
I am also unsure what pipelines I should use for this. On my one way static send port I have used an XML Transmit pipeline to correctly send the data to the SQL server database.
The receive location is only there to trigger the GET request in the two-way send port for now.
Two-way send port
One-way static send port
回答1:
For your Receive Pipeline on your Two-way send port, your will need to have a pipeline with a Flat File Disassembler that is pointing to your CSV schema to parse the CSV into XML. You would then possibly have an inbound map to transform that XML into another XML format.
You don't need a Outbound map if your Two-Way send port is doing a GET against the REST API (as you won't be sending a message body anyway).
来源:https://stackoverflow.com/questions/52511841/using-a-csv-to-xml-map-in-a-two-way-send-port-that-polls-data-from-a-public-rest