Mongocxx driver validate JSON document agains schema - c++

our situation is the following:
our Linux based C++ application uses MongoDB (mongocxx) for data management. In another are of the product, we have few JSON files (like configurations).
The problem is that the current JSON parser framework doesn't supports schema validation, however checking Mongocxx documentation, I had a feeling, that it has.
The question would be, can I use the mongo driver for validate custom JSON document (json string) against JSON Schema?
And I strongly want to avoid any client - server communication towards to mongodb. The only reason to ask this question is that I try to find a way how to perform validation, and now, I see, that we rely on MongoCXX as third-party, and if possible we can use to do this or on the other hand, we have to make plan to replace our JSON parser thirdparty to another one that has Schema validation capability

Related

Library enabling to use triple store with Django

I need to create quickly a simple web application - an interface for querying a triple store. Previously I made such an application with Django for querying a graph database Neo4j, I used the Neomodel package for binding Django and Neo4j.
Is there such a package for using Django with a triple store? I have already installed Fuseki and have my data in turtle format.
On this page: http://csarven.ca/how-to-create-a-linked-data-site it is explained how to to do what I need but using PHP, which I have no notion of. Since I don't have much time to waste, I would prefer to work with the pythonic Django, already familiar to me.
If you want to work with Django, you're lucky, because Python has a libary that helps you to work with triple store, called RDFlib, based on RDF. RDFlib Docs
The Resource Description Framework (RDF) is a family of World Wide Web Consortium (W3C) specifications originally designed as a metadata data model. It has come to be used as a general method for conceptual description or modeling of information that is implemented in web resources, using a variety of syntax notations and data serialization formats. It is also used in knowledge management applications. Wikipedia
Working specifically in Django, it's hard to give a guideline because the question is wide. Maybe you can find some packages to help you in Django Packages

Restful Service for GET and PUT on XML as source?

Is it possible to develop Restful services for GET,PUT, POST and DELETE using an XML file as data source? I am using Netbeans 6.5.1 . Any references which I could use?
Sure, you can. You need to create a REST controller with the different REST methods (anotated with #GET, POST, ...). These methods will need to access the xml file. You should have a dedicated class for managing the file (with CRUD operations, etc.).
I think you can automatically generate your web service skeleton with netbeans but as it's not my IDE I am not sure. Anyway writing a REST resource is very simple. Look for Jersey examples as I guess you will select this library.

WSDL runtime validation with JAX-WS

We are developing an MDA platform that has support for Web Services. The user can provide a WSDL in runtime and we generate all the artifacts (service interface and implementation for the server, and consumer for the client) using JAX-WS internally.
We want to add validation on the WSDL document provided by the user. Right now the user has to validate that with an external tool like Oxygen, XMLSpy or a web tool, but we want to add that as a part of our system. A nice-to-have feature would be schema validation aswell, including the embedded schemas of the WSDLs.
In JAX-WS (RI) there is support for schema validation in runtime (using the #SchemaValidation annotation) but we haven't found any support for WSDL validation.
We've tried to integrate Eclipse's WSDL validator but it doesn't seem to work for us.
Is there any way of doing this with JAX-WS?
If not, is there any other validation framework that we can integrate?
Thanks
There is a bit of confusion in your question that I need to clarify first.
You seem to want the ability to validate the WSDL (syntax + WS-I) and XSDs, either embedded or referenced externally by the WSDL. On the other hand you bring in #SchemaValidation, which is actually used to validate instance documents.
In a traditional development approach, one might say you want at least the ability to validate design-time artifacts (WSDL+XSDs).
For this scenario then, I would recommend the following:
WSDL: for WS-I compliance testing, please take a look at the test tools section of the WS-I site. It is not clear how the licensing they have with their test tooling would work with yours, but at least it should give you an idea for what to look if it doesn't work for you.
UPDATE: Additional WSDL validation resources:
- Eclipse based, how to use outside Eclipse.
XSDs: if you really need separate validation for XSD files, things may get tricky for a production quality product; WSDL4J is not much help here, and I believe XSOM is the way to go for this kind of job. You have to extract content from the types section as one or more XSD files (could be more than one XSD file, take a look at some examples, Microsoft's SharePoint WSDLs come to my mind as a good test case), assign a base uri for each extracted XSD that matches the WSDLs location, then use XSOM to validate those.
Since you're generating the client, you're most likely not concerned with validating, say of the HTTP headers (SOAP 1.1/HTTP, SOAPAction, if it matches the WSDL operation definition). If you end up developing an interest in that as well, which I call runtime validation, then I would recommend a different layout in your approach (i.e. I would not rely on #SchemaValidation but rather do it through a transparent, and generic, proxy service).

Fetching remote database info from a client application

What would be the preferred method of pulling content from a remote database?
I don't think that I would want to pull directly from the database for a number of reasons.
(Such as easily being able to change where it is fetching the info from and a current lack of access from outside the server.)
I've been thinking of using HTTP as a proxy to the database basically just using some PHP to display raw text from the database and then grabbing the page and dumping it to a string for displaying.
I'm not exactly sure how I would go about doing that though. (Sockets?)
Right now I am building it around a blog/news type system. Though the content would expand in the future.
I've got a similar problem at the moment, and the approach I'm taking is to communicate from the client app with a database via a SOAP web service.
The beauty of this approach is that on the client side the networking involved consists of a standard HTTP request. Most platforms these days include an API to perform basic HTTP client functions. You'll then also need an XML or JSON parser to parse the returned SOAP data, but they're also readily available.
As a concrete example, a little about my particular project: It's an iPhone app communicating with an Oracle database. I use a web service to read data from the database and send the data to the app formatted in XML using SOAP. The app can use Apple's NSURLConnection API to perform the necessary HTTP request. The XML is then parsed using the NSXMLParser API.
While the above are pretty iPhone-specific (and are Objective-C based) I think the general message still applies - there's tools out there that will do most of the work for you. I can't think of an example of an HTTP API offhand, but for the XML parsing part of the equation there's Xerces, TinyXML, Expat...
HTH!
You might look at using AJAX (I recommend JSON instead of XML though). This is the technology underlying Google Maps.

RESTful interface for C++/Qt?

I want to integrate the RESTful-API in my Qt-Project.
I already read the example on this page, but this is only for receiving data from a RESTful-interface, not for sending new data to the server. In Java, I can use RESTlet for example, is there any possibility to use something like that for Qt, too?
Or is there even a simple way to send data from Qt to RESTful, for example when I create a XML before?
Since REST is just normal URL access, there's no reason you can't use the Qt HttpClient interfaces to talk to you backend Java REST interface. You just have to make a determination to use XML or JSON - both have very capable libraries available, and both are just text interfaces.
Odd you ask, I'm in the middle of doing this very thing myself today - I'm implementing a JSON based REST interface in Java, and I'll wire up the plumbing to my Qt app shortly.
I'll make an effort to update this answer as I progress.