cancel
Showing results for 
Search instead for 
Did you mean: 

How to dump the complete MainDocument to a CLOB field?

Former Member
0 Kudos

Hi all,

is it possible to dump the complete MainDocument to a CLOB field?

That is, starting from <?xml version=1.0> to the last closing tag?

I have thought of two possibilities here, but I am unsure how I can actually implement them:

1. Use a JDBC receiver to make an "INSERT INTO myTable myCLOB <MainDocument>".

2. Tell the message mapping to simply dump the whole source message that was passed to the Integration Engine into this CLOB field.

I am currently favoring option 2, but I have no idea yet how you can access the source message from inside the message mapping. I guess there is a system object that holds it... can you help me there?

Thanks and cheers!

Stefan

Accepted Solutions (1)

Accepted Solutions (1)

bhavesh_kantilal
Active Contributor
0 Kudos

Stefan,

You cannot do this with Graphical Mapping.

You will need either Java or XSL mapping to handle this requirement.

Regards

Bhavesh

Answers (1)

Answers (1)

Former Member
0 Kudos

Stefan,

1. Use a JDBC receiver to make an "INSERT INTO myTable myCLOB <MainDocument>".

2. Tell the message mapping to simply dump the whole source message that was passed to the Integration Engine into this CLOB field.

you cant pass this "<MainDocument>" from Message mapping

Former Member
0 Kudos

Thanks for the replies so far.

I have had a closer look at the JDBC receiver configuration, but I am still unsure to one matter: where do I build the insert statement?

I do not see a field for that in the JDBC receiver channel. What I have found in the how tos and blogs were message mappings that filled specific fields from specific input values. But I need to get the whole MainDocument into this single field.

Any ideas how to accomplish that?

Cheers!

Stefan

Former Member
0 Kudos

in attribute called action .

we assing INSERT value to this action.

the values we need to insert are under <access> root element.

i think what you looking for wont work.

Regards

sreeram.g.reddy

Former Member
0 Kudos

Ok - thanks for the insight. I will try the Java Mapping then.

bhavesh_kantilal
Active Contributor
0 Kudos

Stefan

1 . Receiver JDBC adapter expects data for the INSERT to be of a particular format.

<root>
  <StatementName>
<dbTableName action= “INSERT”>
    <table>realDbTableName</table>
<access>
<col1>xml payload from Source</col1>
</access>
</dbTableName>
</StatementName>
</root>

Write a java or XSL mapping that will create an output of this format where the entire XML paykload is copied between COL1 . You will have to rename the fieldnames according to your table strcuture.

Regards

Bhavesh

henrique_pinto
Active Contributor
0 Kudos

Go for XSLT, it's the easiest:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:out="http://www.outputservice.com">
	<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
	<xsl:template match="/">
		<out:OutputMessage>
			<out:string>
				<xsl:text disable-output-escaping="yes"><![CDATA[<![CDATA[
				
				]]
				>
			
		
	

]]>

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:in="http://www.inputservice.com">
	<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
	<xsl:template match="/in:InputMessage/in:string">
		<xsl:value-of select="." disable-output-escaping="yes"/>
	</xsl:template>
</xsl:stylesheet>

Regards,

Henrique.

bhavesh_kantilal
Active Contributor
0 Kudos

was waiting for the XSLT fan to give the code tremplate 🐵

Regards

Bhavesh

henrique_pinto
Active Contributor
0 Kudos

Lol!

Henrique.