error-handling

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

error-handling

Peter.Heintz
Hello all,
I am using XForms to edit data persistent stored in an SQL Data Base. These data of cause have some constraints and have to be validated there for.

One possibility I use so far, is a XML schema that works fine. An other part of constraints is defined in my database schema like uniqueness or referential integrity.

If data offend against the database schema OPS collect this information in a default error page that I can modify to my needs.
However I would prefer to have for the user the same behaviour as it is if there is a violation of the XML schema.

In other words I want to extract some of the exception information coming from my database by a customised error pipeline what I want to use to modify my XForms instance to show an error message and the invalid input filed causing the violation in the original form.

Here are my questions:
Is that possible?
How do I get access to the XForms instance within the error-pipline?
How do I call back my page original page with the modified XForms instance?
Are there more elegant ways to do that?

Thank you in advance
-Peter



--
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: init instance

Aline Grente
Hi,

I'd like to initialize a xform instance with a webservice result, is
there a solution to do that ?

regards

Aline



--
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: init instance

Alessandro  Vernet
Administrator
Hi Aline,

I assume that you are using OPS 3.0 beta. In this case:

1) Call the web service from the model XPL (an XPL referenced from the
model="..." attribute in the page flow).
2) In that XPL connect the "data" output of the delegation processor
to the "data" output of the XPL.
3) Make the view an XSL file and insert the instance with something
like: <xforms:instance><xsl:copy-of select="/*"/></xforms:instance>.

Does this make sense?

Alex

On 9/2/05, Aline Grente <[hidden email]> wrote:

> Hi,
>
> I'd like to initialize a xform instance with a webservice result, is
> there a solution to do that ?
>
> regards
>
> Aline
>
>
>
>
> --
> 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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: error-handling

Alessandro  Vernet
Administrator
In reply to this post by Peter.Heintz
Hi Peter,

The best way to handle this would be to catch the exception thrown by
the SQL processor in XPL. However you can't do this at this point as
exception handling is not supported yet by the XPL engine.

In the meantime you can get around this if you are using OPS 3.0 beta.
When the user clicks on the "submit" button, your run an
<xforms:submission replace="instance">. This will post XML at a URL,
which runs a pipeline as defined in your page flow. That pipeline
calls the SQL processor, and if it succeeds returns XML directly to
XForms; if it fails, your error.xpl will run which you write to return
XML pointing to the invalid field. Then in XForms you can make the
appropriate input field invalid based on the document returned by the
XForms submission.

Alex

On 9/2/05, [hidden email] <[hidden email]> wrote:

> Hello all,
> I am using XForms to edit data persistent stored in an SQL Data Base. These data of cause have some constraints and have to be validated there for.
>
> One possibility I use so far, is a XML schema that works fine. An other part of constraints is defined in my database schema like uniqueness or referential integrity.
>
> If data offend against the database schema OPS collect this information in a default error page that I can modify to my needs.
> However I would prefer to have for the user the same behaviour as it is if there is a violation of the XML schema.
>
> In other words I want to extract some of the exception information coming from my database by a customised error pipeline what I want to use to modify my XForms instance to show an error message and the invalid input filed causing the violation in the original form.
>
> Here are my questions:
> Is that possible?
> How do I get access to the XForms instance within the error-pipline?
> How do I call back my page original page with the modified XForms instance?
> Are there more elegant ways to do that?
>
> Thank you in advance
> -Peter
>
>
>
>
> --
> 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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: init instance

Aline Grente
In reply to this post by Alessandro Vernet
Hi,

I'm ok with 1 and 2, that's what I did, but I try to find a solution
to initialize the xform instance without using xsl.
Is there a solution to send a submission without a user action ?
( to use replace="instance" )

Aline


2005/9/2, Alessandro Vernet <[hidden email]>:

