Quantcast

Exide and getting remote document over RESTful web service - header problems

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Exide and getting remote document over RESTful web service - header problems

Jozef Aerts

using version 3.0RC1

I have a RESTful web service on another (remote) server returning structured documents in either XML or JSON.
My XQuery script is (simplified):
let $webservice := concat('http://www.xml4pharmaserver.com:8080/CDISCCTService/rest/CDISCCoreFromSDTMVariable/1.4/',$itemgroupdefname,'/',$variablename)
        let $webserviceresult := data(doc($webservice)/XML4PharmaServerWebServiceResponse/Response)  (: returns 'Req', 'Exp', or 'Perm' :)

But I get a parsing error when I run the code in eXide. The reason seems to be that the server is sending JSON back instead of XML, although it also has a:
// returns XML
    @GET
    @Produces("application/xml")
    public String getSDSVariableInfoXML(@Context HttpServletRequest req,    
            @PathParam("sdsversion") String sdsversion,
            @PathParam("sdsvarname") String sdsvarname) { ... }

The order of the methods in the class is XML, then JSON, then text.

I added some code on the server to find out what is received, and it looks as the HTTP GET request does not contain any headers when it comes from eXide.
When I run the XQuery from within a Java client program, everything runs fine: server says "accept-header" is "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2".

As I need to develop a lot of new XQuery-s, I would of course like to develop and test them in eXide.
Is there a way that I can state in eXide that the "GET" that is executed by "doc($webservice)" must have a header requesting to return XML? Or do I need to change any eXide settings for that? Or is there anything I can do on the server (I am using Jersey) in my class to have XML returned when the GET request does not contain any headers?

Many thanks in advance,

Jozef


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

syntax highlighting Swing component for XQuery

Jozef Aerts
My apologies when this is slightly off-topic, but it might be important for getting acceptance for XQuery (and native XML databases) at the FDA (US Food and Drug Administration).

We are currently using XQuery and eXist for validating electronic submissions to the FDA in XML format. For this, we developed an open-source review tool that FDA reviewers can use (Java Swing based). The tool comes with hundreds of XQuery "rule implementations" that can be applied to the electronic submission.

We now want the users to be able to see the XQuery code that is implementing each of the rules in a user-friendly way, so that users can see and understand how exactly the rule has been implemented (this in contradiction to "black box" implementations). Syntax coloring would of course be great for this.

I have been looking for something like a JTextPane with syntax coloring for XQuery, but haven't found anything. If someone knows about something like that or knows about source code that can be used, please let me know. It would save us a lot of time.

Ultimate goal is that we convince the FDA to start using native XML databases. This however requires that we deliver them the tools to work with XML and XQuery.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: syntax highlighting Swing component for XQuery

Dmitriy Shabanov


On Fri, Feb 17, 2017 at 11:44 AM, Jozef Aerts <[hidden email]> wrote:
My apologies when this is slightly off-topic, but it might be important for getting acceptance for XQuery (and native XML databases) at the FDA (US Food and Drug Administration).

We are currently using XQuery and eXist for validating electronic submissions to the FDA in XML format. For this, we developed an open-source review tool that FDA reviewers can use (Java Swing based). The tool comes with hundreds of XQuery "rule implementations" that can be applied to the electronic submission.

We now want the users to be able to see the XQuery code that is implementing each of the rules in a user-friendly way, so that users can see and understand how exactly the rule has been implemented (this in contradiction to "black box" implementations). Syntax coloring would of course be great for this.

I have been looking for something like a JTextPane with syntax coloring for XQuery, but haven't found anything. If someone knows about something like that or knows about source code that can be used, please let me know. It would save us a lot of time.

You can give a try to RSyntaxTextArea

Ultimate goal is that we convince the FDA to start using native XML databases. This however requires that we deliver them the tools to work with XML and XQuery.


--
Dmitriy Shabanov

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: syntax highlighting Swing component for XQuery

Adam Retter
In reply to this post by Jozef Aerts
Hi Jozef,

