on 07-28-2009 11:17 PM
Hi friends,
I have a RFC to SOAP scenario in XI. As a response message they have given a structure with single field in it. But when it is coming over, it has a complex structure, I need to break it to different fields in my internal table. The response I have is given below.
<Result><Response><FileID _Inserted="1" xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">1992143</FileID><AuthID xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="i4">195894</AuthID><MessageList _Inserted="1"><Message _Inserted="1" xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">Domain value is invalid for field FilePriority (Client Name), Priority Type (Cartus Name) . The value received was SFNR.</Message><Message _Inserted="1" xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">The Destination Location State/Province is invalid. The State/Province was deleted and appended to City/Town. The value was Chennai.</Message><Message _Inserted="1" xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">Received Authorized Initiator (Nambissan, Rajesh) is not an active contact for client/division, Default Initiator was used.</Message></MessageList></Response></Result>
From this I need to seperate the fileid, authid, messages seperately. Can anyone please suggest how I can do that.
Thanks in advance for your help.
Anjana.
Please use following xsl file for your mapping
<?xml version='1.0' ?>
<xsl:stylesheet version="1.0" xmlns:dt="urn:schemas-microsoft-com:datatypes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsd="http://www.w3.org/1999/XMLSchema/" xmlns:xsi="http://www.w3.org/1999/XMLSchema/instance/">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />
<xsl:template match="/">
<AuthID>
<xsl:copy-of select="dt:Result/Response/AuthID" />
</AuthID>
<FileID>
<xsl:copy-of select="dt:Result/Response/FileID" />
</FileID>
<Messages>
<xsl:copy-of select="dt:Result/Response/MessageList/Message" />
</Messages>
</xsl:template>
</xsl:stylesheet>
Edited by: Gabriel Sagaya Selvam on Jul 29, 2009 11:33 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anjana,
What you can do is ask for the dtd they are using to send the response. I mean not the soap response, with in the soap response and within the field they are using a dtd. So if you get that dtd then in response mapping use an xslt mapping with CDATA to break the payload which is in one field to the strcuture of the dtd. Then you can send to your RFC as required.
Regards,
---Satish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anjana,
Check the code given by henrique in this thread.
You need to do this in altova xml spy and save this as .xsl file and then zip it and then import into imported archives. Then you can use this as xsl mapping in your interface mappings.
Also if you want more information search in SDN for CDATA.
Regards,
---Satish
Hi,
I created a .xsl file using Altova MapForce with the result xml I got from the other system and xml created from my RFC.
I created a zip file using that .xsl and imported it in archives, and used it in Interface mapping. Now, it is not giving me any error but the mapping is not happening as I expected. I m getting some weird result.
The .xsl file is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:n2="http://tempuri.org/message/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns1="urn:sap-com:document:sap:rfc:functions" xmlns:dt="urn:schemas-microsoft-com:datatypes" exclude-result-prefixes="dt n2 xs xsi xsl" xmlns="urn:sap-com:document:sap:rfc:functions">
<xsl:namespace-alias stylesheet-prefix="n" result-prefix="#default"/>
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<ns1:Z_PA_SAP_TO_CENDANT.Response>
<xsl:attribute name="xsi:schemaLocation">
<xsl:value-of select="'urn:sap-com:document:sap:rfc:functions C:/DOCUME~1/asankara/Desktop/Z_PA_SAP_TO_CENDANT.xsd'"/>
</xsl:attribute>
<xsl:variable name="var1_instance" select="."/>
<IT_ERROR>
<item><xsl:for-each select="$var1_instance/n2:AuthorizationResponse/Result/Response/MessageList/Message">
<ERROR_DESC>
<xsl:value-of select="string(.)"/>
</ERROR_DESC>
</xsl:for-each> </item>
</IT_ERROR>
<IT_RESPONSE>
<item>
<xsl:for-each select="$var1_instance/n2:AuthorizationResponse">
<FILEID>
<xsl:value-of select="number(string(Result/Response/FileID))"/>
</FILEID>
</xsl:for-each>
<xsl:for-each select="$var1_instance/n2:AuthorizationResponse">
<AUTHID>
<xsl:value-of select="number(string(Result/Response/AuthID))"/>
</AUTHID>
</xsl:for-each>
</item>
</IT_RESPONSE>
</ns1:Z_PA_SAP_TO_CENDANT.Response>
</xsl:template>
</xsl:stylesheet>
Should I make any changes in the file that is created in Mapforce?Please help.
Thanks,
Anjana.
Anjana,
Open Notepad and copy this code and save it as .xsl file. Then zip it and upload it as imported archive. I tested this mapping adn it is working.
Note: I tested with your sample payload and it is working. For other payload test once again.
<?xml version='1.0' ?>
<xsl:stylesheet version="1.0" xmlns:dt="urn:schemas-microsoft-com:datatypes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsd="http://www.w3.org/1999/XMLSchema/" xmlns:xsi="http://www.w3.org/1999/XMLSchema/instance/">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />
<xsl:template match="/">
<AuthID>
<xsl:value-of select="//AuthID"/>
</AuthID>
<FileID>
<xsl:value-of select="//FileID" />
</FileID>
<Messages>
<xsl:value-of select="//Message" />
</Messages>
</xsl:template>
</xsl:stylesheet>
I tested with the payload:
<Result>
<Response>
<FileID _Inserted="1" xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">1992143</FileID>
<AuthID xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="i4">195894</AuthID>
<MessageList _Inserted="1">
<Message _Inserted="1" xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">Domain value is invalid for field FilePriority (Client Name), Priority Type (Cartus Name) . The value received was SFNR.</Message>
<Message _Inserted="1" xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">The Destination Location State/Province is invalid. The State/Province was deleted and appended to City/Town. The value was Chennai.</Message>
<Message _Inserted="1" xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">Received Authorized Initiator (Nambissan, Rajesh) is not an active contact for client/division, Default Initiator was used.</Message>
</MessageList>
</Response>
</Result>
Then I have the output as:
<?xml version="1.0" encoding="UTF-8"?>
<AuthID xmlns:dt="urn:schemas-microsoft-com:datatypes" xmlns:xsd="http://www.w3.org/1999/XMLSchema/" xmlns:xsi="http://www.w3.org/1999/XMLSchema/instance/">195894</AuthID>
<FileID xmlns:dt="urn:schemas-microsoft-com:datatypes" xmlns:xsd="http://www.w3.org/1999/XMLSchema/" xmlns:xsi="http://www.w3.org/1999/XMLSchema/instance/">1992143</FileID>
<Messages xmlns:dt="urn:schemas-microsoft-com:datatypes" xmlns:xsd="http://www.w3.org/1999/XMLSchema/" xmlns:xsi="http://www.w3.org/1999/XMLSchema/instance/">Domain value is invalid for field FilePriority (Client Name), Priority Type (Cartus Name) . The value received was SFNR.</Messages>
Regards,
---Satish
Hi Satish,
I don't know what I m doing wrong with this. But the response I m getting is
<?xml version="1.0" encoding="UTF-8" ?>
- <ns1:Z_PA_SAP_TO_CENDANT.Response xmlns:ns1="urn:sap-com:document:sap:rfc:functions" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:sap-com:document:sap:rfc:functions C:/DOCUME~1/asankara/Desktop/Z_PA_SAP_TO_CENDANT.xsd">
- <IT_ERROR xmlns="urn:sap-com:document:sap:rfc:functions">
<item />
</IT_ERROR>
- <IT_RESPONSE xmlns="urn:sap-com:document:sap:rfc:functions">
- <item>
<FILEID>NaN</FILEID>
<AUTHID>NaN</AUTHID>
</item>
</IT_RESPONSE>
</ns1:Z_PA_SAP_TO_CENDANT.Response>
whereas I m expecting a response with numeric values for FILEID and AUTHID. I m using the same file I sent you. Do you know where I might be doing wrong?Please help. Thanks a lot for your help!
Regards,
Anjana.
Hi,
I have done the xsl mapping and it is working in altova xmlspy, when I give the input as what I see in sxmb_moni.
The data I can see in moni is like this.
*<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>*
*- <!-- Call Adapter*
-->
*- <SOAPSDK1:AuthorizationResponse xmlns:SOAPSDK1="http://tempuri.org/message/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">*
*<Result><Response><FileID _Inserted="1" xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">1992449</FileID><AuthID xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="i4">196084</AuthID><MessageList _Inserted="1"><Message _Inserted="1" xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">The Destination Location State/Province is invalid. The State/Province was deleted and appended to City/Town. The value was Chennai.</Message><Message _Inserted="1" xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">Received Authorized Initiator (Nambissan, Rajesh) is not an active contact for client/division, Default Initiator was used.</Message></MessageList></Response></Result>*
*</SOAPSDK1:AuthorizationResponse>*
But when I download the xml file from moni, and take the source code of it, it looks like this:
*<?xml version="1.0" encoding="UTF-8" standalone="yes" ?><!-- Call Adapter --> <SOAPSDK1:AuthorizationResponse xmlns:SOAPSDK1='http://tempuri.org/message/' xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'><Result><Response><FileID _Inserted="1" xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">1992449</FileID><AuthID xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="i4">196084</AuthID><MessageList _Inserted="1"><Message _Inserted="1" xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">The Destination Location State/Province is invalid. The State/Province was deleted and appended to City/Town. The value was Chennai.</Message><Message _Inserted="1" xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">Received Authorized Initiator (Nambissan, Rajesh) is not an active contact for client/division, Default Initiator was used.</Message></MessageList></Response></Result></SOAPSDK1:AuthorizationResponse>*
I tried testing my mapping in altova xmlspy using the file I downloaded from moni(not the copied one) and it is giving me blank output. So I doubt its about the format of the data I m getting from the other system. It has bad characters like '#','&' etc.whereas I don't see data like this for other interfaces.
Can you please help me identify the issue and solve this.
Thanks in advance for any help!
Anjana.
User | Count |
---|---|
81 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.