on 12-05-2012 4:02 PM
Dear Folks,
Sorry to write lengthy message for this issue.
Scenario: File 2 File - No Mapping or Transformation required
Input file: Image file (.png file ie example: 12344.png)
Req: Just take the file from input folder and place into different target folder based on input file length
If file file length is 11 char...place in Target folder A
Else place file in Target folder B
Created one sender channel
, Receiver channelIssue:
Interface is correctly taking the file and placing into respective folder but real image data is not getting transmitted at all.
It is just creating file in target folder ie target file size 156KB
Input file size is 538383 KB
If I do not use mapping and give fixed path in receiver file channel, then data is getting transmitted.
Any inputs reg. this issue will be appreciated.
Do i need to go with Java mapping for this?
I have another design option using 2 Business service and 2 receiver channel also before that I want to know to trouble shoot this design issue.
Error message
Some time i get below error message in Moni and if i reprocess the message, then it goes sucessfully but image data is not getting properly
<Trace level="2" type="T">Call method execute of the application Java mapping com.sap.xi.tf._MM_I442_ImageMap_</Trace>
<Trace level="1" type="T">RuntimeException during appliction Java mapping com/sap/xi/tf/_MM_I442_ImageMap_</Trace>
<Trace level="1" type="T">com.sap.aii.utilxi.misc.api.BaseRuntimeException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) 89, 50, 4e(:main:, row:1, col:3) at com.sap.aii.mappingtool.tf3.Transformer.checkParserException(Transformer.java:187) at com.sap.aii.mappingtool.tf3.Transformer.start(Transformer.java:174) at com.sap.aii.mappingtool.tf3.AMappingProgram.execute(AMappingProgram.java:120) at com.sap.aii.ibrun.server.mapping.JavaMapping.executeStep(JavaMapping.java:64) at com.sap.aii.ibrun.server.mapping.Mapping.execute(Mapping.java:92) at com.sap.aii.ibrun.server.mapping.MappingHandler.run(MappingHandler.java:90) at
sender file channel settings:
Source directory: FTP path
File Name: *.*Advanced tab: ASMA: Checked ie Adapater sepecific Message attributes
File name, Directory checked
receiver file channel settings:
Target directory: *
File Name scheme: *.*
Advanced tab: ASMA: Checked
File name, Directory checked
Attached Message Mapping screen shot.
Target record node is not mapped to any thing.
Target Top Node MT_*** is mapped to UDF (This is just to divert the input folder and put into diffferent folder)
UDF:
AbstractTrace trace = container.getTrace();
try {
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey dckFile = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
DynamicConfigurationKey dckDirectory = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory");
String filename = conf.get(dckFile);
String directory = "";
String SystemID = null;
SystemID = System.getProperty("SAPSYSTEMNAME");
if (filename!=null)
{
if(filename.length() == 11)
{
if (SystemID.equals("DEV"))
directory = "\\\\xxxxx\INTERFACE\FOlderA\\";
if (SystemID.equals("QA"))
directory = "\\\\xxxxx\INTERFACE\FOlderA\\";
/*****Prod URL***/
if (SystemID.equals("PROD"))
directory = "\\\\xxxxx\INTERFACE\FOlderA\\";
}
else
{
if (SystemID.equals("DEV"))
directory = "\\\\xxxxx\INTERFACE\FOlderB\\";
if (SystemID.equals("QA"))
directory = "\\\\xxxxx\INTERFACE\FOlderB\\";
/*****Prod URL***/
if (SystemID.equals("PROD"))
directory = "\\\\xxxxx\INTERFACE\FOlderB\\";
}
}
conf.put(dckDirectory,directory);
}
catch (Exception e) {
trace.addDebugMessage("SET_FILENAME_FAILED");
}
return "";
..........
Thanks in advance for any help.
Regards,
Praba
Hi Praba,
Its better if you ask Basis team to move into JDK1.4, so that you can use 'ImageIO'. Otherwise check the API of "java.awt.image" to achieve this functionality.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Folks,
I could not attach message mapping screen shot..It is just 58KB Jpeg file
I get error while uploading the file in scn thread " The content type of this attachment is not allowed."
Any way It just have Data type Name and one element Record
Message Mapping : Target Message Type node (Top node mapped to UDF as i mentioned) and below element not yet all mapped.
Thanks
Praba
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I get error while uploading the file in scn thread " The content type of this attachment is not allowed."
You could use a program as PrtScr to make a photo, you will have the picture hoving, and later drag an drop to the forum.
XMLParser: No data allowed here: (hex) 89, 50, 4e(:main:, row:1, col:3) at
Your exception seems a problem with the XML generated by the sender. Have you checked in the error exception cases that the XML is really generated?
Regards.
Dear Iñaki Vila,
Thanks for your inputs. I used insert image option and it worked fine.
Here is Message mapping screen shot:
Here is general error message (last time mentioned error message from Trace)
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <!--
--> Request Message Mapping
</SAP:Error>
I was expecting full image payload but it just have below one.
<?xml version="1.0" encoding="UTF-8" ?>
Thanks
Praba
Hello,
I mean to say that I can not see sender payload as XML in Monit bec it is image file.
If i click to see the sender payload and it gives pop up to save the file.
Once i save it as jpeg or png file, I could see the image file thru browser IE.
The same thing I was expecting as payload in receiver..ie Technical routing. But I could see only above
payload in Moni.
There is no mapping transformation involved in this interface for input file.
Thanks in advance
regards,
Praba
Hi Ranga,
You have to use the following:
1.MessageTransformBean
2.PayloadSwapbean and respective parameters in the receiver CC.
Make sure send the data using Sender CC with ASMA and the same in the Receiver ASMA.
http://help.sap.com/saphelp_nw04/helpdata/en/57/0b2c4142aef623e10000000a155106/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/2e/bf37423cf7ab04e10000000a1550b0/frameset.htm
Please see this below one for clarity:
Regards,
Sreeni.
Hello Srini,
Thanks ..Let me try this payload as attachment in sender and receiver.
But I was thinking it should work with out attachment in normal way.
Created the Java mapping instead of UDF. If i test the same java mapping in different PI 7.1 0r 7.0 server, it is working.
I am testing in PI 7.0 (complete details of the PI version)
PI System: PI 7.0 (SAP EHP 2 for SAP NetWeaver 7.0) ABAP stack/
Software Build information of PSD - REPOSITORY
make.rel | NW702_06_REL |
SP-Number | 06 |
jdk.version | 1.3 |
latest.change | 130804 |
Java Mapping code
package com.test;
import java.util.Map;
import com.sap.aii.mapping.api.MappingTrace;
import com.sap.aii.mapping.api.StreamTransformation;
import com.sap.aii.mapping.api.StreamTransformationConstants;
import com.sap.aii.mapping.api.StreamTransformationException;
import java.awt.image.BufferedImage;
import java.io.*;
import java.util.Map;
import java.util.HashMap;
import javax.imageio.ImageIO;
import com.sap.aii.mapping.api.DynamicConfiguration;
import com.sap.aii.mapping.api.DynamicConfigurationKey;
//Start of class
public class DivertImage implements StreamTransformation
{
private Map param =null;
private MappingTrace trace;
public void setParameter(Map param)
{
this.param = param;
if (param == null)
{
this.param = new HashMap();
}
if (param != null)
{
Object o = param.get(StreamTransformationConstants.MAPPING_TRACE);
if (o != null && o instanceof MappingTrace)
{
trace = (MappingTrace) o;
}
}
}
public void execute(InputStream in, OutputStream out)throws StreamTransformationException
{
try
{
DynamicConfiguration conf = (DynamicConfiguration)param.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey dckFile = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
DynamicConfigurationKey dckDirectory = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory");
String filename = conf.get(dckFile);
String directory = "";
String SystemID = null;
SystemID = System.getProperty("SAPSYSTEMNAME");
if (filename!=null)
{
if(filename.length() == 11)
{
if (SystemID.equals("DEV"))
directory = "\\\\xxxxx\INTERFACE\FOlderA\\";
if (SystemID.equals("QA"))
directory = "\\\\xxxxx\INTERFACE\FOlderA\\";
/*****Prod URL***/
if (SystemID.equals("PROD"))
directory = "\\\\xxxxx\INTERFACE\FOlderA\\";
}
else
{
if (SystemID.equals("DEV"))
directory = "\\\\xxxxx\INTERFACE\FOlderB\\";
if (SystemID.equals("QA"))
directory = "\\\\xxxxx\INTERFACE\FOlderB\\";
/*****Prod URL***/
if (SystemID.equals("PROD"))
directory = "\\\\xxxxx\INTERFACE\FOlderB\\";
}
}
conf.put(dckDirectory,directory);
BufferedImage img;
img = ImageIO.read(in);
ImageIO.write(img, "PNG",out);
}//End Of Try
catch(Throwable th)
{
th.printStackTrace();
}//End of Catch
}//End of Method
}//End of class
Issue
Thanks
Praba
Hi Praba,
MTB and payloadswapbean module will not be that useful..
Prabaharan you can not use MTB as it is not a Plain2XML or XML2Plain conversion, the incoming file is a Image.
you can also not use the PayloadSwapBean as your incoming message contain only one main document (the main payload as image) no attachment is there so that you can swap the payload and attachment with each other. And more over you can not use this module as your scenario is a file to file not mail in the receiver side.
you can try by using the additional files feature of file adapter
now the best option would be to use custom adapter module if everything fails...
have you refreshed the CPA cache?
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.