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
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6UTmmoBCUMzLIBrQgDUfwlrfLquHQaiYE1cef_HCXyC9dukRHqdGWcxGwU7HymIlmgOYcRtWDOieFIfyuRUcom8-aHtKkNMG6_6YYM37a2PJVyswPyytaw3S0dE-GM30KfOrgGjSSkzWy/s320/esb_xslt_1.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9dW_esylLQF81v6IIYOkAArl4v8fZ1vX7XHNXE7pQwa_6GlfmcTYmKOa2PfloDfAxvsH8_aDNGOMf3Q6p_Hd781W88TgBNmHNq823b7oYn1eFoelZvGfqQL3HslhsUq-K7HQMs5rIrq7F/s320/esb_xslt_2.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-sB9sN7QaM9EG_4VSgS_1yhTtSBg1ECDBU3BYZBphnaVQVxSW7YyJosXuHjedHuvUQDeJTjVUHc2qJaZvA19iAfRQe0KCP4LgcbdsmmQrh8pivo35RnlEk88CUKuv7XIvNeXxo2IC7OKc/s320/esb_xslt_3.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtIw73AxZlcX8_HQ8NVI7s82UkbeyI9klQWIxGPVoc-RU9g3GdSEFeIq4X7t-PCg1ZfkQdm5WkGmnteZSpTvlku0E0bs44U_MhmvqsNTNjJ45S32mcZ3En5_KT3FCLmNntSfRchL7Kt8Gq/s320/esb_xslt_4.png)
That's all
No comments:
Post a Comment