In trying to access a webservice, i ran into the "Error 1 value of type cannot be converted to '1-dimensional array ..." when I try to pass the XML based structure to the webservice.
I have added a webservice to the VB.Net Project and it is referencing the information from the webservice OK. but I haven't figured out what I need to do to pass the information itself on to the webservice. I get the error near the end

Private Function testcall() As String
        Dim str As String
        Dim wb As New localhost.Service
        Dim myresult As New localhost.ResponseType
        Dim bankinfo As New localhost.SFNInvestmentBankAccountInfoType

        str = ""

        bankinfo.BankAccountName = "ACME Systems Chemical Combine"
        bankinfo.BankAccountNumber = "11111111"
        bankinfo.BankIdentificationNumber = "22221111"
        bankinfo.BankName = "Valley Special"
        bankinfo.CMBSYN = True
        bankinfo.CMBSYNSpecified = True
        bankinfo.DateCreated = CDate("10-6-2008")
        bankinfo.DateCreatedSpecified = True
        bankinfo.InvestmentId = "333333"
        bankinfo.InvestmentIdSpecified = True
        bankinfo.InvestmentNumber = "444444"
        bankinfo.RecordActiveYN = True
        bankinfo.RecordActiveYNSpecified = True
        bankinfo.TaxId = "11133311"
        bankinfo.versionID = "10001"

      'error happens here
       myresult = wb.createBankAccountInformation(CType(bankinfo, localhost.SFNInvestmentBankAccountInfoType))
          Return str
    End Function

The webservice was created using WSDL.exe to create the vb skeleton for the webservice project. it compiles and plublishes Ok without any warnings or errors. A couple of test functions work Ok, but they aren't using a XML array or complex structure to get information out of.

The webservice function starts out like this:

<WebMethod()> _
        Public Overrides Function createBankAccountInformation(<System.Xml.Serialization.XmlArrayAttribute([Namespace]:="http://xxxxx.com/realestate/ea/types"), System.Xml.Serialization.XmlArrayItemAttribute("SFNInvestmentBankAccountInfo", IsNullable:=False)> ByVal SFNInvestmentsBankAccountInfo() As SFNInvestmentBankAccountInfoType) As <System.Xml.Serialization.XmlElementAttribute("Response", [Namespace]:="http://xxxxxxxx.com/realestate/ea/types")> ResponseType
        Dim results() As Object = Me.Invoke("createBankAccountInformation", New Object() {SFNInvestmentsBankAccountInfo})

Thank you very much,
I appreciate it a lot.

8 Years
Discussion Span
Last Post by earlwbollinger

ByVal SFNInvestmentsBankAccountInfo() As SFNInvestmentBankAccountInfoType

means that an array of SFNInvestmentsBankAccountInfoType should be passed to web method. Also the result is an array:

Dim myresult() As localhost.ResponseType
Dim bankinfo(0) As New localhost.SFNInvestmentBankAccountInfoType
bankinfo(0).BankAccountName = "ACME Systems Chemical Combine"
bankinfo(0).versionID = "10001"

myresult = wb.createBankAccountInformation(bankinfo)

yes that did it.
Thank you so very much.
I was over complicating things in trying to get it to work. When in fact it was very simple.
Thanks Again.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.