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?
 
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
 
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
 
ross13Author Commented:
Thanks for that. I will give it a try.
0
 
ross13Author Commented:
Thanks for the help.

Best regards,

Ross
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.