XSLT mapping with Java helper classes
Hi,
I'm trying to implement a XSLT mapping to convert my request to a specific soap request message format for this I'm calling some methods from a java helper class. I have imported the jar file into the archives. When I tried to test the interface it keeps complaing there is some exception but doesn't give me the exact error. Has any one called any java helper classes with in XSLT mapping, if so I would appreciate if you could help me with this. Here is the code from xsl.
<wsse:Security soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/07/secext" xmlns:UserToken="java:com.company.test.mapping.UserTokenMap">
<wsse:UsernameToken>
<wsse:Username xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<xsl:value-of select="UserToken:getUsername()"/>
</wsse:Username>
<wsse:Password wsse:Type="wsse:PasswordDigest" xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<xsl:value-of select="UserToken:getPasswordDigest()"/>
</wsse:Password>
<wsse:Nonce xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<xsl:value-of select="UserToken:getNonce()"/>
</wsse:Nonce>
<wsu:Created xsi:type="soapenc:string" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<xsl:value-of select="UserToken:getCreateDate()"/>
</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
Thanks,
Joe
Hi,
I'm getting following exception when I refer to the java class with in my XSLT mapping. Any one encountered the same problem.
com.sap.engine.services.ejb.exceptions.BaseRemoteException:
Exception in method transform.
at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0.transform(MapServiceRemoteObjectImpl0.java:218)
at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0p4_Skel.dispatch(MapServiceRemoteObjectImpl0p4_Skel.java:104)
at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:320)
at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:198)
at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:129)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native
Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
Caused by: java.lang.UnsupportedClassVersionError:
com/earthlink/xi/mapping/UserTokenMap (Unsupported
major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native
Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
at java.lang.ClassLoader.defineClass(ClassLoader.java:448)
at com.sap.aii.ibrep.server.mapping.ibrun.RepMappingLoader.findClass(RepMappingLoader.java:175)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at com.sap.engine.lib.xsl.xpath.JLBLibrary.<init>(JLBLibrary.java:33)
at com.sap.engine.lib.xsl.xpath.LibraryManager.getFunction(LibraryManager.java:69)
at com.sap.engine.lib.xsl.xpath.ETFunction.evaluate(ETFunction.java:98)
at com.sap.engine.lib.xsl.xpath.XPathProcessor.innerProcess(XPathProcessor.java:56)
at com.sap.engine.lib.xsl.xpath.XPathProcessor.process(XPathProcessor.java:43)
at com.sap.engine.lib.xsl.xpath.XPathProcessor.process(XPathProcessor.java:51)
at com.sap.engine.lib.xsl.xslt.XSLValueOf.process(XSLValueOf.java:76)
at com.sap.engine.lib.xsl.xslt.XSLNode.processFromFirst(XSLNode.java:296)
at com.sap.engine.lib.xsl.xslt.XSLElement.process(XSLElement.java:248)
at com.sap.engine.lib.xsl.xslt.XSLNode.processFromFirst(XSLNode.java:296)
at com.sap.engine.lib.xsl.xslt.XSLElement.process(XSLElement.java:248)
at com.sap.engine.lib.xsl.xslt.XSLNode.processFromFirst(XSLNode.java:296)
at com.sap.engine.lib.xsl.xslt.XSLElement.process(XSLElement.java:248)
at com.sap.engine.lib.xsl.xslt.XSLNode.processFromFirst(XSLNode.java:296)
at com.sap.engine.lib.xsl.xslt.XSLElement.process(XSLElement.java:248)
at com.sap.engine.lib.xsl.xslt.XSLNode.processFromFirst(XSLNode.java:296)
at com.sap.engine.lib.xsl.xslt.XSLElement.process(XSLElement.java:248)
at com.sap.engine.lib.xsl.xslt.XSLNode.processFromFirst(XSLNode.java:296)
at com.sap.engine.lib.xsl.xslt.XSLTemplate.process(XSLTemplate.java:272)
at com.sap.engine.lib.xsl.xslt.XSLStylesheet.process(XSLStylesheet.java:463)
at com.sap.engine.lib.xsl.xslt.XSLStylesheet.process(XSLStylesheet.java:431)
at com.sap.engine.lib.xsl.xslt.XSLStylesheet.process(XSLStylesheet.java:394)
at com.sap.engine.lib.jaxp.TransformerImpl.transformWithStylesheet(TransformerImpl.java:398)
at com.sap.engine.lib.jaxp.TransformerImpl.transform(TransformerImpl.java:240)
at com.sap.aii.ibrep.server.mapping.ibrun.RepMappingTransformer.transform(RepMappingTransformer.java:150)
at com.sap.aii.ibrep.server.mapping.ibrun.RepXSLTMapping.execute(RepXSLTMapping.java:81)
at com.sap.aii.ibrep.server.mapping.ibrun.RepSequenceMapping.execute(RepSequenceMapping.java:54)
at com.sap.aii.ibrep.server.mapping.ibrun.RepMappingHandler.run(RepMappingHandler.java:80)
at com.sap.aii.ibrep.server.mapping.rt.MappingHandlerAdapter.run(MappingHandlerAdapter.java:107)
at com.sap.aii.ibrep.server.mapping.ServerMapService.transformInterfaceMapping(ServerMapService.java:127)
at com.sap.aii.ibrep.server.mapping.ServerMapService.transform(ServerMapService.java:104)
at com.sap.aii.ibrep.sbeans.mapping.MapServiceBean.transform(MapServiceBean.java:40)
at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0.transform(MapServiceRemoteObjectImpl0.java:167)
... 10 more
; nested exception is:
java.lang.UnsupportedClassVersionError:
com/earthlink/xi/mapping/UserTokenMap (Unsupported
major.minor version 49.0)
Similar Messages
-
Java Error in RFC Lookup in XSLT Mapping usinf Java helper class
Hi All,
I am doing RFC Lookup in XSLT Mapping using Java Helper class.
The Lookup works fine when called one RFC at a time However my requirement is I want to do 2 Lookups.
Both Lookups works when done individually however when I call both lookups in one mapping I get following error "javax.xml.transform.TransformerException: DOMSource whose Node is null."
Following is the code I have written in XSLT for the lookup:
<xsl:template name="Lookup_1">
<xsl:param name="STDPN"/>
<rfc:RFC_READ_TABLE>
<QUERY_TABLE>KNA1</QUERY_TABLE>
<OPTIONS><item><TEXT>
<xsl:value-of select="$STDPN"/>
</TEXT></item>
</OPTIONS>
<FIELDS>
<item>
<FIELDNAME>KUNNR</FIELDNAME>
</item>
</FIELDS>
</rfc:RFC_READ_TABLE>
</xsl:variable>
<xsl:variable name="response" xmlns:lookup="java:urn.mt.pi" select="lookup:execute($request, 'BS_D, 'cc_RfcLookup', $inputparam)"/>
<xsl:element name="STDPN">
<xsl:value-of select="$response//DATA/item/WA"/>
</xsl:element>
</xsl:template>
<xsl:template name="Lookup_2">
<xsl:param name="BELNR"/>
<xsl:variable name="Query">AGMNT = '<xsl:value-of select="$BELNR"/>'</xsl:variable>
<xsl:variable name="request1">
<rfc:RFC_READ_TABLE>
<QUERY_TABLE>ZTABLE</QUERY_TABLE>
<OPTIONS><item><TEXT>
<xsl:value-of select="$Query"/>
</TEXT></item>
</OPTIONS>
<FIELDS>
<item>
<FIELDNAME>KUNAG</FIELDNAME>
</item>
</FIELDS>
</rfc:RFC_READ_TABLE>
</xsl:variable>
<xsl:variable name="response1" xmlns:lookup="java:urn.mt.pi" select="lookup:execute($request1, 'BS_D','cc_RfcLookup', $inputparam)"/>
<xsl:element name="BELNR">
<xsl:value-of select="$response1//DATA/item/WA"/>
</xsl:element>
</xsl:template>
My Question: Am I doing anything wrong? Or Is it possible to call multiple lookups in one XSLT?
Thanks and Regards,
AtulHi Atul,
I had the same problem like you had.
The main Problem is that with the example code the request variable is created as NodeList object. In XSLT a variable is somekind of a constant and can't be changed. As the request object is empty after the first request the programm fails at the following line:
Source source = new DOMSource(request.item(0));
So I've created a workaround for this problem.
In the call of the template I've put the request as a parameter object at the template call:
<xsl:with-param name="req">
<rfc:PLM_EXPLORE_BILL_OF_MATERIAL xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
<APPLICATION>Z001</APPLICATION>
<FLAG_NEW_EXPLOSION>X</FLAG_NEW_EXPLOSION>
<MATERIALNUMBER><xsl:value-of select="value"/></MATERIALNUMBER>
<PLANT>FSD0</PLANT>
<VALIDFROM><xsl:value-of select="//Recordset/Row[name='DTM-031']/value"/></VALIDFROM>
<BOMITEM_DATA/>
</rfc:PLM_EXPLORE_BILL_OF_MATERIAL>
</xsl:with-param>
With this change the request will be provided as a String object and not as a NodeList object.
Afterwards the RfcLookup.java has to be changed to the following:
package com.franke.mappings;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import com.sap.aii.mapping.lookup.Channel;
import com.sap.aii.mapping.api.StreamTransformationConstants;
import com.sap.aii.mapping.api.AbstractTrace;
import com.sap.aii.mapping.lookup.RfcAccessor;
import com.sap.aii.mapping.lookup.LookupService;
import com.sap.aii.mapping.lookup.XmlPayload;
* @author Thorsten Nordholm Søbirk, AppliCon A/S
* Helper class for using the XI Lookup API with XSLT mappings for calling RFCs.
* The class is generic in that it can be used to call any remote-enabled
* function module in R/3. Generation of the XML request document and parsing of
* the XML response is left to the stylesheet, where this can be done in a very
* natural manner.
* TD:
* Changed the class that request is sent as String, because of IndexOutOfBound-exception
* When sending multiple requests in one XSLT mapping.
public class RfcLookup {
* Execute RFC lookup.
* @param request RFC request - TD: changed to String
* @param service name of service
* @param channelName name of communication channel
* @param inputParam mapping parameters
* @return Node containing RFC response
public static Node execute( String request,
String service,
String channelName,
Map inputParam)
AbstractTrace trace = (AbstractTrace) inputParam.get(StreamTransformationConstants.MAPPING_TRACE);
Node responseNode = null;
try {
// Get channel and accessor
Channel channel = LookupService.getChannel(service, channelName);
RfcAccessor accessor = LookupService.getRfcAccessor(channel);
// Serialise request NodeList - TD: Not needed anymore as request is String
/*TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer();
Source source = new DOMSource(request.item(0));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
StreamResult streamResult = new StreamResult(baos);
transformer.transform(source, streamResult);*/
// TD: Add xml header and remove linefeeds for the request string
request = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+request.replaceAll("[\r\n]+", "");
// TD: Get byte Array from request String to send afterwards
byte[] requestBytes = request.getBytes();
// TD: Not used anymore as request is String
//byte[] requestBytes = baos.toByteArray();
trace.addDebugMessage("RFC Request: " + new String(requestBytes));
// Create input stream representing the function module request message
InputStream inputStream = new ByteArrayInputStream(requestBytes);
// Create XmlPayload
XmlPayload requestPayload =LookupService.getXmlPayload(inputStream);
// Execute lookup
XmlPayload responsePayload = accessor.call(requestPayload);
InputStream responseStream = responsePayload.getContent();
TeeInputStream tee = new TeeInputStream(responseStream);
// Create DOM tree for response
DocumentBuilder docBuilder =DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document document = docBuilder.parse(tee);
trace.addDebugMessage("RFC Response: " + tee.getStringContent());
responseNode = document.getFirstChild();
} catch (Throwable t) {
StringWriter sw = new StringWriter();
t.printStackTrace(new PrintWriter(sw));
trace.addWarning(sw.toString());
return responseNode;
* Helper class which collects stream input while reading.
static class TeeInputStream extends InputStream {
private ByteArrayOutputStream baos;
private InputStream wrappedInputStream;
TeeInputStream(InputStream inputStream) {
baos = new ByteArrayOutputStream();
wrappedInputStream = inputStream;
* @return stream content as String
String getStringContent() {
return baos.toString();
/* (non-Javadoc)
* @see java.io.InputStream#read()
public int read() throws IOException {
int r = wrappedInputStream.read();
baos.write(r);
return r;
Then you need to compile and upload this class and it should work.
I hope that this helps you.
Best regards
Till -
XSLT Mapping with Java Enhancement
Hi All
I am working on XSLT Mapping with Java Enhancement.
To do this scenario i have followed the following link.
http://help.sap.com/saphelp_nw04/helpdata/en/55/7ef3003fc411d6b1f700508b5d5211/frameset.htm
As per the above link I have created Source and Target Data Types , Message Types , Mesage Interfaces, XSLT Mapping (using the transaction XSLT_TOOL) and Interface Mapping part and configred a simple file to file scenario in the ID part.
Apart from this I have wirte the java code, compile the java code, create the jar file using .java and .class file and after creating the jar file import the .jar file in the imported archive of the IR..
when I am trying to execute the scenario I am getting the successful message in SXMB_MONI but the target file is having the payload as given below.
<?xml version ="1.0" encoding="UTF-8"?>
<name xmlns:javamap="java:com.company.group.MappingClass"/>
And as per the XSLT mapping the payload should be as below
<?xml version ="1.0" encoding="UTF-8"?>
<person>
<name>Rinku Gangwani</name>
</person>
I have also followed the following blog link but still i am getting the same issue
/people/pooja.pandey/blog/2005/06/27/xslt-mapping-with-java-enhancement-for-beginners
could you please tell me what can be the reason that i am getting the blank targt field values in the payload.
Thanks
Rinku GangwaniHi,
The Transaction code XSLT_TOOL for ABAP xslt mapping.But the Java Enhancement is used for normal xslt mapping which we created using Stylus Studio.You can not access the Java Enhancement in ABAP xslt mapping.
If you want to use Java Enhancement in xslt mapping then create a xslt mapping using Stylus Studio and save the file as .xsl and zip the .xsl and import to import archive.
Regards,
Prakasu.M
Edited by: prakasu on May 28, 2009 1:46 PM -
XSLT Maps with Java enhancements - JCO_SYSTEM_FAILURE
Hi,
I have reviewed several postings regarding XSLT Maps with Java enhancements. I followed instructions and build a jar file and the XSLT document. I built one imported archive with the .jar and .xsl. For the class, The path get loaded properly.
However, I still have a problem when and execute the interface.
My xslt has the following information
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ns="http://xyz.abc.sap.def.com"
xmlns:javamap="java:xyz.Date_Time">
<xsl:param name="inputparam" />
<xsl:template match="/">
<test><xsl:value-of select="javamap:getDateValue($inputparam)"/></test>
</xsl:template>
</xsl:transform>
In SXMB_Moni I get the following error...
<?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>XIServer</SAP:Category>
<SAP:Code area="MAPPING">JCO_SYSTEM_FAILURE</SAP:Code>
<SAP:P1>Exception in method processFunction.</SAP:P1>
<SAP:P2 />
<SAP:P3 />
<SAP:P4 />
<SAP:AdditionalText />
<SAP:ApplicationFaultMessage namespace="" />
<SAP:Stack>"SYSTEM FAILURE" during JCo call. Exception in method processFunction.</SAP:Stack>
<SAP:Retry>A</SAP:Retry>
</SAP:Error>
If i remove the line
<test><xsl:value-of select="javamap:getDateValue($inputparam)"/></test>
The map ends successfuly.
Comments would be appreciated.
Regards,
SergioStefan,
Find the class and method definition below. The method is static and it returns the string.
==========
package xyz;
import java.util.Map;
import com.sap.aii.mapping.api.AbstractTrace;
import com.sap.aii.mapping.api.StreamTransformationConstants;
import java.util.*;
import java.text.*;
public class Date_Time {
private static AbstractTrace trace = null;
public static String getDateValue(Map inputparam)
trace = (AbstractTrace)inputparam.get(
StreamTransformationConstants.MAPPING_TRACE );
Date now1 = new Date();
SimpleDateFormat formatter = new SimpleDateFormat ("yyyyMMd");
String dateString = formatter.format(now1);
return dateString; -
XSLT Mapping with Java Enhancement - how to pass Java Errors
Hi all,
I plan to build a XSLT-Mapping and do a RFC-Call out of it. (Client order!) So, I have to call my selfwritten Java class from the XSLT mapping and therefore report Connection errors back to the XSLT mapping (from Java). Is there a definition for the interface between Java and XSLT I can use?
Thanks and regards.
Danielhi,
hope this one will be more appropriate link
http://help.sap.com/saphelp_nw04s/helpdata/en/55/7ef3003fc411d6b1f700508b5d5211/frameset.htm
and this link will also be useful
http://help.sap.com/saphelp_nw04s/helpdata/en/4c/b2ad3de2d76b3be10000000a114084/frameset.htm
regards,
sundararamaprasad -
XSLT Mapping with Java class not working in Integration Repository
Hi,
I have an XSLT mapping program with Java enhancement and I was able to successfully tested it in Stylus Studio. However, when I imported the Java class and the xslt program in Enterprise Service Builder and tested it, my program does not compile.
Here is the error message: "Transformer Configuration Exception occurred when loading XSLT mapping_temp.xsl; details: Could not compile stylesheet".
My java program is in a zip file containing SOAPHeaderHandler.java and SOAPHeaderhandler.class. My Java has a package com.nga.xslt.
Here is the declaration of my Java class in the XSLT: xmlns:javamap="java:com.nga.xslt.SOAPHeaderHandler"
It seems that it could not read the java class. Can you please advice what is wrong?Hi ,
select XMLTOOLKIT option in Operation mapping and execute it.
I am not sure we can call java program in XSLT Program,but alternative is copy the code and use it in XSLT mapping it self,that means your XSLT program will become with JAVA extensions.
then in Operation mapping level select SAPXMLTOOL kit option and execute it. i hope it will work. if it is not working then you have deploy some JAXP files on server,because the way execution of XSLT Mpaping program got changed,like when eve you executing XSLT with extnasions( if you are not using XMLTOOL kit option) then you have to use latest version of JAXP.JDK files.
Regards,
Raj -
Hi,
I'm trying to do my first XSLT mapping. For that, I'm testing the SAP example found in XI help: it's a concatenate function between a FirstName and a LastName which uses Java function "Merge".
But... I have this error:
<i>Unable to find resource com/company/group/MappingClass.class (http://test, -1) in the following software component versions: 60530c50-5a4c-11d9-9740-cb29ac1601f1</i>
Do I declare the Java class "MappingClass" or "Merge" function somewhere in XI?
Regards.
Mickael.Unfortunately there are some errors in the documentation:
In the XSLT:
<xsl:if test="function-available('javamap:merge')">
Here "merge" is wrong, write "concat" instead.
In the Java Class:
private MappingTrace trace = zero;
This declaration has to be static, and of course "null" not "zero"
To compile the Java Code, you need the library aii_map_api.jar.
I have put all here:
http://de.geocities.com/stefan_grube/MappingExample.zip
Upload MappingExampleXSLT.jar and MappingExampleJava.jar as "Imported Archive" under "Mapping Objects"
For testing use the file testXSLT.xml.
Regards
Stefan -
Problem when using XSLT Mapping with Java Methods.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:javamap="java:at.pi.mapping.besoldung.BesoldungMapping">
<xsl:template match="Messages">
<Messages>
<Message1>
<xsl:apply-templates></xsl:apply-templates>
</Message1>
</Messages>
</xsl:template>
<xsl:template match="Message1">
<test></test>
<xsl:param name="inputparam"></xsl:param>
<xsl:for-each select="MT_BesoldungConversions">
<test1></test1>
<!-- Prüfen ob die subtractDates Methode verfügbar ist -->
<xsl:if test="function-available('javamap:createWhitespace')">
<xsl:if test="function-available('javamap:extendTextWithWhitespaces')">
<MT_BesoldungOut>
<EDI_DC40>
<xsl:param name="tablename">
<xsl:value-of select="tablename"></xsl:value-of>
</xsl:param>
<xsl:variable name="constTen">10</xsl:variable>
<xsl:value-of select="javamap:extendTextWithWhitespaces($tablename,$tablename, $inputparam)"></xsl:value-of>
</EDI_DC40>
</MT_BesoldungOut>
</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>incomplete post
-
XSLT Mapping : RFC Lookup using java helper class
Hi All,
I am doing RFC Lookup in xslt mapping using java helper class. I have found blog for the same (http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/05a3d62e-0a01-0010-14bc-adc8efd4ee14) However this blog is very advanced.
Can anybody help me with step by step approach for the same?
My basic questions are not answered in the blog as:
1) where to add the jar file of the java class used in xslt mapping.
I have added zip file of XSLT mapping in imported archived and using that in mapping.
Thanks in advace.
Regards,
RohanHi,
Can u please have look at this in detail , u can easily point out yourself the problem...
http://help.sap.com/saphelp_nw04/helpdata/en/55/7ef3003fc411d6b1f700508b5d5211/content.htm
Please observe the line,
xmlns:javamap="java:com.company.group.MappingClass
in XSLT mapping..
The packagename of class and class name and XSLT namespace should be matching...
Babu
Edited by: hlbabu123 on Sep 29, 2010 6:04 PM -
Code Sample: Easy RFC Lookup From XSLT Mappings Using a Java Helper Class
Hi everyone,
This is just a shameless plug for my article: <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/05a3d62e-0a01-0010-14bc-adc8efd4ee14">Easy RFC Lookup From XSLT Mappings Using a Java Helper Class</a>. I hope you're interested in reading it, and I welcome your comments in this thread.
Kind regards,
ThorstenHi Stefan. Thanks for your post. I have already done that. It still does not work. As a base for my java helper class I have usesd Thorstens code.
The problem is quite confusing. I will try to ouline both issues here.
First of all, when try to test from within the Operation Mapping, I always get a java error saying it cannot find the communication channel (it is there and working because I have tested it with the RFCLookup in graphical mapping). I have found a way to work around this, and that is to uncheck the "Use SAP XMLToolkit" checkbox --> switch to test tab, enter my ReceiverService in the parameter tab (header parameter) --> switch back to Definition tab, check the "Use SAP XMLToolkit" checkbox --> switch to Test tab and run the test. Then the XSLT and call to java helper class will work. Of course this is not really something you want to do all the time. Maybe there is a bug.
Secondly, it never works when I try to do it "live". I am using a file adapter to pick up one file, convert it and a file adapter to drop the converted file. I get the following error code in SXMB_MONI.
<?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">TRANSFORMER_CONF_EX</SAP:Code>
<SAP:P1>ATJ_Accounting2XML_Accounting.xsl</SAP:P1>
<SAP:P2>http://rd.accounting.logica.com</SAP:P2>
<SAP:P3>fd552c30-bad9-11dd-9761-c21dac1b818c</SAP:P3>
<SAP:P4>-1</SAP:P4>
<SAP:AdditionalText />
<SAP:Stack>TransformerConfigurationException triggered while loading XSLT mapping ATJ_Accounting2XML_Accounting.xsl; http://rd.accounting.logica.comfd552c30-bad9-11dd-9761-c21dac1b818c-1</SAP:Stack>
<SAP:Retry>M</SAP:Retry>
</SAP:Error>
Using an XSLT without a call to a java helper class, works just fine.
I am totally at a loss here. Any more input would be much appreciated.
/Patrik -
XSL mapping with Java enhancment PI 7.1 - Dynamic configuration
Scenario - IDOC -> File
XSL Mapping using dynamic configuration to set file name.
1. Ive included
xmlns:javamap="java:packageName.DynamicFunctionClass">
in the XSL header
2.Ive call this method javamap:transform($input, $output)
In the Java code.
1. Package = packageName
2. Class Name = DynamicFunctionClass
3. Class Compiles and I have uploaded into the ESR for a particular scenario. (source and class)
4. extends AbstractTransformation and implements the transform method.
public class DynamicFunctionClass extends AbstractTransformation{ .....
public void transform(TransformationInput arg0, TransformationOutput arg1) throws StreamTransformationException {
ISSUE -
Essentially it looks as though PI cannot see the class file or is not able to reference it. I have created a static method in the class as well to access and this does not work.
TRACE -
Resource not found META-INF/Services/javax.xml.parsers.SAXParserFactory Thrown:
com.sap.aii.ib.server.mapping.execution.MappingClassNotFoundException:Ive stumbled across the fact that JDK 1.5 does not allow for Mapping with Java enchanment it is a feature only in SAPXMLTOOL kit, I shall tick the little box in the Operational mapping ...
-
Transaction propogation to java helper class
Hi
EJB A calls EJB B and EJB B does certain numbr of updates/insert. If one them
fails everything rollsback in second EJB. This works fine.
But instead of EJB B being an EJB the initial design was a regular java helper
class. EJB A creates a new instance of this java class and calls a method on this
class. The EJB A is set to be transactional (Required). The java class get a DB
connection from TX datasource and does the same operation as EJB B that I described
above. I tried to throw an exception to the EJB A and catching the Exception did
a setRollbackOnly() in EJB A and the transaction does not rollback. I was under
the impression that even if DB operations are done in a java class they are still
under the same transaction and thus container is still under control of it if
it is a container managed transaction. it does not look like it is teh case.
Is there any requirement that DB connection obtained /operation made need to be
inside the EJB method itself and not in the java helper class. Does this means
that the transaction gets suspended on the duration of execution of the java helper
class. I was under the impression that they are all under the same transaction
context and it applies to that as well. Any help on this is greatly appreciated.
Well, that's the only way. The container has to start the transaction in its
invocation wrapper for CMT EJBs and then terminate the transaction (commit or
rollback) after the method has exited (either normally or by throwing an
exception). Anything that happens inside the call to the business method is in
the transaction...
--dejan
Toad wrote:
> That's good to know but somewhat surprising.
>
> "Deyan D. Bektchiev" <[email protected]> wrote in message
> news:[email protected]...
> > The transaction is associate with the thread that the EJB method executes
> in so
> > any calls in the same threads are part of the transaction.
> > So even if you have a separate class that functions as a connection
> factory (in
> > the end getting the connections from a TX datasource) those connections
> still
> > would be part of the transaction.
> >
> > You can test that if you do
> > System.out.println(weblogic.transaction.TxHelper.getTransaction()) and you
> > should see the current transaction.
> >
> >
> > --dejan
> >
> > Toad wrote:
> >
> > > I'm thinking the key to the failure to rollback is that the helper bean
> > > "gets a connection" which is effectively stepping outside the confines
> of
> > > your CMP model. How would the container know that you hand-carved a
> > > connection or even a set of connections and executed several
> transactions
> > > independently? That would be no mean feat if it wasn't specifically
> designed
> > > in.
> > >
> > > "Priya Vasudevan" <[email protected]> wrote in message
> > > news:[email protected]...
> > > >
> > > > Hi
> > > >
> > > > EJB A calls EJB B and EJB B does certain numbr of updates/insert. If
> one
> > > them
> > > > fails everything rollsback in second EJB. This works fine.
> > > >
> > > > But instead of EJB B being an EJB the initial design was a regular
> java
> > > helper
> > > > class. EJB A creates a new instance of this java class and calls a
> method
> > > on this
> > > > class. The EJB A is set to be transactional (Required). The java class
> get
> > > a DB
> > > > connection from TX datasource and does the same operation as EJB B
> that I
> > > described
> > > > above. I tried to throw an exception to the EJB A and catching the
> > > Exception did
> > > > a setRollbackOnly() in EJB A and the transaction does not rollback. I
> was
> > > under
> > > > the impression that even if DB operations are done in a java class
> they
> > > are still
> > > > under the same transaction and thus container is still under control
> of it
> > > if
> > > > it is a container managed transaction. it does not look like it is teh
> > > case.
> > > >
> > > > Is there any requirement that DB connection obtained /operation made
> need
> > > to be
> > > > inside the EJB method itself and not in the java helper class. Does
> this
> > > means
> > > > that the transaction gets suspended on the duration of execution of
> the
> > > java helper
> > > > class. I was under the impression that they are all under the same
> > > transaction
> > > > context and it applies to that as well. Any help on this is greatly
> > > appreciated.
> > > >
> >
-
XSLT mapping calls Java class, with hardcoded values-problem at Transport
Hi All,
I know the subject may be misguiding, but i need some suggestions how to handle the following scenario.
From my XSLT mapping, i am calling a java function which performs a data connection to an oracle database and then returns some values, whcih i have mapped in the mapping.
The problem is, i have hardcoded the Connection parameters....
and now that we transport these objects to production, the connection parameters will change.
I thought of two solutions
1) i create a new java class for Production system
2) i define the parameters as input arguemnts to my method, whcih is called from XSLT mapping
But in both cases, if theres any chg in future, there will a dependancy on one of the objects to be changed and sent again.
What is the suggested way? is there nothing like a property file(like in EP), where you define dependant parameters...and the file is only changed.
XI Gurus, please suggest me the correct way to handle.....
Thanks a lot.
MonaMona,
This is what i do..
1) Parametrize ur current calling class,
2) define a separate class called dbConnect.java there, you have all your parameters that way when there is a change your main program is untouched, and you just need to change the dbconnect.
The call from your current class will be just like
dbConnect.Runsql("sql as a string");
the runSql can then internally call
dbConnect().connect(); //that should do the connection opening.
then create a prepared statement from your string input and call the db.......
this is the implementation that would be best suited for your scenario, you can further parametrize the method to where you can add the database params from the calling xml..so all that needs to be done when the machine is changed or any param is changed is ..modify the xml........not too bad was that.....
Regards
Ravi -
BC-XI V3.0 Message Mapping with Java Class
Hi all
In the Integretion Builder Design i try to import a Java Class in order to convert a source to a target field. I have created an tested the class with the eclipse V3.0.
If i import the source in a customized mapping function i always get the error:
"OFFMANNONLINESHOP_ORDER2SAP_ORDERS05_MSGMAP01 hat keinen Quellkode." (...message..has no source code)
I have also imported the import classes in the "Imported Archives".
This message always appear if the import line for the classes is filled.
Do somebody knows this problem
Message was edited by: Christoph Borst
Message was edited by: Christoph Borst
Message was edited by: Christoph BorstHi ,
select XMLTOOLKIT option in Operation mapping and execute it.
I am not sure we can call java program in XSLT Program,but alternative is copy the code and use it in XSLT mapping it self,that means your XSLT program will become with JAVA extensions.
then in Operation mapping level select SAPXMLTOOL kit option and execute it. i hope it will work. if it is not working then you have deploy some JAXP files on server,because the way execution of XSLT Mpaping program got changed,like when eve you executing XSLT with extnasions( if you are not using XMLTOOL kit option) then you have to use latest version of JAXP.JDK files.
Regards,
Raj -
Mapping editor not working with Java 5 classes
I have a small protoype web service which I wrote using Tomcat/Axis/Spring/Hibernate and using EJB3 annotations for the mappings. I want to port the persistence layer to Toplink.
I installed Toplink 9.0.4.1 and added the toplink libraries to my project and implemented the DAO and the spring bean defs.
I opened the mapping editor and created a project. When I try to add classes to it for mapping I get an error that it can't find the classes (even though I selected them from the chooser). I figured it might be that they were compiled with Java 5, so I switched the JRE_HOME in setenv.cmd to my Java 5 JRE. Now I can import the classes and see the attributes but when I click on any of them in the Navigator panel, the editor panel remains blank. If I now try to save, I get:
java.lang.NullPointerException
at oracle.toplink.workbench.ui.tools.CheckListModel.getRowCount(CheckListModel.java:119)
at javax.swing.JTable.checkLeadAnchor(JTable.java:2949)
at javax.swing.JTable.tableChanged(JTable.java:2993)
at javax.swing.JTable.setModel(JTable.java:2827)
at oracle.toplink.workbench.ui.tools.CheckList.initialize(CheckList.java:47)
at oracle.toplink.workbench.ui.tools.CheckList.<init>(CheckList.java:26)
It seems that the mapping workbench doesnt work with Java 5. What should I do?Ah, I see. I saw another post here stating that must use 10.1.3.
Maybe you are looking for
-
I am trying to setup my exchange email and I fail everytime. Anyone have any tips
I am trying to setup my exchange email and I fail everytime. Anyone have any tips
-
I'm just formatting a second hard drive for backup purposes. I've decided I want to zero out all data to ensure that the drive maps out bad blocks, and then I'm going to create a GUID partition just in case I decide to make it a boot drive in future.
-
My photoshop crash 4 times or more a day
it crashes to the point that photoshop can't be open any longer. I have to uninstall and reinstall it agains. I have Photoshop CC with Maverick OS. Here are the dianostic report. I also submit the issue when it crash to adobe (the report box appear a
-
I know I can use a method to word wrap a JTextArea, but is there any simple way so that word wrapping does not cut words in half in order to fit? In other words, the current word wrapping will break a word at any position once the max line length has
-
How to Work in PSE 9 with LR edits on CD
I'm new to LR3. I chose to use it because it was an Adobe product and I already have PSE9. After reading the instructions for LR, there seems to be some capability between the two because on the menu I can elect to chose to edit in Photoshop Elements