First I start with a java class which returns the whole soap header, this class need to have static methods.
package nl.whitehorses.esb.xslt.functions.headers;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import oracle.tip.esb.server.headers.ESBHeaderContext;
import org.w3c.dom.Element;
import oracle.xml.parser.v2.XMLDocument;
public class ESBCustomFunctions {
public static String getHeader() throws IOException {
Element requestHeader = ESBHeaderContext.getRequestHeader();
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
((XMLDocument)requestHeader.getOwnerDocument()).print(pw);
return sw.toString();
}
}
This class need the oraesb.jar to complie, this is located at your soa suite home.
Make a jar deployment profile and put this jar in the extension folder of your JDeveloper ( jdev\extensions ) and restart JDeveloper.
Next step is to make a User defined extension function config file. This file is a xml where we register our getHeader method.
<?xml version="1.0" encoding="UTF-8"?>
<extension-functions>
<functions xmlns:customESBFunctions="http://www.oracle.com/XSL/Transform/java/nl.whitehorses.esb.xslt.functions.headers.ESBCustomFunctions">
<function name="customESBFunctions:getHeader" as="string">
</function>
</functions>
</extension-functions>
Use this file in the xsl maps tab of the JDeveloper preferences




That's all
No comments:
Post a Comment