- milestone: --> v1.0 (example)
- priority: 5 --> 9
Hi Daniel,
I am working on a jee application that uses the ServingXML framework in a webservice deployed on jboss application server 4.3.
The way the service is using the framework is transforming documents by pipes of xsl transformations, like in the next example:
<?xml version="1.0" encoding="UTF-8"?>
<sx:resources xmlns:sx="http://www.servingxml.com/core">
<sx:service id="defaultId">
<sx:serialize>
<sx:transform>
<sx:document>
<sx:defaultStreamSource/>
</sx:document>
<sx:xslt>
<sx:urlSource url="META-INF/transformations/file01.xsl"/>
</sx:xslt>
<sx:xslt>
<sx:urlSource url="META-INF/transformations/file02.xsl"/>
</sx:xslt>
</sx:transform>
</sx:serialize>
</sx:service>
</sx:resources>
The Transformation uses streams for input, output, and for the transformation script.
I have written the following adapter code to make use of ServingXML:
public void transform(String user,
String applicationName,
InputStream transformationInputStream,
String serviceName,
InputStream source,
OutputStream destination) throws ServingXmlException {
appDriver = new IocContainerFactory();
appDriver.loadComponentDefinitions(new String[]{"META-INF/components/com/servingxml/core/components.xml"});
paramBuilder = new ParameterBuilder();
parameters = paramBuilder.toRecord();
IocContainer resources = appDriver.createIocContainer(transformationInputStream, parameters);
AppContext appContext = new DefaultAppContext(applicationName, resources);
ServiceContext serviceContext = new DefaultServiceContext(appContext, user);
InputStreamSourceAdaptor inputStreamSource = new InputStreamSourceAdaptor(source);
OutputStreamSinkAdaptor outputStreamSource = new OutputStreamSinkAdaptor(destination);
Flow flow = new FlowImpl(parameters, inputStreamSource, outputStreamSource);
Service service = (Service)appContext.getResources().lookupServiceComponent(Service.class,serviceName);
if (service == null) {
throw new ServingXmlException("Cannot find service " + serviceName + " in transformation script");
}
service.execute(serviceContext, flow);
outputStreamSource.close();
}
The problem is the following:
In a stand-alone (unit-test) environment, everything works fine.
In the deployed environment, the xsl-files (file01.xsl and file02.xsl in the example) cannot be resolved.
I made a jar of my xsl files, put that jar file on the classpath of the server, and expected that META-INF/transformations/file01.xsl
could be resolved. However, servingxml stills says it cannot find <server root>/bin/META-INF/transformations/file01.xsl.
Copying META-INF/transformations/file02.xsl to <server root>/bin works but of course is no option.
Can you tell which error I made?
Many thanks,
Kind regards,
Joost