If you need a read-only view of the code (which it sounds like), then
your best bet would be to use Pygments (http://pygments.org/) and then
render the output from that in whatever application you have.

Pygments is quite mature, and I recently added some support to it for
eXist specific syntax conventions.

Another similar alternative there is xqlint -
https://github.com/wcandillon/xqlint#syntax-highlighting

If you need something this an editable view of the code, then you
could talk to the Oxygen guys and see if they have Java components
that you could license. Otherwise, if you need to build something
yourself you could use Antlr4 and one of the available XQuery
grammars, to get an AST with line and column numbers that you could
then use to inform syntax highlighting.

Cheers Adam.

On 17 February 2017 at 08:44, Jozef Aerts <[hidden email]> wrote:

> My apologies when this is slightly off-topic, but it might be important for getting acceptance for XQuery (and native XML databases) at the FDA (US Food and Drug Administration).
>
> We are currently using XQuery and eXist for validating electronic submissions to the FDA in XML format. For this, we developed an open-source review tool that FDA reviewers can use (Java Swing based). The tool comes with hundreds of XQuery "rule implementations" that can be applied to the electronic submission.
>
> We now want the users to be able to see the XQuery code that is implementing each of the rules in a user-friendly way, so that users can see and understand how exactly the rule has been implemented (this in contradiction to "black box" implementations). Syntax coloring would of course be great for this.
>
> I have been looking for something like a JTextPane with syntax coloring for XQuery, but haven't found anything. If someone knows about something like that or knows about source code that can be used, please let me know. It would save us a lot of time.
>
> Ultimate goal is that we convince the FDA to start using native XML databases. This however requires that we deliver them the tools to work with XML and XQuery.
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Exist-open mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/exist-open



--
Adam Retter

eXist Developer
{ United Kingdom }
[hidden email]
irc://irc.freenode.net/existdb

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: syntax highlighting Swing component for XQuery

Jozef Aerts

Many thanks!

Yes, all we need is "read-only". I looked into the options that you and Dmitriy provided and these at least give me a good start.
As our tool is open-source Java application, a Java solution would of course be very nice. But I am also thinking of maybe setting up a web service that the tool can send XQuery to and which returns formatted HTML.

Many thanks!

Jozef

P.S. In case I use RSyntaxTextArea (shouldn't be too hard to write another "mode") I will of course make the new source code public.

Adam Retter <[hidden email]> hat am 17. Februar 2017 um 14:01 geschrieben:

Hi Jozef,

If you need a read-only view of the code (which it sounds like), then
your best bet would be to use Pygments (http://pygments.org/) and then
render the output from that in whatever application you have.

Pygments is quite mature, and I recently added some support to it for
eXist specific syntax conventions.

Another similar alternative there is xqlint -
https://github.com/wcandillon/xqlint#syntax-highlighting

If you need something this an editable view of the code, then you
could talk to the Oxygen guys and see if they have Java components
that you could license. Otherwise, if you need to build something
yourself you could use Antlr4 and one of the available XQuery
grammars, to get an AST with line and column numbers that you could
then use to inform syntax highlighting.

Cheers Adam.

On 17 February 2017 at 08:44, Jozef Aerts <[hidden email]> wrote:

My apologies when this is slightly off-topic, but it might be important for getting acceptance for XQuery (and native XML databases) at the FDA (US Food and Drug Administration).

We are currently using XQuery and eXist for validating electronic submissions to the FDA in XML format. For this, we developed an open-source review tool that FDA reviewers can use (Java Swing based). The tool comes with hundreds of XQuery "rule implementations" that can be applied to the electronic submission.

We now want the users to be able to see the XQuery code that is implementing each of the rules in a user-friendly way, so that users can see and understand how exactly the rule has been implemented (this in contradiction to "black box" implementations). Syntax coloring would of course be great for this.

I have been looking for something like a JTextPane with syntax coloring for XQuery, but haven't found anything. If someone knows about something like that or knows about source code that can be used, please let me know. It would save us a lot of time.

Ultimate goal is that we convince the FDA to start using native XML databases. This however requires that we deliver them the tools to work with XML and XQuery.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot

_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open

--
Adam Retter

eXist Developer
{ United Kingdom }
[hidden email]
irc://irc.freenode.net/existdb


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Loading...