on 12-31-2010 3:01 PM
Hi dont want to use an FCC. I have written an JAVA Mapping to convert a flat file to XML.
But in Interface Mapping How i can test this?
/*This java mapping will give same output as input payload */
package com.mapping;
import java.io.InputStream;
import java.io.OutputStream;
import com.sap.aii.mapping.api.AbstractTransformation;
import com.sap.aii.mapping.api.StreamTransformationException;
import com.sap.aii.mapping.api.TransformationInput;
import com.sap.aii.mapping.api.TransformationOutput;
public class Java_Mapping extends AbstractTransformation {
public void transform(TransformationInput transformationInput,
TransformationOutput transformationOutput)
throws StreamTransformationException {
try {
InputStream inputstream = transformationInput.getInputPayload()
.getInputStream();
OutputStream outputstream = transformationOutput.getOutputPayload()
.getOutputStream();
byte[] b = new byte[inputstream.available()];
inputstream.read(b);
String strContent = new String(b);
outputstream.write(strContent.getBytes());
} catch (Exception exception) {
exception.printStackTrace();
}
}
}
Edited by: Raghu Vamsee on Jan 5, 2011 3:46 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Raghu,
Thanks for clearing my misconception. I will have to work on it to understand better.
@Stefan,
I understand the original question did not mean "How to do Java mapping without XML as input?". However, considering the fact that forums are meant for discussion it is good to clear the misconceptions. Thanks for your input as well.
Thanks & Regards,
Anand Patil
Edited by: Anand Patil on Jan 6, 2011 10:09 PM
Guysu2026 discussion is going in wrong direction.
It is misconception that Operational mapping can only take XML as input and give only XML as output.
Hi Debashish Roy,
Operation mapping can take any set of characters and give out any set of characters. You can even send flat files, XML files, photos, movie clips....
Note:
Graphical, XSLT mapping, DOM and SAX parser(SAX can give non XML as output) u2013 input and output are always XML.
Java, ABAP mapping u2013 input and output can be anything.
In operation mapping click on u201Csource text viewu201D icon and paste you test data (flat file) then click on test button.
Check out this by yourself,
Use below java mapping code and in operation mapping click on u201Csource text viewu201D icon and type u201Ctest data 123@u201D (this not XML) then click on test button. Output will be "test data 123@u201D. Now you can extend below java mapping according to your requirement.
Regards,
Raghu Vamsee
Edited by: Raghu Vamsee on Jan 6, 2011 1:51 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Test your Java mapping with an external tool first:
/people/stefan.grube/blog/2006/10/23/testing-and-debugging-java-mapping-in-developer-studio
Java mapping does not require XML, only graphical mapping and XSLT require XML.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
When you do not want to use FCC and want to convert a non-xml format to XML then you will have to work at Adapter level and not at Java Mapping. Java mapping requires input in XML format and outputs in XML format.
If you are looking for something else then request you to reframe your question.
Regards,
Anand Patil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Source file needs to be in xml format for testing. So you cannot test it in ESR/IR tool.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.