[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.webservices

XML as a Parameter in a WebService

Kentamanos

7/14/2003 7:40:00 PM

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


1 Answer

Kentamanos

7/14/2003 7:59:00 PM

0

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

Sorry for the spam :)

"Kentamanos" <kent_bowling_HATES_SPAM@hot,mail.com> wrote in message
news:eMvpn%23jSDHA.2196@TK2MSFTNGP12.phx.gbl...
> 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
>
>