Dynamic submission to an eXist REST interface

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Dynamic submission to an eXist REST interface

mjgraham
Hi,

I have some instances:

<xf:instance id="record">
  <Person>
    <Name Id="">...
    ...
  </Person>
</xf:instance>
<xf:instance id="refid">
  <form>
    <refid/>
  </form>
</xf:instance>

and also a binding linking the two:

<xf:bind nodeset="instance('record')/Name/@Id"
calculate="xs:integer(instance('refid')/refid) * 2"/>

Now the value of refid is set with a select1 control and then the form
is submitted with:

<xf:submission id="main" ref="instance('record')" method="put"        
action="/exist/rest/db/people/{instance('refid')/refid}.xml"
replace="none"/>

Now this works fine; however, I really want the form to be sent to:

<xf:submission id="main" ref="instance('record')" method="put"        
action="/exist/rest/db/people/{instance('record')/Name/@Id}.xml"
replace="none"/>

but this does not work. I have tried using a setvalue instead of a bind,
a recalculate and also an element containing the Id instead of an
attribute but none work. Any ideas?

    Cheers,

    Matthew



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: Dynamic submission to an eXist REST interface

Ryan Puddephatt
Do you have the xs namespace, because I've had a problem with that before.
Have you also tried an xforms:output to make sure the value is being set?

Ryan

Ryan Puddephatt
Software Engineer

Teleflex Group - IT UK
1 Michaelson Square
Livingston
West Lothian
Scotland
EH54 7DP

e> [hidden email]
t> +44(0)1506 407 110
f> +44(0)1506 407 108

 

>-----Original Message-----
>From: Matthew Graham [mailto:[hidden email]]
>Sent: 01 November 2006 07:59
>To: [hidden email]
>Subject: [ops-users] Dynamic submission to an eXist REST interface
>
>Hi,
>
>I have some instances:
>
><xf:instance id="record">
>  <Person>
>    <Name Id="">...
>    ...
>  </Person>
></xf:instance>
><xf:instance id="refid">
>  <form>
>    <refid/>
>  </form>
></xf:instance>
>
>and also a binding linking the two:
>
><xf:bind nodeset="instance('record')/Name/@Id"
>calculate="xs:integer(instance('refid')/refid) * 2"/>
>
>Now the value of refid is set with a select1 control and then
>the form is submitted with:
>
><xf:submission id="main" ref="instance('record')" method="put"        
>action="/exist/rest/db/people/{instance('refid')/refid}.xml"
>replace="none"/>
>
>Now this works fine; however, I really want the form to be sent to:
>
><xf:submission id="main" ref="instance('record')" method="put"        
>action="/exist/rest/db/people/{instance('record')/Name/@Id}.xml"
>replace="none"/>
>
>but this does not work. I have tried using a setvalue instead
>of a bind, a recalculate and also an element containing the Id
>instead of an attribute but none work. Any ideas?
>
>    Cheers,
>
>    Matthew
>
>



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic submission to an eXist REST interface

Erik Bruchez
Administrator
In reply to this post by mjgraham
Matthew,

 > I have some instances:
 >
 > <xf:instance id="record">
 >  <Person>
 >    <Name Id="">...
 >    ...
 >  </Person>
 > </xf:instance>
 > <xf:instance id="refid">
 >  <form>
 >    <refid/>
 >  </form>
 > </xf:instance>
 >
 > and also a binding linking the two:
 >
 > <xf:bind nodeset="instance('record')/Name/@Id"
 > calculate="xs:integer(instance('refid')/refid) * 2"/>
 >
 > Now the value of refid is set with a select1 control and then the form
 > is submitted with:
 >
 > <xf:submission id="main" ref="instance('record')" method="put"
 > action="/exist/rest/db/people/{instance('refid')/refid}.xml"
 > replace="none"/>
 >
 > Now this works fine; however, I really want the form to be sent to:
 >
 > <xf:submission id="main" ref="instance('record')" method="put"
 > action="/exist/rest/db/people/{instance('record')/Name/@Id}.xml"
 > replace="none"/>
 >
 > but this does not work. I have tried using a setvalue instead of a bind,
 > a recalculate and also an element containing the Id instead of an
 > attribute but none work. Any ideas?

No, an xforms:recalculate before xforms:send should do the trick! Note
that we have an XForms erratum that will make the manual recalculate
unneeded in such cases.

If the above still doesn't work, can you build a reproducible example
that runs in the sandbox? Thanks,

-Erik

--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/




--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic submission to an eXist REST interface

mjgraham
Hi,

It turns out that this was caused by a permissions problem with eXist: I
was changing the permissions on the collections where the documents are
stored to writable by the guest group with the Admin client GUI but it
transpires that this was not resetting them properly whereas using a
"command line" chmod <resource> group=+write works fine.

As a slight aside, what is the recommended method to set
username/password information to the REST API from within a XForms? Are
the xxforms:user and xxforms:password supported?

    Cheers,

    Matthew

Erik Bruchez wrote:

> Matthew,
>
> > I have some instances:
> >
> > <xf:instance id="record">
> >  <Person>
> >    <Name Id="">...
> >    ...
> >  </Person>
> > </xf:instance>
> > <xf:instance id="refid">
> >  <form>
> >    <refid/>
> >  </form>
> > </xf:instance>
> >
> > and also a binding linking the two:
> >
> > <xf:bind nodeset="instance('record')/Name/@Id"
> > calculate="xs:integer(instance('refid')/refid) * 2"/>
> >
> > Now the value of refid is set with a select1 control and then the form
> > is submitted with:
> >
> > <xf:submission id="main" ref="instance('record')" method="put"
> > action="/exist/rest/db/people/{instance('refid')/refid}.xml"
> > replace="none"/>
> >
> > Now this works fine; however, I really want the form to be sent to:
> >
> > <xf:submission id="main" ref="instance('record')" method="put"
> > action="/exist/rest/db/people/{instance('record')/Name/@Id}.xml"
> > replace="none"/>
> >
> > but this does not work. I have tried using a setvalue instead of a
> bind,
> > a recalculate and also an element containing the Id instead of an
> > attribute but none work. Any ideas?
>
> No, an xforms:recalculate before xforms:send should do the trick! Note
> that we have an XForms erratum that will make the manual recalculate
> unneeded in such cases.
>
> If the above still doesn't work, can you build a reproducible example
> that runs in the sandbox? Thanks,
>
> -Erik
>
> ------------------------------------------------------------------------
>
>
> --
> 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
> ObjectWeb mailing lists service home page: http://www.objectweb.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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws