Problem with wsdl in vb.net application

Hi,

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 :
http://support.microsoft.com/kb/2486643

"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]:="http://www.parcelforce.net/ws/ship/v9")> ByVal PrintLabelRequest As PrintLabelRequest) As <System.Xml.Serialization.XmlElementAttribute("PrintLabelReply", [Namespace]:="http://www.parcelforce.net/ws/ship/v9")> PrintLabelReply
        Dim results() As Object = Me.Invoke("printLabel", New Object() {PrintLabelRequest})
        Return CType(results(0), PrintLabelReply)
    End Function


Best Regards,

Ross
ross13Asked:
Who is Participating?

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

x
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'
0
ross13Author Commented:
Hi,

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

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]:="http://www.parcelforce.net/ws/ship/v9")>  _
Partial Public Class ContentData
   
    Private nameField As String
   
    Private dataField As String
   
    '''<remarks/>
    Public Property Name() As String
        Get
            Return Me.nameField
        End Get
        Set
            Me.nameField = value
        End Set
    End Property

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

Best Regards,

Ross
wsdl.txt
Proxy.txt
0
Miguel OzSoftware EngineerCommented:
OK, I think your problem is located in the lines below:
 Private parcelContentsField()() As ContentData
and
Public Property ParcelContents() As ContentData()()

Replace with:
 Private parcelContentsField() As ContentData
and
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 https://xsd2code.codeplex.com/xsd2code
0

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.
0
ross13Author Commented:
Thanks for the help.

Best regards,

Ross
0
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.