Problem with wsdl in application


I am having a problem using a wsdl file and am receiving the following error:

"Unable to generate a temporary class (result=1).
error CS0029: Cannot implicitly convert type 'ParcelForce.ContentData' to 'ParcelForce.ContentData[]'"

I have had a look on the Microsoft site and got the following :

"You can generate the proxy class manually by using WSDL.exe and then change the proxy class in which the data type was inappropriately created as a two-dimensional array (for example, "CustomType[][]") so that it is a single-dimensional array (for example, "CustomType[]"). "

I have generated the proxy class manually but I am unsure what to change (code below):

    <System.Web.Services.Protocols.SoapDocumentMethodAttribute("printLabel", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Bare)> _
    Public Function printLabel(<System.Xml.Serialization.XmlElementAttribute([Namespace]:="")> ByVal PrintLabelRequest As PrintLabelRequest) As <System.Xml.Serialization.XmlElementAttribute("PrintLabelReply", [Namespace]:="")> PrintLabelReply
        Dim results() As Object = Me.Invoke("printLabel", New Object() {PrintLabelRequest})
        Return CType(results(0), PrintLabelReply)
    End Function

Best Regards,

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Miguel OzSoftware EngineerCommented:
You need to search for 'ParcelForce.ContentData'  in your proxy code and check in the WSDL whether is being used as an array, then you can change to ParcelForce.ContentData[]
If more help required, please post the whole proxy code and the WSDL. The posted code does not contain 'ParcelForce.ContentData'
ross13Author Commented:

I have had a look at the wsdl file:
      <xs:complexType name="ContentData">
          <xs:element name="Name" type="xs:string" />
          <xs:element name="Data" type="xs:string" />

and I have checked the proxy and it looks like a class has been created:
<System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.18020"),  _
 System.SerializableAttribute(),  _
 System.Diagnostics.DebuggerStepThroughAttribute(),  _
 System.ComponentModel.DesignerCategoryAttribute("code"),  _
 System.Xml.Serialization.XmlTypeAttribute([Namespace]:="")>  _
Partial Public Class ContentData
    Private nameField As String
    Private dataField As String
    Public Property Name() As String
            Return Me.nameField
        End Get
            Me.nameField = value
        End Set
    End Property

I am a bit unsure what to change. Any help would be appreciated.

Best Regards,

Miguel OzSoftware EngineerCommented:
OK, I think your problem is located in the lines below:
 Private parcelContentsField()() As ContentData
Public Property ParcelContents() As ContentData()()

Replace with:
 Private parcelContentsField() As ContentData
Public Property ParcelContents() As ContentData()

Notice that you may have some issues especially with unbounded arrays as explained here. My suggestion will be to use other schema code generator like

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ross13Author Commented:
Thanks for that. I will give it a try.
ross13Author Commented:
Thanks for the help.

Best regards,

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.