cancel
Showing results for 
Search instead for 
Did you mean: 

Two xml tag on a single message

Former Member
0 Kudos

Hi Guys,

I have a requirement in which I have to send a message to an external server using HTTP but the external server it is expecting two xml one for Authenticate and the other with the message. So the message would look like this:

<?xml version='1.0'?>

<Authentication>

<user>User</user>

<pwd>Pwd</pwd>

</Authentication>

<?xml version='1.0'?>

<Message>

<customer>Customer</customer>

<Address>Address</Address>

</Message>

So I have to send this 2 xml to the external server.

the scenario is Sync RFC -> XI -> HTTP

Any Idea how to solve this?

Thanks

Omar Hernandez

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Omar !!

Do you need to send both messages in the same post?

check this thread:

/people/jin.shin/blog/2006/02/07/multi-mapping-without-bpm--yes-it146s-possible

Maybe you can use multimapping without bpm to create 2 messages,..one for the authentication and one for the content.

Regards,

Matias.

Former Member
0 Kudos

Hi Matias,

Do you need to send both messages in the same post? Yes, I need to send it in the same post.

It seems to be helpful the weblog, let me try.

Thanks

Omar

Former Member
0 Kudos

Hi Omar !!

I think that this multimapping approach will make 2 posts, instead of the one you need. Maybe you will need use java mapping or xslt mapping to allow you to be more flexible with the output stream and include 2 xml messages...

Regards,

Matias.

Former Member
0 Kudos

Hi Omar !

If you send one xml message, with one header and two recordsets (one for the authentication data and the other for the customer data), does it works? does it detects the post as the customer data post or as the authentication data post ?

Regards,

Matias.

Former Member
0 Kudos

hi,

think ur message might be inthis format as we need a root element for the XML

<?xml version="1.0">

<root>

<Authentication>

<user>User</user>

<pwd>Pwd</pwd>

</Authentication>

<Message>

<customer>Arrow</customer>

<Address>Wall st</Address>

</Message>

</root>

now to convert this to the format u want that is the following

<?xml version="1.0">

<Authentication>

<user>User</user>

<pwd>Pwd</pwd>

</Authentication>

<?xml version="1.0">

<Message>

<customer>Arrow</customer>

<Address>Wall st</Address>

</Message>

can u try the below XSLT

<?xml version="1.0"?>

<xsl:stylesheet version="1.0"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml"></xsl:output>

<xsl:template match="/">

<xsl:apply-templates select="root/Authentication"></xsl:apply-templates>

<xsl:apply-templates select="root/Message"></xsl:apply-templates>

</xsl:template>

<!--

copy the Authentication node as it is in the source XML

-->

<xsl:template match="Authentication">

<xsl:copy-of select="."></xsl:copy-of>

</xsl:template>

<!--

processing for the Message node

-->

<xsl:template match="Message">

<xsl:text>&lt;?xml version="1.0"&gt;&lt;/xsl:text&gt;</xsl:text>

<xsl:call-template name="tag">

<xsl:with-param name="elemnt" select="name()"></xsl:with-param>

<xsl:with-param name="mode" select="'open'"></xsl:with-param>

</xsl:call-template>

<xsl:apply-templates select="*|node()"></xsl:apply-templates>

<xsl:call-template name="tag">

<xsl:with-param name="elemnt" select="name()"></xsl:with-param>

<xsl:with-param name="mode" select="'close'"></xsl:with-param>

</xsl:call-template>

</xsl:template>

<xsl:template match="*|node()">

<xsl:call-template name="tag">

<xsl:with-param name="elemnt" select="name()"></xsl:with-param>

<xsl:with-param name="mode" select="'open'"></xsl:with-param>

<xsl:with-param name="value" select="text()"></xsl:with-param>

</xsl:call-template>

<xsl:call-template name="tag">

<xsl:with-param name="elemnt" select="name()"></xsl:with-param>

<xsl:with-param name="mode" select="'close'"></xsl:with-param>

</xsl:call-template>

</xsl:template>

<xsl:template name="tag">

<xsl:param name="elemnt"></xsl:param>

<xsl:param name="mode"></xsl:param>

<xsl:param name="value"></xsl:param>

<xsl:choose>

<xsl:when test="$mode = 'open'">

<xsl:text>&lt;</xsl:text>

</xsl:when>

<xsl:otherwise>

<xsl:text>&lt;/</xsl:text>

</xsl:otherwise>

</xsl:choose>

<xsl:value-of select="$elemnt"></xsl:value-of>

<xsl:text>&gt;</xsl:text>

<xsl:if test="(not($value = ''))">

<xsl:value-of select="$value"></xsl:value-of>

</xsl:if>

</xsl:template>

</xsl:stylesheet>

hope this helps, pls let me know

Former Member
0 Kudos

Hi Matias and Arvind,

I'm going to try you suggestions and I will let you know, at the mean time we are facing some problems with the server but as soon as I can implement it I will let you know.

Thanks a lot.

Former Member
0 Kudos

Hi Matias and Arvind,

Sorry for answering until now, but I was not able to work on it.

Well I solve it with a java mapping, so I am adding the Authentication message to the information msg on a java program. I cannot watch the message properly in the SXMB_MONI but if I can download the message and check if something is wrong.

Thanks you very much for the help

Points assigned

Former Member
0 Kudos
Former Member
0 Kudos

Hi Santosh,

Thanks for the links, do you think I can manage this in the mapping process?

Have you done this kind of structure before?

Thanks

Omar