function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Claudio Ungaro 5Claudio Ungaro 5 

login failed for "Unable to generate a temporary class (result=1).\r\n ..... " error CS0030" Error

Good afternoon,
I have tried to use the code above but i receive this error:
e.Message = "There was an error in serializing one of the headers in message loginRequest: 'Unable to generate a temporary class (result=1).\r\nerror CS0030: Cannot convert type 'SF_Connector1.SoapApi.ListViewRecordColumn[]' to 'SF_Connector1.SoapApi.ListViewRecordColu... etc.
Googling around i found some answers to that "generic" error saying there is an dimensional array mismatch, but i have been unable to apply the suggested corrections.
I reduced the code to the very minimal section oflogin but the bug appears into the line

lr = ss.login(Nothing, "hello@hello.com.au", "Yourpassword" & "Security Token")

Of course i replaced the variable with my own login data.
Anyone can help?
This is the very last part i have to implement in my procedure and begin to be very frustrated for the impossibility to do it.
Thank you in advance.
PS, i am using VS2015, vb.net,  net framework 3.5
Claudio
Best Answer chosen by Claudio Ungaro 5
Daniel BallingerDaniel Ballinger
If you hover over the answer you want to accept a "Best Answer" checkbox should appear.

User-added image

All Answers

Daniel BallingerDaniel Ballinger

I've made some notes about this in a blog post Importing the Salesforce Winter 15 Partner API to .NET

To fix it, find the XmlArrayItemAttribute attribute that is generated for ExecuteListViewResult.records in the References file.

With C# it needs to be changed to:

[System.Xml.Serialization.XmlArrayItemAttribute("columns", typeof(ListViewRecordColumn[]), IsNullable=false)]
VB.net will be similar. Something like:
<System.Xml.Serialization.XmlArrayItemAttribute("columns", GetType(ListViewRecordColumn()), ...

The changes is adding the array notation in typeof/GetType.
Claudio Ungaro 5Claudio Ungaro 5
Thank you Daniel,
Your answer unlocked the login procedure that is now working like a charms, so i went on with developing the user interface.
Now back to the SF section i am unable to do any other operation and i receive the dreadful
ex.Message = "UNKNOWN_EXCEPTION: Destination URL not reset. The URL returned from login must be set in the SforceService".
I have recechked all the code and i am pretty sure that the endpoint URL is properly set:

Login destination url
Endpoint = Address={https://login.salesforce.com/services/Soap/c/35.0}

Url obtained from Login()
Endpoint = Address={https://na28.salesforce.com/services/Soap/c/35.0/00D80000000LPbi}

Any suggestion?
I already went trough all the similar questions but unable to find out an answer  for it.
Thank you in advance

 
Daniel BallingerDaniel Ballinger
Are you taking the LoginResult Url and using it to change the "ss" Url property?

Basically you send the first request to the login.salesforce.com/... URL. All subsequent requests go to the URL returned in the LoginResult.
Claudio Ungaro 5Claudio Ungaro 5
Daniel,
Yes i appreciate the need to put the received url into the subsequent calls and is what i do (at least is my intention)
Here is my code, whre in the yellow lines I cache the new URL addresse.
 
Public Function loginSF() As Boolean
        If LoggedIn Then
            MsgBox("You are already logged in!", vbOKOnly)
            Return False
        End If
        Dim loginClient As SoapClient = New ApexApi.SoapClient
        Dim Username As String = "my username"
        Dim Password As String = "mypword+token"
        loginClient = New SoapClient()
        Try
            Console.WriteLine(vbLf & "Logging in..." & vbLf)
            lr = loginClient.login(Nothing, Username, Password)
        Catch ex As Exception
            MsgBox("An unexpected error has occurred: " & vbCrLf & ex.Message)
            Return False
        End Try
        If lr.passwordExpired Then
            Console.WriteLine("An error has occurred. Your password has expired.")
            Return False
        End If
        Dim endpoint As New EndpointAddress(lr.serverUrl)
        Header.sessionId = lr.sessionId
        ' Create and cache an API endpoint client
        Dim client As New SoapClient("Soap", endpoint)
        Return True
    End Function

    Private Sub btnLogOut_Click()
        'works well
    End Sub

    Private Sub btnGlobalSample_Click(sender As Object, e As EventArgs) Handles btnGlobalSample.Click
        Try
            Client.describeGlobal(Header, Nothing, dgr)
            txtResult.Text = ""
            txtResult.Text = "Describe Global Results:" & vbLf
            ' Loop through the array echoing the object names to the console
            For i As Integer = 0 To dgr.sobjects.Length - 1
                txtResult.Text = (dgr.sobjects(i).name) + vbCrLf
            Next
        Catch ex As Exception
            MsgBox("An exception has occurred: " & vbCrLf & ex.Message & vbLf & "Stack trace: " & vbCrLf & ex.StackTrace)
        End Try
    End Sub
This is the code i translated from C# that is into the "Soap API developer guide 16"
Thank you in advance for your support

         
Claudio Ungaro 5Claudio Ungaro 5
Hello daniel, Sorted out.... i had to reread a few times my own and others code and i seen the light ...
Thank you.
 
Daniel BallingerDaniel Ballinger
Great. I think you can mark this question as solved so that it doesn't show up as requiring further attention.
Claudio Ungaro 5Claudio Ungaro 5
I'd like to do it with please, how?
I looked around and haven't found anywhere to do it.
Thank you
Daniel BallingerDaniel Ballinger
If you hover over the answer you want to accept a "Best Answer" checkbox should appear.

User-added image
This was selected as the best answer