0

I use the .wsdl file and svcutil.exe to generate related .cs File, The generated .cs File is like the following:

 public partial class mytargettype {

    [System.ServiceModel.MessageBodyMemberAttribute(Namespace = "", Order = 0)]
    [System.Xml.Serialization.XmlArrayAttribute()]
    [System.Xml.Serialization.XmlArrayItemAttribute("item", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
    public string[] prop1;

    [System.ServiceModel.MessageBodyMemberAttribute(Namespace = "", Order = 1)]
    [System.Xml.Serialization.XmlArrayAttribute()]
    [System.Xml.Serialization.XmlArrayItemAttribute("item", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
    public string[] prop1;

    [System.ServiceModel.MessageBodyMemberAttribute(Namespace = "", Order = 2)]
    [System.Xml.Serialization.XmlArrayAttribute()]
    [System.Xml.Serialization.XmlArrayItemAttribute("item", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
    public string[] prop3;

    [System.ServiceModel.MessageBodyMemberAttribute(Namespace = "", Order = 3)]
    [System.Xml.Serialization.XmlArrayAttribute()]
    [System.Xml.Serialization.XmlArrayItemAttribute("item", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
    public System.Nullable<int>[] prop4;

}

The related part of .wsdl file is :

 <wsdl:message name="mytargettype">
    <wsdl:part name="prop1" type="ns1:stringArray" />
    <wsdl:part name="prop2" type="ns1:stringArray" />
    <wsdl:part name="prop3" type="ns1:stringArray" />
    <wsdl:part name="prop4" type="ns1:intArray" />
  </wsdl:message>

So, I need the generated .cs file be like:

 [System.ServiceModel.MessageBodyMemberAttribute(Namespace = "", Order = 2)]
 [System.Xml.Serialization.XmlArrayAttribute(Namespace = "http://jaxb.dev.java.net/array")]
 [System.Xml.Serialization.XmlArrayItemAttribute("item", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
 public string[] prop3;

As you see I need the XmlArrayAttribute have Namespace parameter,

what change need Add to .WSDL File that caused the .cs file be like the above.

Saeid
  • 13,224
  • 32
  • 107
  • 173

1 Answers1

0

I think somewhere in your WSDL you have a part like this:

<xs:complexType name="stringArray" final="#all">
    <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="unbounded" name="item" nillable="true" type="xs:string" />
    </xs:sequence>
</xs:complexType>

Changing this to the following may solve your problem:

<xs:complexType name="stringArray" wsdl:arrayType="xs:string" mixed="true">
    <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="unbounded" name="item" nillable="true" type="xs:string" />
    </xs:sequence>
</xs:complexType>
Achilles
  • 1,554
  • 1
  • 28
  • 36
  • 1
    That's exactly why I've indicated "the problem you're facing". The main reason must be a non-standard-compliant implementation of the service that in most cases is out of reach for the consumer of the service. – Achilles Jan 29 '13 at 07:19