XML as a Parameter in a WebService

K

Kentamanos

I'm creating a webservice that basically takes multiple batches with
financial transactions in them.

Due to the various options available in each transaction (lots of optional
sections, etc.), I figured that making the list of batches an XmlElement
parameter would be easier than a custom collection type class and trying to
work out the XML serialization/de-serialization.

I created a schema to be used on the server side to do some validation of
the input. Some additional validation (beyond the scope of what a schema can
do) will be also be done on this XML input.

One issue I'm running into with this approach is returning validation errors
that are meaningul. When the client loads an XML document into the
XmlDocument class, it loses all the formatting from the original file (if
it's not happening internally at that point, it's happening when it's
serialized and de-serialized in any event).

So the webservice receives an XmlElement without the original formatting.
When I have schema validation errors for instance that I might want to
inform the client about, the errors won't refer to the original line numbers
at all (in fact, I think the entire document will be on one line).

Is there any remedy to this problem? Should I pass this as a string and
create an XmlDocument on the fly if I want to maintain the formatting?

Thanks in advance for any input, and please let me know if I need to further
explain anything.

-Kent Bowling
 
K

Kentamanos

DOH! Newbie mistake that I finally found with some more searching. Setting
the XmlDocument.PreserveWhitespace property solved the problem.

Sorry for the spam :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top