> Hi Aline,
>
> I assume that you are using OPS 3.0 beta. In this case:
>
> 1) Call the web service from the model XPL (an XPL referenced from the
> model="..." attribute in the page flow).
> 2) In that XPL connect the "data" output of the delegation processor
> to the "data" output of the XPL.
> 3) Make the view an XSL file and insert the instance with something
> like: <xforms:instance><xsl:copy-of select="/*"/></xforms:instance>.
>
> Does this make sense?
>
> Alex
>
> On 9/2/05, Aline Grente <[hidden email]> wrote:
> > Hi,
> >
> > I'd like to initialize a xform instance with a webservice result, is
> > there a solution to do that ?
> >
> > regards
> >
> > Aline
> >
> >
> >
> >
> > --
> > 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
>
>
>


--
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: Re: error-handling/oxf:xforms-output processor bug?

Peter.Heintz
In reply to this post by Alessandro Vernet
Hello Alex,
At the moment I am still working with version 2.8. I want to switch to 3.0 after I have the feeling that I understand OPS well enough. I also have the feeling that for 3.0 there is not jet the documentation completely finished so I am afraid that I waste to much time. Would you recommend me to switch to 3.0?

However it seems that I also found a solution (not a nice one) by using the scope processors.
The only problem that seems to be left is that I assume a bug in the oxf:xforms-output processor called by the epilogue.

From my understanding it creates the valid attribute for validation. I introduces an invalid attribute as somehow suggested XForms Reference 10.1. Custom Validation.

Instead of using the bind element I introduced the attribute as prohibited in my XML-schema.
This works fine as long as I do not try the introduce any constraints e.g. using xs:string as base and extending this element by the prohibited attribute.
I have the feeling if I do so, the constraint is checked but the constraint of not having an invalid attribute is ignored.

This work
       
<xs:complexType name="Invalid.Type">
  <xs:attribute name="invalid" use="prohibited"/>
</xs:complexType>

This not

<xs:complexType name="Invalid.Type">
  <xs:simpleContent>
    <xs:extension base="xs:string">
      <xs:attribute name="invalid" use="prohibited"/>
    </xs:extension>
  </xs:simpleContent>
</xs:complexType>

Any ideas?

-Peter



--
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: init instance

Erik Bruchez
Administrator
In reply to this post by Aline Grente
Aline,

 > I'm ok with 1 and 2, that's what I did, but I try to find a solution
 > to initialize the xform instance without using xsl.

Assuming the usual pattern which is:

o Page model produces an XForms model or an initialized XForms
   instance (or subset thereof)

o Page view (XHTML + XForms) is a template which must eventually
   contain the above mentioned model or instance

Then a mechanism must be found by which the page view can include the
data produced by the page model. So far, since XSLT page views are
very easy to write (especially with the simplified stylesheet module
approach, which consists in only adding xsl:version="2.0" on the root
element of the template) and directly supported by the PFC, this has
been the preferred option.

Now other options should certainly be possible, and I am thinking in
particular about XInclude. However at the moment XInclude URLs do not
support the "input:*" scheme. If it was, ideally you could use
something like this in a static page view:

   <xforms:model id="my-main-model">
     <xforms:instance id="my-instance-initialized-from-page-model">
       <xi:include href="input:data"/>
     </xforms:instance>
   </xforms:model>

However, this does not work at the moment. I added an RFE to track
this:

http://forge.objectweb.org/tracker/index.php?func=detail&aid=304097&group_id=168&atid=350210

Otherwise, you are free to implement your own inclusion mechanism in
the page view, by using an XPL page view. In there, you could pass a
static page view and the dynamic result of the page model to your own
processor doing an inclusion. This is a little more complicated
though, and you would have to explain why you don't want to use XSLT
in the first place (one thing that comes to mind is performance, and I
assume for example we can make XInclude more efficient than XSLT).

 > Is there a solution to send a submission without a user action ?
 > ( to use replace="instance" )

Can you explain in more details what you mean here?

