Login  Register

Re: Re: multiple instances submission

Posted by Alexandru Ionita on Dec 13, 2009; 8:18am
URL: https://discuss.orbeon.com/multiple-instances-submission-tp954566p962870.html


Ok,

For now I found the solution about building the XPL that will call the webservice and send the appropriate parameters. What I don't know for now is how to send/receive the XML content to/from webservice, since SOAP is not able to handle XML content in the parameters (or at least I don't know how to do make it to accept XML content in the in/out parameters). 

I was thinking to encode/decode the XML before and after calling the webservice. Is this a good idea?

Here is how my XLP looks like:

<p:param name="formData" type="input" debug="form-data"/> 
<p:param name="checkMessages" type="output"/>

<p:processor name="oxf:xslt">
<p:input name="data" href="#formData" />
<p:input name="config">
<xsl:stylesheet version="2.0">
<xsl:template match="/">
<xsl:element name="delegation:execute">
<xsl:attribute name="service">check-form</xsl:attribute>
<xsl:attribute name="operation">checkForm</xsl:attribute>
<xsl:element name="id0">
<xsl:value-of select="/user-response/sapRequestId"/> 
</xsl:element>
<xsl:element name="id1" >
<xsl:copy-of select="/user-response/updatedXformModel"/>
</xsl:element>
</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="formData" href="#formData" debug="form-data"/>
<p:input name="interface">
<config>
<service id="check-form" type="webservice" style="rpc"
endpoint="http://localhost:13569/InvoiceCyclePSNV/services/CheckFormController">
<operation nsuri="urn:avernet" name="checkForm" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</service>
</config>
</p:input>
<p:input name="call" href="#sub-pipeline-config"/> 
<p:output name="checkMessages" ref="checkMessages" />
</p:processor>


regards,
Alexandru




On Fri, Dec 11, 2009 at 10:27, Alexandru Ionita <[hidden email]> wrote:


Hello Erik,

thanks for your reply.

Meanwhile I have changed my logic and what I'm trying to do now is to call a pipeline with two input parameters like this:

<xf:insert nodeset="instance('formCheckMessages')"
               origin="xxforms:call-xpl(
               '<%=StringUtils.getRemoteXplProcessor(StringUtils.CHECK_FORM_PROCESSOR) %>', 
               ('requestId','formData'), 
               (instance('userResponse')/sapRequestId, instance('content')), 'checkMessages')"/>


and the pipe line is like this:


<p:param name="requestId" type="input" debug="req-id"/> 
<p:param name="formData" type="input" debug="form-data"/> 
<p:param name="checkMessages" type="output"/> 
<p:processor name="oxf:delegation">
<p:input name="requestId" href="#requestId" debug="req-id"/>
<p:input name="formData" href="#formData" debug="form-data"/>
<p:input name="interface">
<config>
<service id="check-form" type="webservice" style="document"
<operation name="checkForm" soap-action="checkForm" />
</service>
</config>
</p:input>
<p:input name="call">
<delegation:execute service="check-form" operation="checkForm">
<m:checkForm>
<m:requestId></m:requestId>
<m:formData></m:formData>
</m:checkForm>
</delegation:execute>
</p:input>
<p:output name="checkMessages" ref="checkMessages" />
</p:processor>


</p:config>




but my problem now is that I don't know how to refer these two input parameters inside the webservice call. The first one, requestId, is a long variable and the second, formData, is a xml instance that is backing the xform and I want to send it as it is (xml) to the webservice.


Thanks and regards,
Alexandru 


On Fri, Dec 11, 2009 at 04:33, Erik Bruchez <[hidden email]> wrote:
Alexandru,

Something like this should work:

<xf:submission id="postResponse" method="post"
ref="instance('aggregate')" action="/service/dispatchRequest.do">
   <xforms:action ev:event="xforms-submit">
       <xf:delete nodeset="instance('aggregate')/*"/>
       <xf:insert context="instance('aggregate')" nodeset="*"
origin="instance('userResponse')"/>
       <xf:insert context="instance('aggregate')" nodeset="*"
origin="instance('initialData')"/>
   </xforms:action>
</xf:submission>

<xf:instance id="aggregate">
 <response/>
</xf:instance>

Re. question 2, yes it's possible. You can do this with 2 submissions:

* 1st one submits data to your service implemented in XPL and
retrieves the result
* Upon 1st submission's xforms-submit-done, send 2nd submission

-Erik

On Mon, Dec 7, 2009 at 9:46 AM, Alexandru Ionita
<[hidden email]> wrote:
>
>
> Hello guys,
>
> I have two questions:
>
> 1. How can I submit multiple instances to a J2EE servlet? now I do it like
> this:
>
> <xf:submission id="postResponse" method="post"
> ref="instance('userResponse')" action="/service/dispatchRequest.do"/>
>
> <xf:action ev:event="DOMActivate">
>   <xf:setvalue ref="/user-response/userAction">accept</xf:setvalue>
>   <xf:send submission="postResponse"/>
> </xf:action>
>
> but I want to merge the instance of userResponse with another instance
> available in my model. Something similar to aggregate("response",
> instance('userResponse'), instance('initialData'))   (this is not working
> unfortunately).
>
> and the 2nd question: is there possible to submit this model to a pipe line
> processor, apply some rules on it and then post the final response to the
> particular J2EE servlet.
>
>
> Thank you,
> Alexandru
>
>
> --
> 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
>
>


--
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





--
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