XSLT Caching
HI,
I am using JAXP Template object to cache my XSLT files. Can my code pass parameters to a cached XSLT file?
Thanks,
Java-Junkie
I am using the following code to handle my transforms, can you suggest how I would cache the xslt files?
import javax.xml.transform.*;
import javax.xml.transform.stream.*;
import java.util.*;
import java.io.*;
public class TransformerPool
/** Source control version number. */
public final static String SOURCE_VERSION_INFO = "%R%";
/** Minimum number of transformers per transformation. */
public final static int MIN_INSTANCES = 1;
/** Maximum number of transformers per transformation. */
public final static int MAX_INSTANCES = 5;
// class members
private static TransformerFactory tFactory;
private static TransformerPool thisTP;
// data members
private Map transformers;
private int defaultMinInstances;
private int defaultMaxInstances;
private class PoolEntry
private int minInstances;
private int maxInstances;
private int currentInstances;
private int hits;
private int waitStates;
private int waitIter;
private StreamSource xslDocument;
private boolean busy[];
private Transformer processors[];
public PoolEntry(TransformerPool source, String xslDocument)
init(source);
initTransformer(xslDocument);
public PoolEntry(TransformerPool source, StreamSource streamSource)
init(source);
initTransformer(streamSource);
public void init(TransformerPool source)
minInstances = source.defaultMinInstances;
maxInstances = source.defaultMaxInstances;
currentInstances = minInstances;
hits = 0;
waitStates = 0;
waitIter = 0;
public void initTransformer(String xslDocument)
initTransformer(new StreamSource(new StringReader(xslDocument)));
public void initTransformer(StreamSource xslDocument)
this.xslDocument = xslDocument;
busy = new boolean[maxInstances];
processors = new Transformer[maxInstances];
for ( int i=0; i<maxInstances; i++ )
busy[i] = false;
processors[i] = i < currentInstances ? newTransformer() : null;
private Transformer newTransformer()
synchronized (TransformerPool.tFactory)
try
Templates cashedXSLT = TransformerPool.tFactory.newTemplates(xslDocument);
Transformer trans = cashedXSLT.newTransformer();
return trans;
//return TransformerPool.tFactory.newTransformer(xslDocument);
catch (TransformerConfigurationException e)
return null;
public boolean transform(Source xml, Result result, Properties params)
boolean isBusy = false;
boolean allNull = false;
Transformer xform = null;
int index = -1;
do
if (isBusy)
try
Thread.currentThread().sleep(100);
catch (InterruptedException e)
synchronized (this)
allNull = true;
for ( int i=0; i<maxInstances; i++ )
if (processors[i] != null)
allNull = false;
if (processors[i] != null && busy[i] == false)
index = i;
xform = processors;
busy[i] = true;
isBusy = false;
break;
if (allNull == true) // theres nothing we can do; fail
return false;
if (index == -1)
waitIter++;
isBusy = true;
} while (isBusy);
// we should have a transformer now
try
String paramName;
xform.clearParameters();
if(params!=null){
for ( Enumeration e=params.propertyNames(); e.hasMoreElements(); )
paramName = (String)e.nextElement();
xform.setParameter(paramName, params.get(paramName));
Message.out(Message.DEBUG, "starting transform");
xform.transform(xml, result);
Message.out(Message.DEBUG, "ending transform");
catch (Exception e)
e.printStackTrace();
Message.out(Message.DEBUG, "exception? " + e.toString());
return false;
finally
if (xform != null)
synchronized (this)
busy[index] = false;
// increment counters
if (isBusy)
waitStates++;
hits++;
return true;
* Create a new {@link TransformerPool}.
private TransformerPool()
if (tFactory == null)
tFactory = TransformerFactory.newInstance();
transformers = new HashMap();
defaultMinInstances = MIN_INSTANCES;
defaultMaxInstances = MAX_INSTANCES;
* Create a new {@link TransformerPool}.
* @return A {@link TransformerPool} instance.
public static synchronized TransformerPool getInstance()
if (thisTP == null)
thisTP = new TransformerPool();
return thisTP;
private synchronized PoolEntry newEntry(StreamSource xsl)
return xsl == null ? null : new PoolEntry(this, xsl);
public synchronized void dump(PrintWriter out)
PoolEntry entry;
String key;
out.println("Default instances: " + defaultMinInstances +
" (minimum), " + defaultMaxInstances + " (maximum)");
out.println("Transfomers: " + transformers.size());
out.println();
for ( Iterator iter=transformers.keySet().iterator(); iter.hasNext(); )
key = (String)iter.next();
entry = (PoolEntry)transformers.get(key);
out.println("Transformer: " + key);
out.println(" Instances: " + entry.minInstances + " (minimum), " +
entry.maxInstances + " (maximum), " + entry.currentInstances +
" (current)");
out.println(" Hits: " + entry.hits + " (" + entry.waitStates + " busy)");
for ( int i=0; i<entry.maxInstances; i++ )
out.println(" (" + i + ") " + entry.processors[i] + " " + (entry.busy[i] ? "busy" : "not busy"));
out.println();
out.flush();
* Add a new transformation.
* @param name Transformation name as a String.
* @param xsl Transformation XSLT document as a StreamSource.
public synchronized void addTransformation(String name, StreamSource xsl)
PoolEntry entry = newEntry(xsl);
if (entry != null)
transformers.put(name, entry);
* Remove a given transformation.
* @param name Transformation name as a String.
public synchronized void removeTransformation(String name)
transformers.remove(name);
* Determines if a given transformation exists.
* @param name Transformation name as a String.
* @return <code>true</code> if there is a transformation by that
* name, otherwise <code>false</code>.
public synchronized boolean isTransformation(String name)
return transformers.containsKey(name);
* Transform an XML document using a named transformation.
* @param name Transformation name as a String.
* @param xml XML document to transform as a Source.
* @param result Transformed document as a Result.
* @return <code>true</code> if the transformation succeeded or
* <code>false</code> if the transformation couldn't be completed
* for any reason.
public synchronized boolean transform(String name, Source xml, Result result)
// find the entry
PoolEntry entry = (PoolEntry)transformers.get(name);
if (entry == null)
return false;
// transform
return entry.transform(xml, result, null);
* Transform an XML document using a named transformation.
* @param name Transformation name as a String.
* @param xml XML document to transform as a Source.
* @param result Transformed document as a Result.
* @param params Collection of transformation parameters as Properties.
* @return <code>true</code> if the transformation succeeded or
* <code>false</code> if the transformation couldn't be completed
* for any reason.
public synchronized boolean transform(String name, Source xml, Result result, Properties params)
// find the entry
PoolEntry entry = (PoolEntry)transformers.get(name);
if (entry == null)
return false;
// transform
return entry.transform(xml, result, params);
Similar Messages
-
XSLT Cache problem including remote host stylesheets
Hi.
We are building an XSL page that includes changing named templates through xsl:includes where the included stylesheet is on a remote server.
The content of the remote stylesheet can change at any time. The problem is that the Oracle XSLT caching mecanism does not "see" this, so we get the old page..
How can we turn the caching off? Is it possible to turn caching off for selected stylesheets?
Any clues or pointers?
Regards
LionelHi.
We are building an XSL page that includes changing named templates through xsl:includes where the included stylesheet is on a remote server.
The content of the remote stylesheet can change at any time. The problem is that the Oracle XSLT caching mecanism does not "see" this, so we get the old page..
How can we turn the caching off? Is it possible to turn caching off for selected stylesheets?
Any clues or pointers?
Regards
Lionel -
Hi guys,
I am writing XSLTS to display data in web browser in HTML form.
My question is like JSPs, can we force browser/server to reload the changed
XSLT from server.
I know we have something called 'pageCheckSecs' for jsps, do we have
anything similiar for XSLTs also?
Thanks
Ashish JainIf the xsl is part of a web app ( war ) or enterprise app ( ear ), just
toggle the deployed status from the console.
"Ashish Jain" <[email protected]> wrote in message
news:27_175_3b2f84b7$[email protected]..
Hi guys,
I am writing XSLTS to display data in web browser in HTML form.
My question is like JSPs, can we force browser/server to reload thechanged
XSLT from server.
I know we have something called 'pageCheckSecs' for jsps, do we have
anything similiar for XSLTs also?
Thanks
Ashish Jain -
Compilation/loading/execution of XSLT mapping in XI at runtime
Hi all,
once a xslt is added to the interface mapping as XSL how its getting compiled/loaded/executed at runtime, since we adding the xslt code as such to the imported archives?did all these steps will take place for each message processing? or is there any approach like xslt caching which will improve the performance at runtime?
kind regards
francisdid all these steps will take place for each message processing - YES
is there any approach like xslt caching which will improve the performance at runtime? - interms performance xslt is not good.
Regards,
Venu. -
Cache problem for included stylesheets on remote server
Hi.
We are building an XSL page that includes changing named templates through xsl:includes where the included stylesheet is on a remote server.
The content of the remote stylesheet can change at any time. The problem is that the Oracle XSLT caching mecanism does not "see" this, so we get the old page..
How can we turn the caching off? Is it possible to turn caching off for selected stylesheets?
Any clues or pointers?
Regards
LionelI by no means want to sound belittling... so don't take me that way..
You need to understand the basics of files, and networks. You can't check if a file exists on another machine if you don't have a network protocol to communicate with. The reason \\ works under windows is because you are using an invisible (to you) network protocol. You probably know it as windows sharing. If your file were not shared under it's own name, that method wouldn't work (I'm assuming your entire drive is shared without a password... a horrible security flaw...but one thing at a time)
You can use FTP protocol to check if a file exists. You can either send the raw text FTP commands through a socket connection in java, or you can use a freely available FTP java API to make it a bit more simple. You could also write a small java server on the other machine, and have it tell you what you need to know with a socket connection. In this way, you have created your very own network protocol. -
Hi,
I´m trying the "Easy RFC lookup from XSLT mappings using a Java helper class" article and I getting a weird problem.
The result of the RFC lookup called inside the java class is maintained in a kind of cache and I always get the same results independent of the parameters I use in the following calls.
Just after calling a Complete Cache Refresh (SXI_CACHE) I got a new result to the lookup.
If I call in the Interface Mapping Test option it runs fine. However, when I call it from my scenario (SOAP Adapter Sender) the first result of the lookup will be returned until a forced cache refresh.
Any ideas?
Thank you,
Fabiano.Hello Fabiano,
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 -
Guys, I have written a servlets which create an xml file .... depends on JSP form... i want to run my xslt on it and produce .csv and .html..... I have two xslt file... I was wondering if i can store xslt file in cache... because it's taking to long to download... is there any better way to do it?
O'reilly....
mentioned of javax.xml.transform.Templates interface
Source xsltSource = new StreamSource(xsltFile);
TransformerFactory transFact = TransformerFactory.newInstance();
Templates cachedXSLT = transFact.newTemplates(xsltSource);
Transformer trans = cachedXSLT.newTransformer();
is this a good way to do it? or is there any other better way...
how about...
HashMap cachexslt = new HashMap();
cachexslt.put("HTML", filename);
cachexslt.put("CSV", filename):
if (formatType,equals("HTML")
cachexslt.get("HTML") and run it on my xml file
else run my csv xslt on xml file...
-SumitO'Reilly is correct. The Templates object is reusable and can be cached.
-
Hi,
I am a newbie to XML/XSLT, and we have just written our first XSL stylesheet.
I am using the WebLogic JSP Tag Library to do the transformation from XML to HTML
and all seems to work well. My question is this: Does WebLogic cache the HTML
somewhere so that the transformation does not need to be reperformed each time
the page is requested by the user? It sounds like an obvious thing to do, but
I'm not sure if this functionality is included in WebLogic. If it is not, are
there others out there who have this same need (to cache XSLT results for performance
reasons) and how have you dealt with this issue. Any help would be appreciated.
I'm running WLS 6.0 SP2 on HP-UX 11.x. Thanks...
Vasuki.I tried this example based on a view:
CREATE MATERIALIZED VIEW MV_TEST2
REFRESH COMPLETE
START WITH SYSDATE
NEXT SYSDATE + 1/48
WITH ROWID
AS SELECT * FROM test1;REFRESH COMPLETE -- The complete refresh re-creates the entire materialized view.
START WITH SYSDATE -- run now
NEXT SYSDATE + 1/48 -- run again in half an hour
WITH ROWID -- I think this option is important if you use partial refresh of the view.
AS SELECT * FROM test1; -- test1 is a view:
CREATE OR REPLACE VIEW TEST1 AS
SELECT st_id, st_name
FROM aaw_solution_tree;Are column indexes still possible? I'm not sure:
Indexing: !with respect to MV's on 10gR2 Jonathan Lewis wrote! ... you are allowed to create indexes on the tables that sit under materialized views - just don't make them unique indexes
How much freedom is there in setting the refresh rate?
What type of refreshing do you need?
Another useful link: [http://asktom.oracle.com/pls/ask/search?p_string=materialized+view|http://asktom.oracle.com/pls/ask/search?p_string=materialized+view]
Hope it helps.
Tobias -
Dear all,
I am developing different scenarios with BPMs accessed by SOAP (Web Services) within SAP-PI.
I am having a lot of problems with some of the XSLT split mappings programs. What's happening is that we have developed various mappings and made changes to them and upon activating them it's possible that they are being incorrectly managed by the J2EE server cache e.g. wrong versions being kept in the cache. The consequence of this is that we obtain different results for the same data input.
Executing the services sequentially, with the same input parameters, we obtain results with different data in a random form that coincides with the different versions of the mappings that we have published to the server.
Could there be an error with the way the java cache works?
I am checking different issues regarding the SAP PI Caché manual ("How to Handle Caches in SAP XI 3.0.pdf"), but I cannot find the problem. Doing testing, I am getting in different moments, following errors:
1. This error occurs sometimes:
com.sap.aii.af.service.cpa.impl.exception.CPADirectoryCacheException: Failed to check secure connection configuration. Reason: com.sap.aii.af.lib.sld.SLDException: Failed to read SLD instance name. Reason: HTTP response code: 503 (Service Unavailable)
at com.sap.aii.af.service.cpa.impl.cache.directory.DirectoryAccess.getDirectoryURL(DirectoryAccess.java:134)
at com.sap.aii.af.service.cpa.impl.cache.directory.DirectoryAccess.getDeltaRefreshURL(DirectoryAccess.java:191)
at com.sap.aii.af.service.cpa.impl.cache.directory.DirectoryAccess.getDeltaCacheUpdateXML(DirectoryAccess.java:440)
at com.sap.aii.af.service.cpa.impl.cache.CacheManager.performCacheUpdate(CacheManager.java:491)
at com.sap.aii.af.service.cpa.impl.cache.CacheManager$CacheUpdateRunnable.run(CacheManager.java:322)
at com.sap.engine.frame.core.thread.Task.run(Task.java:73)
at com.sap.engine.core.thread.impl5.SingleThread.execute(SingleThread.java:144)
at com.sap.engine.core.thread.impl5.SingleThread.run(SingleThread.java:242)
Caused by: com.sap.aii.af.lib.sld.SLDException: Failed to read SLD instance name. Reason: HTTP response code: 503 (Service Unavailable)
I did all checks that came in the manual, but to no avail.
Thanks in advance.
RegardsHi!
According to my Knowledge
1. BPM need to use in final case because it tooks lot of performance issues in RUN time because IN BPM while running your scenario the process is always switch from ABAP stack BPM Process Engine to JAVA Stack for executing the mapping whch you configured in the java stack and again it needs to swtich towards the Process Engine and finally again it needs to swtich towards java stack to ID part through Interface determintation step....
In going all these it takes lot of Load on server and suppose if it is handling very huge data defnitely you ill face performance issues.
2. Also I think there is some authentification issue while running it means defalutly even though u configured any adapter on your user id by default all those adapters run by using ADMINs authentifications check whether it was locked or some other problem.
3. Also check once CACHE thorugh SXI_CACHE and also u can check via RWB-->Cache Monitoring...
Regards::
Amar Srinivas Eli
Edited by: Amar Srinivas Eli on Mar 9, 2009 4:17 PM -
XSLT Mapping: Namespace for prefix 'ns0' has not been declared
Hello, I am working on a synchronous SOAP call and having some trouble with the response message. The web service has its own namespace and I am trying to convert this to my custom data type in PI. PI wants the message to be in format of having ns0 prefix and namespace like we have defined (http://foo for example).
I have an XSLT mapping (see below) which works fine with my test response payload (pulled from SXMB_MONI source) on this online XSLT test site:
http://www.freeformatter.com/xsl-transformer.html
However when I import this archive to PI and test with operation mapping it always says "Namespace for prefix 'ns0' has not been declared."
This is very confusing because when I test it online, I see both prefix and namespace declaration perfectly. Is there a way to see the results in the PI test tool? After this XSLT java error it doesn't give me the output even in Trace Level All mode.
Please advise on this issue or if you know an easier way (such as altering my datatype/message type to match the inbound SOAP message). I tried working with the 3rd party WSDL but the response message types show a different root level node than what PI is receiving so I gave up to make my own matching datatype. I just have to solve this last inbound namespace issue and should be finished.
FYI I have refreshed all PI caches and activated all objects.
Thanks for your ideas!
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ns0="http://foo"
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/*">
<xsl:element name="ns0:{local-name()}">
<xsl:apply-templates select="@* | node()" />
</xsl:element>
</xsl:template>
<xsl:template match="/">
<xsl:element name="{local-name()}">
<xsl:apply-templates select="@* | node()" />
</xsl:element>
</xsl:template>
</xsl:stylesheet>Some additional info, here is an example payload which goes through the XSLT mapping perfectly, but in PI I get the error about missing ns0 declaration.
XML input:
<bar xmlns='http://irrelevantnamespace'
xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
<foo/>
</bar>
XSLT mapped output using test tool and XSL above:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:bar xmlns:ns0="http://foo">
<foo />
</ns0:bar> -
XSLT Interface Mapping Not Found For HTTP Response
NW 04's SR 10, RFC => XSL => HTML
The scenario transforms data from R/3 into XML using XSLT and sends it to a 3rd party vendor wrapped inside a field of an HTML form via the HTTPS adapter. XSL was used for this instead of standard MessageMapping to meet the customer's needed for the XML data to be delivered in an untransformed structure, including their DTD declaration, so they could parse it upon receipt.
The outbound process is successful and the data is posted to the customer's database. Upon receipt, they send back a simple HTML form containing the success/failure in an H1 tag and our submitted XML data in the Body tag.
The problem is that due to the use of an XSL as the outbound mapping XI does not have a cached message structure to which it can map the response and thus throws the <b>Interface mapping .... does not exist in runtime cache</b> message. I do not feel this is a cache problem since I've cleared the XI cache, CPACache and anything else I've read as well as verified that the outbound mapping exists in the XI Cache list. I honestly feel I'm just missing a necessary piece to tell XI how to map the HTML response message back to the RFC Sender.
I have attempted numerous ideas, one of which included the use of the same RFC structure as the inbound and outbound MessageType so that a Response mapping could be specified but a NullPointerException was thrown in the mapping step since the response was of a completely different structure.
My question is how to handle the return data when using XSLT to create the outbound structure dynamically to prevent runtime errors in XI?
Thanks in advance,
LaneThanks for the quick response Bhavesh.
I figured out the response mapping option after I posted the question and also thought of using XSL to handle the response but I ran into a few other issues relating to my limited experience with XSLT that is preventing me from completely solving this.
The response is a plain HTML file structured as:
< html >
< body >
< h1 >Success/FailureMessage< /h1 >
< br >
Record Created
< br >< br > XML Data: <?xml version="1.0" encoding="utf-8"?><!DOCTYPE ....
< /body >
< /html >
where the actual XML data posted to the client system is embedded in the HTML body. Therefore the response is not well-formed XML and fails on parsing but also contains another XML message within the HTML structure that throws off parsing as well. Do you know XSLT well enough to get around this?
What about writing a Java function that just reads the incoming information but in doing this how do I go about mapping back to the RFC? Can I get ahold of the XI API somewhere to instantiate the RFC Objects dynamically?
Thanks again,
Lane -
There is one existing message interface, It is using XSLt mapping, When I click on XSLT mapping program :
It goes to "Display Imported Archive"
Where it shows the mapping XSL file.
When I tried to open the xsl file from the Integration repository in edit mode, : Either click on Open or Click on Change program icon: it give me a error message ;
"Cannot display file map.xsl. Unable to determine the code.
While this mapping programm is working and has been developed manually.
may I know why its coming?
While some other xsl program is able to open.Hi Ram,
Pls do export the imported archive as a zip file to your local disk and try opening the same. If its not then the zip file which you have uploaded might have got corrupted/is not fully uploaded.
Try activating the imported archive and do a check before you do that. This you can do with a minor change in the description or so.
Then coming to the point the mapping program is working fine. It could be the old instance which is in the server cache. If you go for a server restart this error might come out as a mapping exception.
Cheers
JK -
Easy RFC lookup from XSLT mapping using a java class (getting Error)
Hi All,
I am trying to implement the sample scenario for calling RFC from xslt with the help of wrapper class. I am getting following error.
com.sap.aii.mapping.lookup.LookupException: Internal lookup service is not registered. Invoking the lookup service is only supported in the Integration Builder test environment or in the Integration Server runtime environment. at com.sap.aii.mapping.lookup.LookupService.getService(LookupService.java:400) at com.sap.aii.mapping.lookup.LookupService.getChannel(LookupService.java:285) at com.sap.aii.mapping.lookup.LookupService.getChannel(LookupService.java:318) at dk.applican.xi.mapping.lookup.RfcLookup.execute(RfcLookup.java:55) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.sap.engine.lib.xsl.xpath.functions.JLBFunction.execute(JLBFunction.java:145) at com.sap.engine.lib.xsl.xpath.ETFunction.evaluate(ETFunction.java:110) at com.sap.engine.lib.xsl.xpath.XPathProcessor.innerProcess(XPathProcessor.java:54) at com.sap.engine.lib.xsl.xpath.XPathProcessor.process(XPathProcessor.java:41) at com.sap.engine.lib.xsl.xpath.XPathProcessor.process(XPathProcessor.java:49) at com.sap.engine.lib.xsl.xslt.XSLVariable.process(XSLVariable.java:125) at com.sap.engine.lib.xsl.xslt.XSLNode.processFromFirst(XSLNode.java:228) at com.sap.engine.lib.xsl.xslt.XSLTemplate.process(XSLTemplate.java:256) at com.sap.engine.lib.xsl.xslt.XSLStylesheet.callTemplate(XSLStylesheet.java:1310) at com.sap.engine.lib.xsl.xslt.XSLCallTemplate.process(XSLCallTemplate.java:102) at com.sap.engine.lib.xsl.xslt.XSLNode.processFromFirst(XSLNode.java:228) at com.sap.engine.lib.xsl.xslt.XSLElement.process(XSLElement.java:241) at com.sap.engine.lib.xsl.xslt.XSLNode.processFromFirst(XSLNode.java:228) at com.sap.engine.lib.xsl.xslt.XSLElement.process(XSLElement.java:241) at com.sap.engine.lib.xsl.xslt.XSLNode.processFromFirst(XSLNode.java:228) at com.sap.engine.lib.xsl.xslt.XSLTemplate.process(XSLTemplate.java:256) at com.sap.engine.lib.xsl.xslt.XSLStylesheet.process(XSLStylesheet.java:445) at com.sap.engine.lib.xsl.xslt.XSLApplyTemplates.process(XSLApplyTemplates.java:158) at com.sap.engine.lib.xsl.xslt.XSLNode.processFromFirst(XSLNode.java:228) at com.sap.engine.lib.xsl.xslt.XSLTemplate.process(XSLTemplate.java:256) at com.sap.engine.lib.xsl.xslt.XSLStylesheet.process(XSLStylesheet.java:445) at com.sap.engine.lib.xsl.xslt.XSLStylesheet.process(XSLStylesheet.java:381) at com.sap.engine.lib.jaxp.TransformerImpl.transformWithStylesheet(TransformerImpl.java:392) at com.sap.engine.lib.jaxp.TransformerImpl.transform(TransformerImpl.java:234) at com.sap.aii.ibrun.server.mapping.MappingTransformer.transform(MappingTransformer.java:153) at com.sap.aii.ibrun.server.mapping.XSLTMapping.executeStep(XSLTMapping.java:67) at com.sap.aii.ibrun.server.mapping.Mapping.execute(Mapping.java:91) at com.sap.aii.ibrun.server.mapping.MappingHandler.run(MappingHandler.java:77) at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleMappingRequest(MappingRequestHandler.java:88) at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleRequest(MappingRequestHandler.java:63) at com.sap.aii.ibrun.sbeans.mapping.MappingServiceImpl.processFunction(MappingServiceImpl.java:80) at com.sap.aii.ibrun.sbeans.mapping.MappingServiceObjectImpl0.processFunction(MappingServiceObjectImpl0.java:131) at sun.reflect.GeneratedMethodAccessor482.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.sap.engine.services.ejb.session.stateless_sp5.ObjectStubProxyImpl.invoke(ObjectStubProxyImpl.java:187) at $Proxy22.processFunction(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:95) at com.sap.engine.services.rfcengine.RFCJCOServer.handleRequestInternal(RFCJCOServer.java:113) at com.sap.engine.services.rfcengine.RFCJCOServer$ApplicationRunnable.run(RFCJCOServer.java:171) 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:94) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162
I am SAP XI 3.0 SP-9Hello,
I have the same issue as stated above.
At runtime sometimes the mapping fails however when executing the mapping from ESR (test operation mapping) with the same payload it is executed succesfully (lookup is to system that is the senderservice of the scenario).
Anybody a clue.
Also clearing mapping cache etc. did not solve the problem.
Thanks,
Emile -
Hi,
I am using an XSLT mapping during the response processing for a sync interface.
I have performed the following steps:
1. Created Translation.xsl and added to a .zip archive
2. Imported the archive file into the same namespace as the interface mapping
3. Added the mapping program for type XSL using the imported archive on the response in the interface mapping
4. Activated everything
However, when I receive a response, I get the following error:
Search Translation.xsl (urn:com.xerox.esap.crm.deviceregistration, -1) in swcv f1570070-52e9-11db-c6b4-d3c10ddf0074.</Trace>
<Trace level="3" type="T">Does not found exact entry. Search in other namspaces.</Trace>
<Trace level="3" type="T">Search Translation.xsl (-1) in swcv f1570070-52e9-11db-c6b4-d3c10ddf0074 without namespace.</Trace>
<Trace level="1" type="T">Unable to find resource Translation.xsl (urn:com.xerox.esap.crm.deviceregistration, f1570070-52e9-11db-c6b4-d3c10ddf0074, -1)</Trace>
<Trace level="1" type="T">com.sap.aii.ibrun.server.mapping.persist.ResourceNotFoundException: Unable to find resource Translation.xsl
However, I can see the imported archive with my very own eyes so not sure why this error is being thrown.
Any ideas ?
Kind regards
Colin.Colin,
First test your mapping is working fine or not in interfaace mapping. Just referesh your caches as mentioned in this document. This should resolve your issue:
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1a69ea11-0d01-0010-fa80-b47a79301290
---Satish -
HELP: JSP + XML + XSLT = HTML?
Hello, all.
I am trying out Weblogic 6 and I am trying to get the JSP + XML + XSLT =>
HTML chain working.
I am coming from using Orion and SAXON.. and in that situation I had a JSP
that contained XML tags... they were filled in at runtime and then using
Servlet-Chaining was passed along to the SAXON XSLT Processer. SAXON checked
for the inline XSL specified and then used that to transform the document
into HTML.
It worked well, but there were some other features missing/not documented
that we now need.
With Weblogic I am trying to use the XSLT Tag Library that comes with the
distribution, but it seems to be very finicky. I followed the directions and
I got it to do a sort of roundabout transformation. But it doesn't seem to
work quite right.
The best I can get is the following:
I have an 'xslt' directory url-pattern-mapped to xslt.jsp (as instructed)...
but can't figure out how to specify the xsl file on-the-fly... that is, if I
don't hard-code the XSL file in the x:xslt element in the xslt.jsp it
complains about some XML file not having a root element.
Ideal situation:
1. I have a JSP that includes XML elements.
2. It is filled from a database at runtime and specifys (using a PI) what
XSL stylesheet it is to be processed with.
3. Somehow (fingers crossed) the XML is processed and transformed into HTML
by the appropriate XSL file.
I think I am mostly stuck moving between steps 2 and 3.
Can anyone give me some hints? Are there some Weblogic specific
elements/tags that I have to include in the XML file that Weblogic will
catch and re-direct to the XSL Parser?
Please, anyone, if you have some information, I would much appreciate it.
Dylan Parker
PS - I apologize for the cross-post, I hope it doesn't cause too much
traffic.Craig,
I've since discovered how to do it with the WL Taglibrary... and have
moved on =)
It has to do with the EXTREMELY BADLY documented x:xml tag that can
appear within the x:xslt tag body...
So the WL Tag Library allows something like the following.
(Please note, angled brackets are omitted in this post to prevent html
parsing)
[x:xslt stylesheet="sheet.xsl"]
[x:xml]
Here is the XML to run the sheet on.
This should have all relevant XML syntax: the PIs, the doctype,
root elements etc...
[x:xml]
[x:xslt]
And that DOES work. But not very well. WL, a little prematurely
incorporated versions 1.2 of Xerces and Xalan in their product -- and
these versions have some irritating bugs.
Also -- There tag library doesn't copy the source XML across as UTF-8
.. so a lot of the Japanese I have embedded there (from a DB) gets
mangled somewhere in their code...
AND -- If you hammer a little bit on an JSP/XML that uses the WL Tag
Library (eg clicking refresh lots of times in IE)... I get huge
amounts of irritating exceptions appearing in the log files.
NullPointerExceptions
XSL Parsing Exceptions
XML Parsing Exceptions
but completely unpredictably...
In my eyes.. the WL XML/XSL Tag Library using the incorporated and
untouchable Xalan and Xerces (v1.2) is virtually unusable.
What a pain.
BUT! Apache offers a similar OPEN SOURCE XSL Tag Library available
here:
http://jakarta.apache.org/taglibs/doc/xsl-doc/intro.html
And it uses the standard, non-weblogic-incorporated, Xerces and Xalan
(which means you can provide whatever version you want).. and it works
impressively well.
It has almost identical performance as the WL Taglib, and without all
of the bizarre exceptions being thrown.
And it does proper passing of the character encoding type!
If only the taglib did caching though =(
The performance hit over pure JSP is huge. Almost two orders of
magnitude. On my desktop box I can get around 500Requests/Sec if I am
returning HTML direct from a JSP... while if I produce XML that gets
processed by XSL into HTML the Requests/Sec drops to 5!!!!
Caching. Caching. And more Caching. A lot of DiskIO is going on with
the XML/XSL/XHTML chain of events.
I hope this helps!
I'd be curious as to what you find out as well.
Dylan Parker
On 5 Mar 2001 07:20:00 -0800, "Craig Macha"
<[email protected]> wrote:
>
Yep, I feel Dylan's pain.
I am trying to accomplish the same thing. A JSP page generating
dynamic XML content and then utilizing an XSLT stylesheet to transform
all the content into XHTML.
Does anyone have some examples that show exactly how to accomplish
this? Can I do this with WLS and the XML taglib that comes with
it? Or do I have to move on to something like Cocoon to get this
capability?
Any insight would be greatly appreciated.
Thanks,
Craig Macha
"Dylan Parker" <[email protected]> wrote:
Hello, all.
I am trying out Weblogic 6 and I am trying to get the
JSP + XML + XSLT =>
HTML chain working.
I am coming from using Orion and SAXON.. and in that situation
I had a JSP
that contained XML tags... they were filled in at runtime
and then using
Servlet-Chaining was passed along to the SAXON XSLT Processer.
SAXON checked
for the inline XSL specified and then used that to transform
the document
into HTML.
It worked well, but there were some other features missing/not
documented
that we now need.
With Weblogic I am trying to use the XSLT Tag Library
that comes with the
distribution, but it seems to be very finicky. I followed
the directions and
I got it to do a sort of roundabout transformation. But
it doesn't seem to
work quite right.
The best I can get is the following:
I have an 'xslt' directory url-pattern-mapped to xslt.jsp
(as instructed)...
but can't figure out how to specify the xsl file on-the-fly...
that is, if I
don't hard-code the XSL file in the x:xslt element in
the xslt.jsp it
complains about some XML file not having a root element.
Ideal situation:
1. I have a JSP that includes XML elements.
2. It is filled from a database at runtime and specifys
(using a PI) what
XSL stylesheet it is to be processed with.
3. Somehow (fingers crossed) the XML is processed and
transformed into HTML
by the appropriate XSL file.
I think I am mostly stuck moving between steps 2 and 3.
Can anyone give me some hints? Are there some Weblogic
specific
elements/tags that I have to include in the XML file that
Weblogic will
catch and re-direct to the XSL Parser?
Please, anyone, if you have some information, I would
much appreciate it.
Dylan Parker
PS - I apologize for the cross-post, I hope it doesn't
cause too much
traffic.
Maybe you are looking for
-
To Do List item not appearing in Reports
Has anyone had success in implementing the To Do List? I followed the instructions posted on Adobe (written by Peter Grainge): Create a New To Do item (or Edit an existing one) Check it as completed for a topic Add To Do List to the items that will a
-
Printing Euro symbol in smartform
how to print Euro Symbol in smartform. copy paste from MS word is not working.. please tell me another way.. thanks..
-
[solved] pastebinit - Post to pastebin from input process
Hello, I just discovered pastebinit [1] which takes a file name and returns the pastebin URL once uploaded. However, I wonder if there is any way to provide a process input such as from makepkg. I tried the following: pastebinit < makepkg But in that
-
Blue print documents needed.
Hi All, Can anyone please help me with a Blue print document of Negative Time Management and OM. This is immediately required as i have my first project starting. Any assistance will be of great help. Thanks
-
we have the following situation: old server written in C++ running on a defined set of platforms, using rpc to expose its services. modifications of the server should be avoided. what would be the best way to access rpc from java? as I see it (and co