Fuse 6 is no longer supported
As of February 2025, Red Hat Fuse 6 is no longer supported. If you are using Fuse 6, please upgrade to Red Hat build of Apache Camel.Questo contenuto non è disponibile nella lingua selezionata.
127.7. XML Serialization for IDoc
Overview Copia collegamentoCollegamento copiato negli appunti!
Copia collegamentoCollegamento copiato negli appunti!
An IDoc message body can be serialized into an XML string format, with the help of a built-in type converter.
XML namespace Copia collegamentoCollegamento copiato negli appunti!
Copia collegamentoCollegamento copiato negli appunti!
Each serialized IDoc is associated with an XML namespace, which has the following general format:
http://sap.fusesource.org/idoc/repositoryName/idocType/idocTypeExtension/systemRelease/applicationRelease
http://sap.fusesource.org/idoc/repositoryName/idocType/idocTypeExtension/systemRelease/applicationRelease
Both the
repositoryName
(name of the remote SAP meta-data repository) and the idocType
(IDoc document type) are mandatory, but the other components of the namespace can be left blank. For example, you could have an XML namespace like the following:
http://sap.fusesource.org/idoc/MY_REPO/FLCUSTOMER_CREATEFROMDATA01///
http://sap.fusesource.org/idoc/MY_REPO/FLCUSTOMER_CREATEFROMDATA01///
Built-in type converter Copia collegamentoCollegamento copiato negli appunti!
Copia collegamentoCollegamento copiato negli appunti!
The Camel SAP component has a built-in type converter, which is capable of converting a
Document
object or a DocumentList
object to and from a String
type.
For example, to serialize a
Document
object to an XML string, you can simply add the following line to a route in XML DSL:
<convertBodyTo type="java.lang.String"/>
<convertBodyTo type="java.lang.String"/>
You can also use this approach to a serialized XML message into a
Document
object. For example, given that the current message body is a serialized XML string, you can convert it back into a Document
object by adding the following line to a route in XML DSL:
<convertBodyTo type="org.fusesource.camel.component.sap.model.idoc.Document"/>
<convertBodyTo type="org.fusesource.camel.component.sap.model.idoc.Document"/>
Sample IDoc message body in XML format Copia collegamentoCollegamento copiato negli appunti!
Copia collegamentoCollegamento copiato negli appunti!
When you convert an IDoc message to a
String
, it is serialized into an XML document, where the root element is either idoc:Document
(for a single document) or idoc:DocumentList
(for a list of documents). Example 127.2, “IDoc Message Body in XML” shows a single IDoc document that has been serialized to an idoc:Document
element.
Example 127.2. IDoc Message Body in XML