0

I'm using client methods for soap web service. On one of the methods it has a parameter as string[] list, so i create...

string[] myList = { "12345678" };

and i send off the request via the client method but i get an error saying SAXException Found character data inside an array element while deserializing. I know the client method sends this inside the envelope.

<List>12345678</List>

Which is supposed to be like this...

<List><string>12345678</string></List>

I've tried the following and still do not get the result which i need.

[XmlArrayItem("m")]
public string[] list
{
   get; set;
}

i did this to use the class above,

string[] a = new string[] { "12345678" };
list = a;

and the result is the same,

<List>12345678</List>
4
  • Can we see some code? what have you tried already? Looks similar to stackoverflow.com/questions/2815421/… Commented Mar 5, 2013 at 14:24
  • Your actual is result is expected. You are not trying to serialize a list you are trying to serialize multiple strings huge difference. If you want to serialize a collection its possible but requires additional code: stackoverflow.com/questions/126155/… Commented Mar 5, 2013 at 14:32
  • Title edited because the question is not related to C#, but to XML Serialization in general. Commented Mar 5, 2013 at 14:51
  • Ramhound i followed the link you posted but i still can't get the result. any help? Commented Mar 5, 2013 at 16:26

1 Answer 1

0

I had to modify the wsdl in the type it had maxOccurs="Unbounded" type="xsd:string" i changed it to minOccurs="0" maxOccurs="1" type="xsd:ArrayOfString" and regenerate the client code. And it worked. Thanks for the suggestions.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.