Delivering xml to customers

Posts   
 
    
neilx
User
Posts: 267
Joined: 02-Nov-2007
# Posted on: 03-Jun-2010 22:02:57   

We sell data from our database using a number of delivery mechanisms - websites, pdf, JET databases and Excel spreadsheets. We are being asked to supply data as XML through a web service. The customers also want us to supply it as validated xml according to their desired xml schema.

Looking at our current (2.6) LLBLGenPro projects, I see we can easily produce good looking compact xml using writexml with the compact25 format. It might not validate against the required customer's xml schema though.

How do I ensure that when delivering the data from the object at runtime via a web service (we are using WCF) that the xml sent to the customer is valid against their external schema? If I need to transform data using XSLT for example, where should that be done?

I have read http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=8174 but much of the discussion was above my head. The main message I got was that it looks like our needs are the kind that are best suited to a web service.

Our customers like the idea that they can get validated data that can be fed into their own systems. Currently, we have problems with compatiblity whenever our db schema changes as well as whenever poor quality data (e.g. badly formed html tags, unwanted control characters...) creep into the data.

Sorry to be vague and general, but I am just starting to get the strategy together for this and would appreciate some pointers that might help me avoid some well-known pitfalls.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 09-Jun-2010 06:10:04   

Hi there,

Sorry for the late response, but this doesn't look like an LLBLGen issue. Anyway, you can do whatever you want with the XML before send it through the wire. For example, pass it through an XSLT and then validate it with a XMLValidator,

public bool ValidateDTE(XmlTextReader dte)
{
    _error = string.Empty;
    _isValid = true;

    XmlSchemaCollection myschema = new XmlSchemaCollection();
    myschema.Add("", _schemaNombreArchivo);

    XmlValidatingReader xmlValidator = new XmlValidatingReader(dte);
    xmlValidator.ValidationType = ValidationType.Schema;
    xmlValidator.Schemas.Add(myschema);
    xmlValidator.ValidationEventHandler += new ValidationEventHandler(xmlValidator_ValidationEventHandler);
    
    while (xmlValidator.Read())
    {
    }
    xmlValidator.Close();

    return _isValid;
}

Sorry if I didn't understand you 100%. May we help you further on this?

David Elizondo | LLBLGen Support Team
neilx
User
Posts: 267
Joined: 02-Nov-2007
# Posted on: 09-Jun-2010 09:06:29   

The only reason for asking this here is that currently we can deliver an LLBLGenPro object from a web service via WCF simply by giving WCF the object.

This is really nice if all we want is well-formed xml. If we need to validate against an external schema and/or do a transform I wondered where the best place to do it would be from LLB's perspective.

I think your answer (thanks alot for a really good one as usual:-) leads me towards validating - then throwing away if valid - the xml before sending the object to WCF.

I'll continue working on that approach. Thanks again.