开发者

WCF - Is using a generic in your datacontract going to make your WSDLs non-interoperable?

Basically:

[DataContract(Namespace = "http://www.abc.com/foo" Name = "Get{0}Request")]
public class GetGenericRequest<T> { ... }

my WSDL has this verbatum:

<xs:complexType name="GetFooRequest">
  <xs:annotation>
    <xs:appinfo>
      <GenericType xmlns="http://schemas.microsoft.com/2003/10/Serialization/" Name="Get{0}Request" Namespace="http://www.abc.com/foo">
        <GenericParameter Name="Foo" Namespace="http://www.abc.com/foo"/>开发者_C百科;
      </GenericType>
    </xs:appinfo>
  </xs:annotation>
  <xs:sequence>
    <xs:element xmlns:q2="http://schemas.microsoft.com/2003/10/Serialization/Arrays" minOccurs="0" name="Ids" nillable="true" type="q2:ArrayOfint"/>
  </xs:sequence>
</xs:complexType>
<xs:element name="GetFooRequest" nillable="true" type="tns:GetFooRequest"/>

So, looking at that it just does not seem that this would be interoperable. It has the extra "appinfo" stuff that would probably throw things off for Java or PHP right? or would they just ignore that?

Also, what's even more strange is that whether I use int[] or ICollection<int>, etc it still makes the type ArrayOfint (which, I get that it changes all underlying collections that it understands to an array. But, is that naming interoperable?)


It is interoperable - for clients it's just as if you have a non-generic class, named GetFooRequest. As for the collections, again, the name doesn't (or shouldn't) matter, as long as the schema of the element <xs:sequence> of <xs:int>, is "standard".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