cancel
Showing results for 
Search instead for 
Did you mean: 

Conversion of source XML structure to single string using PI 7.1

Former Member
0 Kudos

Hi Experts,

My current requirement is to pass the source structure xml in a single string in target using PI 7.1.

.I have already read blog by Michal http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/2620.But [original link is broken] [original link is broken] [original link is broken],I am looking for more clarification.

Has anyone worked on this kind of requirement?

Any kind of help is appreciated.

Thanks

Nidhi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Abhishek & Amit,

Thanks a lot for quick response.

I have already created 2 mappings & 1 operation mapping in which I am referring to those 2 message mappings mentioned by you.

But,while I am testing my operation mapping,it is throwing exception.

Runtime Exception when executing application mapping program com/sap/xi/tf/_MM_XSLT1_; Details: com.sap.aii.mappingtool.tf7.IllegalInstanceException; Cannot create target element /ns0:MT_XSLT_R. Values missing in queue context. Target XSD requires a value for this element, but the target-field mapping does not create one. Check whether the XML instance is valid for the source XSD, and whether the target-field mapping fulfils the requirement of the target XSD

Request you to elaborate a bit.

Thanks

Nidhi

Former Member
0 Kudos

Hi,

This signifies, that u r not passing values for some of the fields which is required.

Firstly chk ur "first graphical mapping" and if correct, then put the same set of payload under OM test tab.

Thanks

Amit

Answers (7)

Answers (7)

Former Member
0 Kudos

Thanks All.....my mapping is working fine using the code above.

Former Member
0 Kudos

Thanks a lot for quick response.

I am following michal's blog to do XML to string conversion .In XSLT mapping I am using following code.

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

This code is working fine when I am doing one is to one mapping.But,I am facing problem,if I have to apply some mapping logic on source structure & then convert the XML into string.

Any idea,how can I move forward.Any help is appreciated.

Thanks

Nidhi

former_member200962
Active Contributor
0 Kudos

Include two mappings in Interface/ Operation Mapping....first will be the one which does modification on source....second will be the one which gives you o/p as a string.

Regards,

Abhishek.

Former Member
0 Kudos

Hi,

As suggested in the blog(which u r referring), you can create one more mapping(make it graphical one) apply ur mapping logic and then u can have that XSL mapping in which u can copy the entire structure into a xml string.

FLOW:

1) Graphical mapping( source structure - middle structure)

2) xsl mapping.(middle structure - target structure)

Thnaks

Amit

justin_santhanam
Active Contributor
0 Kudos

Nidhi,

I have given an example, based on the below example you manipulate the data as per ur reqmt.

http://www.flickr.com/photos/8764045@N06/4462432588/sizes/l/

http://www.flickr.com/photos/8764045@N06/4462432598/sizes/o/

Thanks!

nipun_shedhani4
Explorer
0 Kudos

Your Approach helped our scenario, thanks for sharing the code.

Regards,

Nipun

Former Member
0 Kudos

Hi,

Using the return as a XML,option in Graphical mapping will give u only the the element/node choosen.

As discussed above by all, if u have structure as very small u can concatenate.. but it's not advisable.

U can do it using a single java class file.

In java code u can return the whole source XML structure as a single element, which u can use for target mapping.

For the java code, just search in forums/blogs, u will get lot of articles.

If still nt solved, do post

Babu.

Former Member
0 Kudos

Hi Nidhi,

In the source mapping one option is there (return XML structure) select that and try.

otherwise you can concatenate all the sender side elements and return this ressult value to target.

If you want more info then give your source structure with occurances.

Regards

Ramesh

former_member200962
Active Contributor
0 Kudos

What clarification are you exactly looking for.....there are two options to do your requirement using a CDATA element in XSLT (you know it) or use a JAVA mapping.....code available in Wiki section.....if you dont find java suitable (simple) go ahead with XSLT.

Regards,

Abhishek.

Former Member
0 Kudos

Hi,

Plz chk this:

Thanks

Amit

Former Member
0 Kudos

Hi

In my mapping two nodes are there , that are header and detail the whole header data should be in xml tags.

How to do