Java mappping
Hello,
Could someone send me aii_map_api.jar.
Thanks,
Prasad
Hi,
No need its on our XI Server system, therse jar files are useful to perform the java mapping.
In ur XI Server go to Drive: \usr\sap\<SID>\DVEBMGS00\j2ee\cluster\server0\apps\sap.com\com.sap.xi.services
and you will get aii_map_api.jar file.
If you unable to get this jar file then go to this site
http://detroubulator.googlecode.com/svn-history/r32/trunk/docs/FAQ.html
Edited by: Venkat on May 5, 2008 10:02 PM
Edited by: Venkat on May 5, 2008 10:03 PM
Similar Messages
-
Sample JAVA program: generate PDF from xsf:fo File
Hi everybody,
we already have an xsl that converts an xml into an xsl:fo file.
I am now looking for a very simple sample that converts this xsl:fo into a PDF.
It would be profitable if the java-sample would read the xsl:fo file as an input-stream.
Thanks
Regards
MarioHi,
as I am not a JAVA expert.
Do you know how to reuse the generated PDF in the java sample not as a fileOutputStream.
I need to attach the generated PDF to a mail-xml-document.
(I know haw to generate a mail structure in java-mappping)
What kind of object is the generated PDF within the java?
Any ideas
Regards Mario -
Changing the file name dynamicallly in file Adapter
Hi i want to change the file name directly from Java Mapping in the file adapter
for this i have written this code
DynamicConfiguration dynamicConfiguration = (DynamicConfiguration)map.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey keyFile = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
DynamicConfigurationKey keyDir = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory");
dynamicConfiguration.put(keyFile,fileName);
dynamicConfiguration.put(keyDir,outputpath);
but it gives a null pointer exception at dynamicConfiguration.put(keyFile,fileName);
please suggest.
regards
Nilesh Taunk.Hi Nilesh,
If your requirement is to create , the file name dynamically for your receiver file adapter, you can do so using your <b>FILE ADAPTER CONFIGURATION</b> itself, and need not go for any JAVA Mappping / Java Code at all.
The dynamic filename generation concept is as follows.
In your filename field in the receiver file adapter, just give a variable with <b>%</b> symbols. (eg: %file% ).
Now, under the option <b>Variable Name Substitution</b>, you can give how the value has to be created.
<b>It can be your interface name, sender service name, etc or it can be some value dynamically from your payload.</b>
For the former, your give
<b>message:interface_name</b> ,etc
and for the payload part you give,
<b>Payload: "your element root which u wanna acecss"</b>
Just check this link out,
http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm
And read the contents under variable substitution and it will help you understand the concepts better.
Also, in your FILE Adapter under the option FILE CREATION MODE, you have options like,
1.Add Counter,
2. Append
3. Create
4. Add Time Stamp
If you have any clarifications on this approach, do get back.
Regards,
Bhavesh -
AAE- Sender ABAP Proxy to SOAP - Payload not reaching PI 7.10 SP4
Hi friends,
I am developeing interface from Solman to PI to 3rd party.
I configured the interface using ABAP stack and it worked fine. Then i changed the RFC destination used in SXMB_ADM to point to adapter engine so that i can use AAE.
I configured SOAP adapter. I wonder there is no option to select BE, EO or EOIO in PI7.30 when we select XI protocol.
I can see my payload in SXMB_MONI is solution manager but the payload is not reaching SAP PI although i am receiving the message and can see error also in Adapter.
Does we need to do anything different in PI configuration to achieve it ?
Regards
InderHi Baskar,
I am on 7.30 so it should work. I created another interface and it works fine.
The only difference between my interface which is not working is "Java Mappping" and also i have custom adapter module on receiver channel.
I think the reason for failure is custom Java adapter as it is called before the mapping is executed(In AAE mapping is executed by receiver adapter chain and i configured module before that)
I think i need to redesign my adapter module to manipulate input payload of mapping rather than output payload.
Regards
Inder -
IDOC number should be passed with Time stamp
Here the scenario is IDOC to File.
Currently I am getting the date and time stamp but I want to pass the IDOC number after the torr_asn_20080522-010137-257.txt
torr_asn_?_20080522-010137-257.txt
Here in place of question mark I want to pass the IDOC number and how to pass
Let me know quickly as the issue is very urgent.
Points will be awarded.Hi Arjya,
If your requirement is to create , the file name dynamically for your receiver file adapter, you can do so using your FILE ADAPTER CONFIGURATION itself, and need not go for any JAVA Mappping / Java Code at all.
*The dynamic filename generation concept is as follows.8
In your filename field in the receiver file adapter, just give a variable with % symbols. (eg: %file% ).
Now, under the option Variable Name Substitution, you can give how the value has to be created.
It can be your interface name, sender service name, etc or it can be some value dynamically from your payload.
For the former, your give
message:interface_name ,etc
and for the payload part you give,
Payload: "your element root which u wanna acecss"
Just check this link out,
http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm
And read the contents under variable substitution and it will help you understand the concepts better.
Also, in your FILE Adapter under the option FILE CREATION MODE, you have options like,
1.Add Counter,
2. Append
3. Create
4. Add Time Stamp
Reward points if this helps
Regards
Pragathi. -
Rebuild a XML content inside a XI message
Hello all,
we struck following point during our testing of "JDBC->RFC interface".
We have a JDBC adapter which reads records in certain database/table matching the condition. The SQL statement is e.g. like this:
select event, datetime, content from tracetab where status='X'
Understandably it fills a XI document let's say with "document name" = 'DBResultset_MSG' with proper tructure "<row><event /><datetime /><content /></row>.
So far so goot. The whole point is that the column CONTENT in the database record contains a "XML Document"
So when the JDBC adapter sends the "MainDocument" into XI, it looks like this:
<?xml version="1.0" encoding="utf-8"?>
<ns:DBResultset_MSG xmlns:ns="http://appg.com/CEZ_PP2SAP">
<row>
<EVENT>ZNM.export_row</EVENT>
<DATETIME>20050729111500</DATETIME>
<CONTENT><ZNM><NESS_MRDTL_V rownum="1"><MATERIAL_REQUEST>00201228</MATERIAL_REQUEST><CATALOG_ID>0000208130</CATALOG_ID><Q_LEVEL>0</Q_LEVEL><NON_CATALOG_KEY> </NON_CATALOG_KEY><FACILITY>HS </FACILITY><MOVEMENT_TYPE>261</MOVEMENT_TYPE><QTY_MTL_RQST>1</QTY_MTL_RQST><WORK_ORDER_NBR>4000195</WORK_ORDER_NBR><STORAGE>CZ01</STORAGE></NESS_MRDTL_V><NUM_OF_ROWS>1</NUM_OF_ROWS></ZNM></CONTENT>
</row>
</ns:DBResultset_MSG>
As you can see, the JDBC adapter converts characters '<i><</i>' and '<i>></i>' ... which is probably ok, otherwise the XI message wouldn't make sence.
Our question is, which procedure would you suggest to "rebuild" the XML message to be mapped afterwards to RFC according to needs.
Our idea is to define same structure as the XML's structure into XI MessageType and remap the "demaged" content into it. The point is how ? We think that Java mapping is the only solution here.
What would you say ???
Thanks all in advance.
Regards TomasYou can write a user function and appropriately use the java appropriate string functions and map it to the RFC interface.You can split by the column names.It is relatively easy than going for java mappping.
Ex:If you are mapping to material number of RFC messagetype.
1.Define user function which searches for the <MATERIAL_NUMBER> and reads the value until it encounters </MATERIAL_NUMBER>.
It should return the value inside the material number tag.
Simple java function will be able to achieve this.
2.Once you can acheieve this for one field,replicating it for other fields will be easy.
We can do the functionality using one simple user defined mapping. -
Why my cutomize role mapper throws java.lang.ClassCastException: $Proxy67
Hello all,
I customize the role mapper as follows is my MDF content
<MBeanType
Name = "TestRoleMapper"
DisplayName = "TestRoleMapper"
Package = "test.pkg.roles"
Extends = "weblogic.management.security.authorization.RoleMapper"
Implements = "weblogic.management.security.authorization.RoleReader"
PersistPolicy = "OnUpdate"
I implements the method "listRolesForResource", this method declared to return a string array.
When I return the role name array then Weblogic throws java.lang.ClassCastException: $Proxy67
Error snapshot
http://antonov0318.googlepages.com/error.jpg
Would I miss some interface ?
Would somebody know how to solve it?
Please let me know , Please....Thank you very much.
Edited by: user6273860 on 2008/10/25 上午 12:00It looks like you're just taking random methods,
calling them incorrectly, and expecting them to
work.
What do you think this will do?
* Construct {@link java.lang.Object} array of keys from {@link java.util.Hashtable}
* @param h {@link java.util.Hashtable}
* @return array {@link java.lang.String}
* @throws java.lang.IndexOutOfBoundsException Exception thrown if initial {@link java.lang.Object} array paramater cannot be indexed
public static Object[] arrayKeys(Hashtable<Object, Object> h) throws IndexOutOfBoundsException {
return h.keySet().toArray();
}>
ArrayFunctionality.arrayKeys(attrs)(new
String[attrs.size()]);What's arrayKeys? And what do you think
method(args) (some other stuff) ; will
do?
Somebody else showed you what to do earlier, but they
had a typo. You need to pass an array of the
appropriate type to toArray:
String[] stringArr =
(String[])theList.toArray(someStringArray);Read the docs for that method so you understand how
it works. Just just blindly copy/paste.The API docs for toArray() for java.util.Set interface takes no parameters, I can't expect to know you can override it -
XSLT Java Enahancement Mappping
Hi All
I would like to know the clear steps of implementing the mapping through "XSLT Java Enhancement", FYI i was working with Graphical mapping itself, but i want to implement through XSLT Java Enahancement mapping.
More Thankful, if any once can help me out.
Regards
ShailajaHi Shailaja,
Please go through
<a href="/people/pooja.pandey/blog/2005/06/27/xslt-mapping-with-java-enhancement-for-beginners Mapping With JAVA Enhancement ( For Beginners)</a> which we will clearly help you understand your need.
Also go thru these links and they will also surely help you in all ways:
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/55/7ef3003fc411d6b1f700508b5d5211/content.htm">XSLT Mapping with Java Enhancement</a>
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/73/f61eea1741453eb8f794e150067930/content.htm">XSLT Mapping</a>
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/4c/b2ad3de2d76b3be10000000a114084/content.htm">Imported Archives (XSLT/Java)</a>
Regards,
abhy
Note: please do award points for helpful answers.
Message was edited by: Abhy Thomas -
Should I use Process/Mapper or Pure Java Code for XI Adapter?
Hi Friends,
I'm developing a XI Adapter which including sending http request and also data transform, I prefer to implement all the functions by Java Code.
But In NetWeaver XI Server, I find there are tools for creating process and mappers, they also can implement the same functions as Java Code.
So what's your consideration on implementing a function by process or Java code?
Thanks in advance.
Best Regards,
JasonHello Jason.
It is a huge job to create your on adapter and I would recommend you to use the default installed adapters whenever possible. Included in the default installed adapters are to name a few; HTTP, FTP, File, SOAP, RFC and IDOC.
Which kind of messages are you transferring with XI? If it's simple XML structures I would recommend you to use Graphical Message Mappings or XSL. If your structures are a bit more complex or if your are transferring byte-structure files I would recommend you to use Java Mappings.
Best Regards,
Jacob -
Create custom java function in graphical mapper for Global use?
I created a java function (remove leading zeros in string field) in the graphical tool.
The problem custom function is at local map level only.
How can i make custom java function global for use in all SWC/namespaces/interfaces.
Can this be done with XI 3.0 SP 13? Any suggestions on how to do this.
Many Thanks,HI William
Check out this link...
http://help.sap.com/saphelp_erp2005/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/frameset.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/22/e127f28b572243b4324879c6bf05a0/frameset.htm
Cheers:-)
Mithlesh -
Java heap error when using compc
I have a large project, 100's of source files that I'm trying to compile into a swc. In Flash Builder 4 it works fine. When I try to do it in compc I get a Java heap space error. I've scoured google for help and haven't found anything useful. Does anyone on here know much about ant or compc? What am I doing wrong?
Here's the code that I use to compile. It gets all the files for me so I don't have to type them in one at a time. That part seems to work, it's when it calls compc that ant hangs for about 30 seconds then quits with a Java heap space error.
<target name="-resolve-shared-classes">
<path id="list_1">
<fileset dir="${basedir}\${shared.source}\">
<include name="com\**" />
<include name="edu\**" />
</fileset>
</path>
<pathconvert property="project_classes_property" pathsep=" " dirsep="." refid="list_1">
<map from="${basedir}\${shared.source}" to="" />
<mapper>
<chainedmapper>
<globmapper from="*.as" to="*" />
</chainedmapper>
<chainedmapper>
<globmapper from="*.mxml" to="*" />
</chainedmapper>
</mapper>
</pathconvert>
<echo>${project_classes_property}</echo>
</target>
<target name="compileShared" depends="-resolve-shared-classes">
<compc fork="true" output="${basedir}\${shared.bin}${shared.name}.swc"
include-classes="${project_classes_property}">
<load-config filename="${basedir}\${shared.source}sharedConfig"/>
<source-path path-element="${basedir}\${shared.source}"/>
</compc>
</target>I have a large project, 100's of source files that I'm trying to compile into a swc. In Flash Builder 4 it works fine. When I try to do it in compc I get a Java heap space error. I've scoured google for help and haven't found anything useful. Does anyone on here know much about ant or compc? What am I doing wrong?
Here's the code that I use to compile. It gets all the files for me so I don't have to type them in one at a time. That part seems to work, it's when it calls compc that ant hangs for about 30 seconds then quits with a Java heap space error.
<target name="-resolve-shared-classes">
<path id="list_1">
<fileset dir="${basedir}\${shared.source}\">
<include name="com\**" />
<include name="edu\**" />
</fileset>
</path>
<pathconvert property="project_classes_property" pathsep=" " dirsep="." refid="list_1">
<map from="${basedir}\${shared.source}" to="" />
<mapper>
<chainedmapper>
<globmapper from="*.as" to="*" />
</chainedmapper>
<chainedmapper>
<globmapper from="*.mxml" to="*" />
</chainedmapper>
</mapper>
</pathconvert>
<echo>${project_classes_property}</echo>
</target>
<target name="compileShared" depends="-resolve-shared-classes">
<compc fork="true" output="${basedir}\${shared.bin}${shared.name}.swc"
include-classes="${project_classes_property}">
<load-config filename="${basedir}\${shared.source}sharedConfig"/>
<source-path path-element="${basedir}\${shared.source}"/>
</compc>
</target> -
Creating Sales Order using Web Dynpro for java
Hi SDN,
I am new to Web Dynpro for java. I have developed an application for creating a sales order using adaptive RFC Model using BAPI. It's working fine when i create a single order. I wanna create SO with more than one line item. I have used the Table UI Element to do so. But i could not able to enter the 2nd item details. Please suggest me how to pass more than one line item from the Table UI element.
Thanks in advance.
Regards,
BashaHi Basha,
Do you need to display the header items and detailed items?
If the BAPI Contains Output values in R/3 side.
I mean to say if BAPI contains 4 line items.u can get thru wdjava the followinf way.
1. Create webdynpro application.
2.Import the model.
3.Create Customcontroller and model binding .
4. Write the execute method in controller.
BAPI b = new BAPI();
WdContext.node<BAPI>.bind(b);
give inputs for BAPI
b.setname(" ");
b.setno("");
wdContext.currentBAPI().modelObejet().execute();
wdContext.node<output>.invalidate(); in try catch
5. create view or when u give the dynpro application its
in the add custom to view and drag BAPI custom to view .
6.Crete UI for ur table thru insertTemplate table directly mapp the output values.
7. deploy and run
U can get the out line items .
Or any thing else post ur requirement.
Thanks
Lohi -
Hi Experts,
as part of my diploma-thesis I have to write a java SAX-Mapping, which mapps the following incoming message:
mt_MappingOUT
set
set_Element_01
set_Element_02
set_Element_03
set_Element_10
to the following outgoinig message:
mt_MappingIN
TABLE
item
item_FIELD_01
item_FIELD_10
I develped the following code, which unfortunately results in "XML is not well defined" while testing. Unfortunately I cannot find the problem. So I hope someone of you can have a look an will have an idea.
Created on 20.12.2007
@author Sebastian Geissler
import java.io.FileInputStream;
import java.io.FileOutputStream;
import com.sap.aii.mapping.api.*;
import java.io.*;
import java.util.Map; import javax.xml.parsers.*;
import org.xml.sax.; import org.xml.sax.helpers.;
public class SETtoITEMjavaSAX extends DefaultHandler implements StreamTransformation
private Map map;
private OutputStream out;
public void setParameter (Map param)
map = param;
public void execute (InputStream in, OutputStream out)
throws com.sap.aii.mapping.api.StreamTransformationException
DefaultHandler handler = this;
SAXParserFactory factory = SAXParserFactory.newInstance();
try
SAXParser saxParser = factory.newSAXParser();
this.out = out; saxParser.parse(in, handler);
catch (Throwable t)
t.printStackTrace();
private void write (String s) throws SAXException
try
out.write(s.getBytes()); out.flush();
catch (IOException e)
throw new SAXException("I/O error", e);
public void startDocument () throws SAXException
write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
write("<ns0:mt_MappingIn xmlns:ns0=\"urn:agrp:xi:geissseb\"><TABLE>");
public void endDocument () throws SAXException
write("</TABLE></ns0:mt_MappingIn>");
try { out.flush();
catch (IOException e) {
throw new SAXException("I/O error", e);
public void startElement (String namespaceURI, String sName, String qName, Attributes attrs)
throws SAXException
String eName = sName;
if ("".equals(eName))
eName = qName;
if(eName.equals("set"))
write("<item>");
if(eName.substring(0,6).equals("set_E"))
write("<item_FIELD"eName.substring(10,13)">");
public void endElement (String namespaceURI, String sName, String qName) throws SAXException
String eName = sName;
if ("".equals(eName))
eName = qName;
if(eName.equals("set"))
write("</item>");
if(eName.substring(0,6).equals("set_E"))
write("</item_FIELD"eName.substring(10,13)">");
public void characters (char buf[], int offset, int len)
throws SAXException {
String s = new String(buf, offset, len);
write (s);
Thank you,
SebastianHi Ravi, hi Raman,
thanks so far... I did some changes in my code, but I am still having the same problem... down there you will find my new code and the source message.
there is my new code:
private Map map;
private OutputStream out;
public void setParameter (Map param)
map = param;
public void execute (InputStream in, OutputStream out)
throws com.sap.aii.mapping.api.StreamTransformationException
DefaultHandler handler = this;
SAXParserFactory factory = SAXParserFactory.newInstance();
try
SAXParser saxParser = factory.newSAXParser();
this.out = out; saxParser.parse(in, handler);
catch (Throwable t)
t.printStackTrace();
private void write (String s) throws SAXException{
try{
out.write(s.getBytes()); out.flush();
catch (IOException e){
throw new SAXException("I/O error", e);
public void startDocument () throws SAXException{
write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
write("<ns0:mt_mappingOUT xmlns:ns0=\"urn:agrp:xi:geissseb\"><TABLE>");
public void endDocument () throws SAXException {
write("</TABLE></ns0:mt_mappingOUT>");
try { out.flush();
catch (IOException e) {
throw new SAXException("I/O error", e);
public void startElement (String namespaceURI, String sName, String qName, Attributes attrs)
throws SAXException {
String eName = sName;
if ("".equals(eName))
eName = qName;
if(eName.equals("mtset"))
write("<item>");
if(eName.substring(0,2).equals("se"))
write("<Item_FIELD_"eName.substring(13,14)">");
public void endElement (String namespaceURI, String sName, String qName) throws SAXException {
String eName = sName;
if ("".equals(eName))
eName = qName;
if(eName.equals("mtset"))
write("</item>");
if(eName.substring(0,2).equals("se"))
write("</item_FIELD_"eName.substring(13,14)">");
public void characters (char buf[], int offset, int len)
throws SAXException {
String s = new String(buf, offset, len);
write (s);
and there is the source message:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:agrp:xi:geissseb" targetNamespace="urn:agrp:xi:geissseb">
<xsd:element name="mt_MappingOut" type="dt_MappingOut" />
<xsd:complexType name="dt_MappingOut">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
4c79fbb0bde711dcae43001a4b0af224
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="set">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
0b366510aeda11dcb3bb00174205b856
</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="set_ELEMENT_01" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
0b366511aeda11dcaf2600174205b856
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="set_ELEMENT_02" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
0b366512aeda11dc84d400174205b856
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="set_ELEMENT_03" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
0b366513aeda11dcbcab00174205b856
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="set_ELEMENT_04" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
0b366514aeda11dc96a300174205b856
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="set_ELEMENT_05" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
0b366515aeda11dca77700174205b856
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="set_ELEMENT_06" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
0b366516aeda11dc8f7d00174205b856
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="set_ELEMENT_07" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
0b366517aeda11dcc24b00174205b856
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="set_ELEMENT_08" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
0b366518aeda11dc92cd00174205b856
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="set_ELEMENT_09" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
0b366519aeda11dcc9b100174205b856
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="set_ELEMENT_10" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
0b36651aaeda11dcc5a700174205b856
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
I really hope you can help me there..
Thanks in advance..
Sebastian -
Getting Error in java mapping: Parsing empty source. Root element expected!
Hi Experts,
I am using java mapping for schema validation of input message. I have followed all the standard procedures and implemented the java class in the interface mapping.
My interface mapping is like this:
OrderData --->Java Class ---SchemaValidate
Mesg Map ---OrderData_to_BAP --->BAPI Msg
So first I want to validate the schema of the input message. If the input message is invalid then XI should throw an exception. Then I use the actual message mapping to map the input order data to the BAPI input parameters.
In the java code I am using xerces parser.
The java code works fine when I run it as a standalone application.
The interface mapping also works fine if I don't include the java mapping. Ofcourse schema validation does not happen.
But when I test the interface mapping by including the java mapping then I am getting the error:
Call method execute of the application Java mapping SchemaValidate
Java mapping SchemaValidate completed. (execute() of SchemaValidate
com.sap.aii.utilxi.misc.api.BaseRuntimeException: Parsing an empty source. Root element expected!
What am I doing wrong? Why it is not getting the root element?
My Java code is as follows:
import com.sap.aii.mapping.api.StreamTransformation;
import com.sap.aii.mapping.api.StreamTransformationConstants;
import com.sap.aii.mapping.api.StreamTransformationException;
import java.io.*;
import java.util.Map;
import javax.xml.parsers.*;
import org.xml.sax.helpers.*;
import org.xml.sax.*;
import org.apache.xerces.jaxp.*;
Sample mapper for SAP-XI
@author Gopal
public class SchemaValidate implements StreamTransformation {
//Constants when using XML Schema for SAX parsing.
static final String JAXP_SCHEMA_LANGUAGE =
"http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static final String W3C_XML_SCHEMA =
"http://www.w3.org/2001/XMLSchema";
static final String JAXP_SCHEMA_SOURCE =
"http://java.sun.com/xml/jaxp/properties/schemaSource";
Injection of mapping parameters
from integration engine
@param map Map with configuration data
public void setParameter(Map map) {
Mapping implementation
@param inputStream Input data from integration engine
@param outputStream Output data to integration engine
public void execute(InputStream inputStream,
OutputStream outputStream)
throws StreamTransformationException {
try {
// obtain an object of class javax.xml.parsers.SAXParser,
SAXParserFactory spf = SAXParserFactoryImpl.newInstance();
spf.setNamespaceAware(true);
spf.setValidating(true);
SAXParser sp = spf.newSAXParser();
// setup the schema file
sp.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
sp.setProperty(JAXP_SCHEMA_SOURCE, new File("IOReqMsgSchema.xsd"));
//parse the input xml using the given schema
sp.parse(inputStream, new ParseErrorHandler());
catch(SAXException se) {
se.printStackTrace();
catch ( Exception e ) {
throw new StreamTransformationException( e.getMessage() );
My input message is :
<?xml version="1.0" encoding="UTF-8"?>
<ns0:OrderCreate_request xmlns:ns0="mynamespace">
<ORDER>HTEST1234567</ORDER>
<ORDER_TYPE>z001</ORDER_TYPE>
<ORDER_NAME>Test Order</ORDER_NAME>
<CO_AREA>INTC</CO_AREA>
<CCTR_POSTED>1234567890888888888</CCTR_POSTED>
<CURRENCY>USD</CURRENCY>
<PERSON_RESP>12345679</PERSON_RESP>
</ns0:OrderCreate_request>
Kindly help! please this is urgent!!!!!!
Thanks
Gopal
Edited by: gopalkrishna baliga on Feb 28, 2008 9:34 AMHi Stefan,
I did the code changes to return output stream and the java code works perfectly in standalone mode in my PC.
But when I use the same in the Java mapping with XI then It throws an error "Getting Error in java mapping: Parsing empty source. Root element expected!".
My XI J2EE server has JDK1.4.3.11.
Is there any limitation of using SAX parser in XI? If Yes, then which parser should be used for schema validation in XI?
I have included the XSD file for schema validation along with class files in the .jar file. This jar file is then imported in XI repository. Is the XI engine not able to read the XSD file?
Do I have to handle reading XSD file differently? Any suggession how?
Is this parser error due to some security access?
Kindly help me! I have been struggling with this problem since 2 weeks. I will be greatfull to you if you can help me.
Thanks
Gopal -
Diff between XSL - JAVA and XSL - ABAP
Hi All,
What is the difference between the XSLT in JAVA and XSL in ABAP? which is the preferable one.for
<b>XSL in ABAP</b>
refer these links
/people/sap.user72/blog/2003/09/18/xsl-and-abap
http://help.sap.com/saphelp_nw04/helpdata/en/09/b7463c32a3fe13e10000000a114084/frameset.htm
/people/achim.bangert/blog/2005/07/17/code-generation-using-xsl-transformations
/people/tobias.trapp/blog/2006/10/06/xml-processing-in-abap-part-9-150-abap-processing-using-xslt
/people/udo.martens/blog/2006/08/23/comparing-performance-of-mapping-programs
for <b>XSL in JAVA</b>
http://help.sap.com/saphelp_nw04/helpdata/en/4c/b2ad3de2d76b3be10000000a114084/frameset.htm
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/05a3d62e-0a01-0010-14bc-adc8efd4ee14
http://help.sap.com/saphelp_nw04/helpdata/en/ce/1d753cab14a909e10000000a11405a/frameset.htm
XSLT Mapping:
http://help.sap.com/saphelp_nw04/helpdata/en/73/f61eea1741453eb8f794e150067930/content.htm
Java Mapping:
http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/content.htm
Links of blogs on java mapping...
/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i
/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii
/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii
Have a look at this blog on XSLT mapping in ccbpm:
/people/sap.user72/blog/2005/03/15/using-xslt-mapping-in-a-ccbpm-scenario
/people/anish.abraham2/blog/2005/12/22/file-to-multiple-idocs-xslt-mapping(file to xslt mapping)
/people/pooja.pandey/blog/2005/06/27/xslt-mapping-with-java-enhancement-for-beginners(xslt with java enhancement function)
XSLT Mapping:
http://help.sap.com/saphelp_nw04/helpdata/en/73/f61eea1741453eb8f794e150067930/content.htm
and article on XSLT Mapping
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi%20code%20samples/generic%20xslt%20mapping%20and%20sample%20code.pdf
Java Mapping:
http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/content.htm
Message Mapping:
http://help.sap.com/saphelp_nw04/helpdata/en/ee/bf9640dc522f28e10000000a1550b0/content.htm
this thread could give u a better understanding....
https://www.sdn.sap.com/sdn/collaboration.sdn?contenttype=url&content=https%3A//forums.sdn.sap.com/thread.jspa%3FthreadID%3D40283%26tstart%3D25
/people/ravikumar.allampallam/blog/2005/02/10/different-types-of-mapping-in-xi(types of mappping in xi)
/people/sap.user72/blog/2005/03/15/using-xslt-mapping-in-a-ccbpm-scenario(XSLT mapping in bpm)
refer this thread
Difference in using java,xslt,message mapping
XSLT-transformation in Java-Mapping with javax.xml
Thanks !!!!
Maybe you are looking for
-
I have found help for this on older versions of Firefox, but I can't seem to find anything for the latest versions above 8. There must be someway to accomplish this for imaging on a large scale.
-
The first quthor of java.lang.Object
The biggest mystery for me in Java still exists as to who really coded the mother of all classes java.lang.Object. Here�s what the source of it says in JavaDocs * Class <code>Object</code> is the root of the class hierarchy. * Every class has <code>O
-
When I plug my Zen into any computer Creative says that I have no songs, pictures or videos on my Zen and will not allow me to put anything on it. When the Zen is unplugged it works perfectly fine, and I have all of my songs, my Zen isn't full but Cr
-
I have a few very short movies in iTunes that I want to convert to mp4 to place on my iTouch. When I right click the file and select "Convert selection for iPhone or IPod touch" iTunes indicates that it is converting the file, but the format does not
-
Automatically answering Calls (Bluetooth and Noteb...
Hi adventurers, I have this issue that my incoming calls are getting automatically answered and I'd just like to decide when to answer (cell is bluetooth connected and my pc is working as a headset). Anyone having this same