Passing XML data and providing progress to client.

B

BLUE

I want to pass chunks of an xml file or an entire xml file to my WS.
I'm surprised to see fro MSDN that no System.Xml class is serializable
(XmlDocument, XmlElement and XmlNode):
- I should use a string as the web method parameter?
- to create the string I should use a stream to read the file or there is a
System.Xml method?
- to validate xml on the WS how can I pass the string to the XmlReader?


To provide progress to client I've seen WSE 2.0 documentation and this
article:
http://msdn2.microsoft.com/en-us/library/aa480520.aspx

I want to transfer an xml file of N bytes and to update the progress bar
each time N/100 bytes are transferred.
I think I should analyze data transfer, that is detect a transfer of N/100
and update the progress.

When are data transferred: during serialization (each serialized byte is
automatically sent on the wire) or there is another stage after
AfterSerialize?

Why the article use BeforeDeserialize?
I think it is related not to request (data send) but to response that is
when the web method has returned: the article is processing returned data in
my opinion; moreover it is processing a buffer of 8KB of data not data as
they are received N/100 at a time!
In this way the progress goes faster than real even if it starts after data
are received (the progress bar waits and then it fills quickly): this can
simulate progress only if data are much bigger than 8K (at least 160K).

I think it should analyze request not response but I do not know hot to
monitor fisical data transfer of N/100 bytes.

"In order for a SOAP extension to be invoked for a client application, the
SoapExtension class must be configured appropriately. For a Microsoft
Windows Form application, this involves modifying the application's
configuration file."
The problem is I'm using VS 2003 to develop a Windows CE .Net 4.2
application: configuration files do not exist, so how to tell my app to
use my SOAP extension?


Thanks,
Luigi.
 
M

Marc Gravell

Actually they are - but IXmlSerializable, not [Serializable].

For asmx / WSE, I believe that XmlNode (a base-class) will work OK
(but match the incoming node - there might be a wrapper layer). For
WCF, XmlElement does the business.

Using a string can be a pain for large xml, as the tags will get
escaped in transit (just causes bloat - will be invisible at both
ends).

However; ad-hoc file fragments must be considered completely
separately. Without extensions, each request is broadly atomic, so you
are unlikely to have convenient well-formed xml fragments every <x>
bytes (even with rounding and padding). As such, perhaps consider this
instead as a binary upload (perhaps using MTOM for WSE3; not sure
about WSE2 on CE). Some of the WSE3/WCF demo samples included code for
uploading an image in this way; the idea would be identical for *any*
binary file format. Chunk it; upload it. This way you don't need the
SOAP extensions, and you get a better indication of progress, plus the
ability to resume uploads.

Of course, most things that you can do in configuration can also be
done at runtime, but I don't know what is supported by CE.

Marc
 

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

Top