Custom Datatypes and how to get rid of ArrayOfAnyType.

E

Eric Porter

I am writing a Web Service, using ASP.NET. I have two different collections
in a separate DLL, which I want to return from two different WebMethods in
the same Web Service. However, when serialized, both collections appear in
the XML message something like this :

<?xml version="1.0" encoding="utf-8" ?>
<ArrayOfAnyType xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
xmlns="http://eric.the.name.space.com">
<anyType xsi:type="TheRealType">
<OwnerId>Id</OwnerId>
<Key>Key</Key>
</anyType>
<anyType xsi:type="TheRealType">
<OwnerId>Id</OwnerId>
<Key>Key</Key>
</anyType>
</ArrayOfAnyType>

Now, how can I force the WebMethod to make the elements within the array not
be <anyType xsi:type="TheRealType">...</>, but be <TheRealType> ... </>, and
the array not to be ArrayOfAnyType, but to be ArrayOfTheRealType?

Currently, because the two methods return ArrayOfAnyType, it causes a
confusion in .NET, when it creates the temporary C# DLL, and I get an
InvalidCastException (see previous posting).

Thanks.
 
E

Eric Porter

I should add that the <ArrayOfAnyType> nonesense is associated with the HTTP
POST test. If the documentation of the test Web page is to be believed,
using
[return : XmlElement(typeof(TheRealType))]
on the web method definition gives the correct sort of soap message.

But it would be nice if this were worked in the HTTP POST test.

Thanks.
 

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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top