-Erik

 > 2005/9/2, Alessandro Vernet <[hidden email]>:
 >
 >>Hi Aline,
 >>
 >>I assume that you are using OPS 3.0 beta. In this case:
 >>
 >>1) Call the web service from the model XPL (an XPL referenced from the
 >>model="..." attribute in the page flow).
 >>2) In that XPL connect the "data" output of the delegation processor
 >>to the "data" output of the XPL.
 >>3) Make the view an XSL file and insert the instance with something
 >>like: <xforms:instance><xsl:copy-of select="/*"/></xforms:instance>.
 >>
 >>Does this make sense?
 >>
 >>Alex
 >>
 >>On 9/2/05, Aline Grente <[hidden email]> wrote:
 >>
 >>>Hi,
 >>>
 >>>I'd like to initialize a xform instance with a webservice result, is
 >>>there a solution to do that ?
 >>>
 >>>regards
 >>>
 >>>Aline




--
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: error-handling/oxf:xforms-output processor bug?

Erik Bruchez
Administrator
In reply to this post by Peter.Heintz
[hidden email] wrote:

 > At the moment I am still working with version 2.8. I want to switch
 > to 3.0 after I have the feeling that I understand OPS well enough. I
 > also have the feeling that for 3.0 there is not jet the
 > documentation completely finished so I am afraid that I waste to
 > much time. Would you recommend me to switch to 3.0?

To OPS 3.0 final, certainly! To OPS 3.0 beta, sure, if you are just a
tad adventurous. Some further elements of answer about this:

o OPS 2.8 is officially stable, OPS 3.0 beta is not. However, OPS 3.0
   beta is quite usable at this point, as we have done our best not to
   destabilize the code base.

o If you are using XForms, 3.0 is a huge leap forward in functionality
   compared to 2.8.

o 3.0 also fixes numerous bugs and provides new features which may be
   useful to you even if you don't use XForms or even if you just plan
   to use the classic XForms engine in 3.0, which is still present for
   backward compatibility.

o 3.0 is not really harder to use than 2.8, on the contrary, however:

   o It provides much better XForms support, and that comes with more
     XForms to learn, in particular XForms events, various types of XML
     submission, etc.

   o If you have been using XForms with 2.8 and are migrating to the
     new XForms engine in 3.0, there are some changes to make and some
     new usage patterns to adapt to. We have to reckon that this part
     may be a little confusing to long-time OPS users, but it is
     inevitable.

My opinion is that if you plan to use the latest and greatest XForms
engine, you will be better off going straight to 3.0 and there is no
real benefit staying with 2.8.

 > However it seems that I also found a solution (not a nice one) by
 > using the scope processors.

Not sure what you are referring to as I missed the beginning of this
conversation, but please let us know if you need more help on this.

 > The only problem that seems to be left is that I assume a bug in the
 > oxf:xforms-output processor called by the epilogue.
 >
 > From my understanding it creates the valid attribute for
 > validation. I introduces an invalid attribute as somehow suggested
 > XForms Reference 10.1. Custom Validation.
 >
 > Instead of using the bind element I introduced the attribute as
 > prohibited in my XML-schema.  This works fine as long as I do not
 > try the introduce any constraints e.g. using xs:string as base and
 > extending this element by the prohibited attribute.  I have the
 > feeling if I do so, the constraint is checked but the constraint of
 > not having an invalid attribute is ignored.
 >
 > This work
 >
 > <xs:complexType name="Invalid.Type">
 >   <xs:attribute name="invalid" use="prohibited"/>
 > </xs:complexType>
 >
 > This not
 >
 > <xs:complexType name="Invalid.Type">
 >   <xs:simpleContent>
 >     <xs:extension base="xs:string">
 >       <xs:attribute name="invalid" use="prohibited"/>
 >     </xs:extension>
 >   </xs:simpleContent>
 > </xs:complexType>

Not sure about this. Can you try running this through another schema
validator to see what the result is?

Note that XForms instance annotation has had some fixes with OPS 3.0
for the legacy XForms engine (the new XForms engine does not use
instance annotations).

-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