[lnkForumImage]
TotalShareware - Download Free Software

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


 

Dan

1/22/2003 11:26:00 PM

I've been hearing conflicting information regarding the use of passing
custom classes/structures to web services, and seek clarity.
Is there anything wrong with passing a structure? I currently have a
webservice now that requires 67 variables. I'm passing them as a structure
and it works great. The problem arose when I tried to put a multidimensional
array in the struct. I was greeted with a, "You must specify a default
accessor.. inherits from ICollection." error. I've since learned you cannot
pass a multidimensional array, but was told I could if I passed an XML doc
as a string. If this is true, I'm all for it, but am at a loss as to where
to start (sorta). I've also read a custom class being passed via the
internet is not a viable option with multiple and possible simultaneous
users. Any truth to that?

First, can arrays be passed via XML? Or can I stick with the struct? Or
perhaps a combination of both? Passing an xml document (string) to a
structure and having the webmethod reference it locally?

Second, I can create a new doc with:

Dim xmlDoc As XmlDocument = New XmlDocument()
Dim sb As StringBuilder = New StringBuilder()
Dim strTempXml As String

sb.Append(TextBox1.Value)
sb.Append(TextBox2.Value) ' etc.

strTempXml = sb.ToString()
xmlDoc.LoadXml(strTempXml)

Call Main(strTempXml)

Now I've sent an xml document to my web service, but wouldn't it be better
to pass a string, e.g. Call Main(sb.ToString())? What do I do with the
xmlDoc once it's passed? I envision it working something like this, with a
string being passed as the argument:
Dim xmlDoc As XmlDocument = New XmlDocument
xmlDoc.LoadXml(strTempXml)

and then something to extract the values...
Dim xmlColl As XmlAttributes.Collection = xmlDoc.DocumentElement.Attributes
xmlColl.GetNamedItem("whatever")

Is this correct? Am I way past being confused and in fact, my custom class
IS passing xml?

Any help is GREATLY appreciated and warrants naming my next born after you.