on 10-31-2008 6:01 AM
Hi all,
I have a file to HTTp scenario.Input is a txt file.Can i extract whole content of the txt file to single field in source, Map this field into a single field in target and post it into a target URl?
Hi Anoop,
You can do this using XSLT mapping.
XSLT source:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:p2="namespace">
<xsl:template match="/">
<AnoopTargetFiled>
<xsl:text disable-output-escaping="yes"><![CDATA[]]></xsl:text>
<xsl:copy-of select="/"/>
<xsl:text disable-output-escaping="yes"><![CDATA[]]></xsl:text>
<xsl:text disable-output-escaping="yes"><![CDATA[>]]></xsl:text>
</AnoopTargetFiled>
</xsl:template>
</xsl:stylesheet>
1.Copy the above source is txtpad and save it as source.xsl and zip it
2.import the Zipped xsl into your Imported archives
3.source DT can be anything,Make your taget DT with one element and name the element as
AnoopTargetFiled and give your namespace in xsl.
4.In Terface Mapping select souce and target INterfaces >read interfaces>select XSL as you mapping program and select you xsl there.
5.Finish.you will get whole XML into your single element in target.
Thanks
Prabhakar
Edited by: VenkataPrabhakar Teegavarapu on Nov 21, 2008 10:19 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you want to use the XI then develop the file to file scenario and pick up the file as it is and without any content conversion transfer the file to the destination.
For file to file scenario, refer to this weblog.
For the same file name as source refer to following weblog.
Till SP14,
After SP14, you can use following.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi....
Once check this below wiki. It might be helpful to you.
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/xi/readInputTextFileasaSingle+Field
Regards,
Leela
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If you know the number of fileds at design time, you can concat all the fields and pass it to one target field.
If you r using PI7.1, you can do it easily using Variable in message mapping
Regards,
Sreenivas.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can use an adapter module to create a XML structure like
<Record >
<Row>
<Field>Entire ..Content<Field>
</Row>
</Record>
this sequence will then be passed to your similar looking source message.
Or else if your file contains new line as the last character (or any other like * ! # etc)
then you can do FCC to fetch the entire content in single row
Field.endSeparator = 'nl'
Edited by: Progirl Progirl on Oct 31, 2008 1:41 PM
Edited by: Progirl Progirl on Oct 31, 2008 1:42 PM
Hi Santhosh,
Thanks for that but now the problem is i dont have NWDS(netweaver development studio).so let me get it installed and then i have one more requirement along with this.
My output payload should be as shown below.
<?xml version="1.0" encoding="UTF-8"?>
- <MT_TRG xmlns:ns="urn:Test_File_to_File">
<filename>input.txt</filename>
<stringinp>This is a test scenariothat is created to answer a FAQ in the SDN Forum.</stringinp>
</MT_Trg>
ie I should be also able to include my source file as a target field as shown in payload.What should i do for that?
Hi,
If we want to get the Input file name Details into Target Payload message..
Ex:
I/P File name is :::::231004.xml
O/P File will look like
<?xml version="1.0" encoding="UTF-8" ?>
- <ns0:MT_target xmlns:ns0="http://test.test.com">
- <Header>
<Name_1>giri</Name_1>
<File_Name_1>231004.xml </File_Name_1>
</Header>
</ns0:MT_target>
http://img240.imageshack.us/my.php?image=udfib4.jpg
You should capture the Source File name into Target Message.
1)Write One UDF & Map Like Constant(u201Cu201D)---UDF----FileName_1
2)Check the ASMA Parameters in Sender Adapter Alone
3)No need to check the check box ASMA in the receiver side
UDF Code:
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
//for getting filename
DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
/*similarly for getting Directory,filetype, filesize you need to specify in the above code instead of filename */
String FileName = conf.get(key1);
return FileName;
Regards
Seshagiri
Hi Seshagiri,
I have a text file at sender side.it is not having a definite structure.I want its filename and also its content as fields in target payload.So I want filename and then in another single field below filename entire content of a file(this is because i cant alter with the sender side txt file).Is it possible.Otherwise is there any option that in the header of the target receiver HTTP adapter i dynamically get the Filename of the source file without doing anything to the source file?
Hi Anoop,
While creating your class you need to import this interface. Also in the menu Project-> Properties-> Java build path-> Libraries, you need to import the following jar files as External Jars:
aii_map_api.jar
aii_msg_runtime.jar
aii_proxy_xirt.jar
aii_utilxi_misc.jar
Thanks and Regards,
Sanjeev.Project
Hi all,
I got the package and the code compiled fine.But When i tried implementing as Santhosh has said I am getting an error as below.Can you tell me how to rectify that?
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <!--
Request Message Mapping
-->
- <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
<SAP:Category>Application</SAP:Category>
<SAP:Code area="MAPPING">LINKAGE_ERROR</SAP:Code>
<SAP:P1>xmlpayload</SAP:P1>
<SAP:P2>test:urn:test_file_to_file</SAP:P2>
<SAP:P3>d4224370-e154-11dc-94cd-c763ac1383c5</SAP:P3>
<SAP:P4>-1</SAP:P4>
<SAP:AdditionalText />
<SAP:ApplicationFaultMessage namespace="" />
<SAP:Stack>Incompatible class versions (linkage error)</SAP:Stack>
<SAP:Retry>M</SAP:Retry>
</SAP:Error>
How can i rectify this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.