Hi,
I call EJB methods from my form (e.g. to save specific data using existing methods from a separate application). When I call e.g. a String method the text-serializer does his job, but I haven't figured out how to call a void method (or to ignore the return value). If I remove the p:output from the delegation processor, i get an error which tells me that the output element is missing. When it's there i get a NullPointerException like this one: ERROR ProcessorService - Exception at oxf:/apps/services/new-message.xpl (executing XSLT transformation) java.lang.NullPointerException at org.orbeon.oxf.processor.DelegationProcessor.callMethod(DelegationProcessor.java:469) at org.orbeon.oxf.processor.DelegationProcessor.access$200(DelegationProcessor.java:55) at org.orbeon.oxf.processor.DelegationProcessor$2.endElement(DelegationProcessor.java:381) I use XSLT to get values from the submittet instance and use them as arguments for the EJB method (I don't know if that's the proper way to do this, but I found no other solution). Without XSLT (and static values) the error is the same but starts with: ERROR ProcessorService - Exception at line x, column y of oxf:/apps/services/tm-newtask.xpl (reading processor output: name='data', id='ejb-data') (where x/y points to the end of the delegation-processor output) When i call a 'non-void' method whose return value is not of interest to me (i want to ignore it by removing the text-serializer) the method is not called, nothing happens which leads to the assumption, that the the processor knows that the return value is never used and as a result doesn't invoce the EJB method at all. My question: Is there some kind of argument I can set (at the delegation's output element) to tell the delegation to ignore a potential return value or that there'll never be a return value (cause it's a void method)? Thanks in advance for your help. new-message.xpl: <?xml version="1.0" encoding="utf-8"?> <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" ...> <p:param type="input" name="instance"/> <p:processor name="oxf:xslt"> <p:input name="data" href="#instance"/> <p:input name="config"> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:element name="delegation:execute"> <xsl:attribute name="service">create-task</xsl:attribute> <xsl:attribute name="operation">createMessage</xsl:attribute> <model xsi:type="xs:string"><xsl:value-of select="//id"/></model> <model xsi:type="xs:string"><xsl:value-of select="//message"/></model> </xsl:element> </xsl:template> </xsl:stylesheet> </p:input> <p:output name="data" id="sub-pipeline-config"/> </p:processor> <p:processor name="oxf:delegation"> <p:input name="interface"> <config> <service id="create-task" type="stateless-ejb" uri="FooBar_Client1"/> </config> </p:input> <p:input name="call" href="#sub-pipeline-config"/> <p:output name="data" id="ejb-data"/> </p:processor> <p:processor name="oxf:text-serializer"> <p:input name="data" href="#ejb-data"/> <p:input name="config"> <config/> </p:input> </p:processor> </p:config> -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Administrator
|
On Tue, Mar 11, 2008 at 8:54 AM, <[hidden email]> wrote:
> Is there some kind of argument I can set (at the delegation's output element) > to tell the delegation to ignore a potential return value or that there'll > never be a return value (cause it's a void method)? What you are looking for is entirely reasonable, but right now this is not supported. The code in DelegationProcessor does: result = method.invoke(instance, parameterValues.toArray()).toString(); This code expects the method to return something that can be converted to a string. This is quite limited; I agree. You have a few options to deal with this. You can either: * Change the method to return an empty string, and connect the output of the Delegation processor to a null-serializer. * Change the code of the Delegation processor to support calling methods that don't return anything. And of course, we would really appreciate if you can contribute back your changes. * Use your own custom Java code to call the EJB, for instance through the Java processor (see http://www.orbeon.com/ops/doc/processors-java). Alex -- Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise Orbeon's Blog: http://www.orbeon.com/blog/ Personal Blog: http://avernet.blogspot.com/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Thanks for the quick response. I think my first step will be to make use
of your first suggestion (zero-string + null-serializer). But since that will not always be possible (or at least not without writing an ugly 'wrapper' of some kind) I will definitively take a deeper look at point 2+3. Thanks again. > On Tue, Mar 11, 2008 at 8:54 AM, <[hidden email]> wrote: > >> Is there some kind of argument I can set (at the delegation's output element) >> to tell the delegation to ignore a potential return value or that there'll >> never be a return value (cause it's a void method)? >> > > What you are looking for is entirely reasonable, but right now this is > not supported. The code in DelegationProcessor does: > > result = method.invoke(instance, parameterValues.toArray()).toString(); > > This code expects the method to return something that can be converted > to a string. This is quite limited; I agree. You have a few options to > deal with this. You can either: > > * Change the method to return an empty string, and connect the output > of the Delegation processor to a null-serializer. > * Change the code of the Delegation processor to support calling > methods that don't return anything. And of course, we would really > appreciate if you can contribute back your changes. > * Use your own custom Java code to call the EJB, for instance through > the Java processor (see > http://www.orbeon.com/ops/doc/processors-java). > > Alex > -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Free forum by Nabble | Edit this page |