How to Pass List to SOAP API request from android
I know how to pass normal object, but at the time of passing the List I'm getting following exception Unable to cast object of type 'GTCFWebServices.Models.ToEmail'
to type 'System.Collections.Generic.List1[GTCFWebServices.Models.ToEmail]
'.
This is expected soap xml
request I need to pass List< ToEmail >
as a request.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:gtc="http://schemas.datacontract.org/2004/07/GTCFWebServices.Models">
<soapenv:Header/>
<soapenv:Body>
<tem:SendEmailNotificationToScannedUser>
<!--Optional:-->
<tem:fromEmail>
<!--Optional:-->
<gtc:ActivationCode>6wDQ8</gtc:ActivationCode>
<!--Optional:-->
<gtc:Email>?</gtc:Email>
<!--Optional:-->
<gtc:IsEmailHasToSent>true</gtc:IsEmailHasToSent>
<!--Optional:-->
<gtc:Name>Snehal Jadhav</gtc:Name>
<!--Optional:-->
<gtc:PhoneNumber>?</gtc:PhoneNumber>
<!--Optional:-->
<gtc:ProfileImageName>?</gtc:ProfileImageName>
<!--Optional:-->
<gtc:UniversityImageName>?</gtc:UniversityImageName>
<!--Optional:-->
<gtc:UniversityName>?</gtc:UniversityName>
</tem:fromEmail>
<!--Optional:-->
<tem:scannedUsers>
<!--Zero or more repetitions:-->
<gtc:ToEmail>
<!--Optional:-->
<gtc:Body>body</gtc:Body>
<!--Optional:-->
<gtc:CC>
<!--Zero or more repetitions:-->
<gtc:Contact>
<!--Optional:-->
<gtc:Email>?</gtc:Email>
<!--Optional:-->
<gtc:FirstName>?</gtc:FirstName>
<!--Optional:-->
<gtc:LastName>?</gtc:LastName>
</gtc:Contact>
</gtc:CC>
<!--Optional:-->
<gtc:ScannedUserId>1</gtc:ScannedUserId>
<!--Optional:-->
<gtc:Subject>?</gtc:Subject>
<!--Optional:-->
<gtc:To>
<!--Zero or more repetitions:-->
<gtc:Contact>
<!--Optional:-->
<gtc:Email>?</gtc:Email>
<!--Optional:-->
<gtc:FirstName>?</gtc:FirstName>
<!--Optional:-->
<gtc:LastName>?</gtc:LastName>
</gtc:Contact>
</gtc:To>
</gtc:ToEmail>
</tem:scannedUsers>
</tem:SendEmailNotificationToScannedUser>
</soapenv:Body>
</soapenv:Envelope>
It is not possible to pass complex object like a list of complex object as a parameter in SOAP request.
Finally, I passed String concatenating with, (comma) for a list and then API side we separated it and created a list.