Asked by:
ASMX [WebMethod] - How to accept multiple document

Question
-
User1359467950 posted
Hi there,
My schema has “Documents” element it should contain the “Document” element which should consist of SeqNumber, DocumentId, DocumentType, DocumentContent.
I am at the moment able to send a single file, but what I need is to send multiple documents.
How do I declare the Documents variable so I’m able to accept more than one document. ?
Tuesday, November 21, 2017 10:35 AM
All replies
-
User1168443798 posted
Hi btsAdministr,<o:p></o:p>
>> How do I declare the Documents variable so I’m able to accept more than one document. ?<o:p></o:p>
Could you share us which parameter accepts Documents? Is it DocumentContent?<o:p></o:p>
For accepting multiple values, I think you could try List<T>.<o:p></o:p>
Something like below:<o:p></o:p>
[WebMethod] public string Test(string UserName, [XmlElement(IsNullable =true)] List<byte[]> DocumentContent)
Best Regards,<o:p></o:p>
Edward <o:p></o:p>
Wednesday, November 22, 2017 2:39 AM -
User1359467950 posted
Forgive me but I don't understand.
The XSD shows that the Parent element is called "Documents" (shouldn't I name the List "Documents" then? List<byte[]> Documents ???
The XSD shows that the child elements are SeqNumber, DocumentId, DocumentType, DocumentContent
Now One "Documents" element may contain multiple "Document" element which consists of SeqNumber, DocumentId, DocumentType, DocumentContent
How do I receive 100 documents in one batch and not lose control on which is which ? How do I creacte a variable that will allow to accept 1 or more Documents ?
Kind regards
Thursday, November 23, 2017 2:10 PM -
User1404573039 posted
Hi,
Could you share us how you upload one file in your original scenario?
A simple project with client ans asmx service would be much helpful.
We will try to modify your current code to achieve your requirement.
Tony
Friday, November 24, 2017 8:48 AM -
User753101303 posted
Hi,
My understanding is that you transmit only a single DocumentContent so it should be a list or a an array of byte[]. Name this DocumentContents maybe.
I assume you would then use this content all along with other data to create each document (make sure to not confuse the document and its content)...
Thursday, November 30, 2017 12:14 PM