Ugggh can't get my signup form to work...[API issue]

I don’t think it’s Jodohost’s fault now but I’m getting a Java.Lang.NullPointerException when I run the following code (juicy bits obfuscated) in VB.NET


    Dim aService As New localhost.AdminServicesService




    Dim aContact As New localhost.ContactInfo

    With aContact
        .first_name = Me.FirstName.Text
        .last_name = Me.LastName.Text
        .address1 = Me.Address1.Text
        .address2 = Me.Address2.Text
        .city = Me.City.Text
        .state = Me.State.Text
        .postal_code = Me.Zip.Text
        .country = "USA"
        .phone = Me.Phone.Text
        .email = Me.Email.Text
        .state2 = "na"
        .org_name = "Company"
        .fax = Me.Fax.Text

        .address3 = ""

    End With

    Dim aPayment As New localhost.PaymentInfo

    With aPayment
        If Visa.Checked = True Then
            .cc_type = "Visa"
        ElseIf MasterCard.Checked = True Then
            .cc_type = "Master Card"
        ElseIf Amex.Checked = True Then
            .cc_type = "Amex"
        ElseIf Discover.Checked = True Then
            .cc_type = "Discover"
        End If

        .number = Me.CCNum.Text
        .expDay = CStr(System.DateTime.DaysInMonth(CInt(Me.expYear.Text), CInt(Me.expMonth.Text)))
        .startDay = CStr(System.DateTime.Now.Day)
        .startMonth = CStr(System.DateTime.Now.Month)
        .startYear = CStr(System.DateTime.Now.Year)


        .expMonth = CStr(expMonth.Text)
        .expYear = CStr(expYear.Text)
        .cvv = Me.CVV.Text
        .name = Me.CCNameOnCard.Text

    End With

    Dim authToken As New localhost.AuthToken

    With authToken
        .accountId = <<my reseller account id>>
        .login = <<my reseller user name>>
        .password = <<My Reseller password>>
        Dim arole As New localhost.Role
        arole.accountId = 0
        arole.login = ""
        .role = arole

    End With
    Dim aParam() As localhost.NamedParameter
    Dim planPeriod As Integer

    If Monthly.Checked = True Then
        planPeriod = 0
    Else
        planPeriod = 1

    End If
    Dim aParamw(1) As localhost.NamedParameter
    aParamw(0) = New localhost.NamedParameter

    aParamw(0).name = "domain_name"
    aParamw(0).value = Me.Domain.Text

    aParamw(1) = New localhost.NamedParameter
    aParamw(1).name = "type_domain"
    aParamw(1).value = "transfer_new_misc_domain"

aParam = aService.signupUser(authToken, CInt(Me.PlanType.Text), planPeriod, Me.username.Text, Me.Password.Text, "New Site", aContact, aContact, aPayment, True, "nodomain", aParamw)

I edited the title of the post a little bit for someone that may know to add input, sadly I don’t know the answer here :frowning:

Let me try this another way too, has ANYONE gottan a User Signup to work via the Hsphere API, in ANY language? I’ll learn PHP/Perl/Java/whatever if I must :smiley:

Yes some have, there are a couple that made their own. :slight_smile: A long while back there was a php quick start type script that was used as a base by many, not sure where that is today.

FINALLY, IT WORKED!..well almost Jodohost needs to take a look at a post up above that I think is either their problem or a “user needs an edjumacation problem” so good ole Stephen can oblige I’m sure when he has a chance, but for now I’m gonna get myself crazy drunk after having fought that API for a week…

Anyways this is what finally did it for me:

Dim aService As New adminWeb.AdminServicesService

    Try



        Dim aContact As New adminWeb.ContactInfo

        With aContact
            .first_name = Me.FirstName.Text
            .last_name = Me.LastName.Text
            .address1 = Me.Address1.Text
            .address2 = Me.Address2.Text
            .city = Me.City.Text

'always 2 letters
.state = Me.State.SelectedValue
.postal_code = Me.Zip.Text
'always a 2 letter country code, US is United States (duh)
.country = “US”
.phone = Me.Phone.Text
.email = Me.Email.Text
.state2 = “na”
.org_name = “Company”
.fax = IIf(Me.Fax.Text.Trim() = “”, “NA”, Me.Fax.Text).ToString()

            .address3 = "na"

'ALL contact fields should be filled in, even if a blank or “na” value

        End With

        Dim aPayment As New adminWeb.PaymentInfo

        With aPayment
            If Visa.Checked = True Then
                .cc_type = "Visa"
            ElseIf MasterCard.Checked = True Then
                .cc_type = "Master Card"
            ElseIf Amex.Checked = True Then
                .cc_type = "Amex"
            ElseIf Discover.Checked = True Then
                .cc_type = "Discover"
            End If

            .number = Me.CCNum.Text

'Make sure this is ALWAYS 2 digits
.expDay = Format(System.DateTime.DaysInMonth(CInt(Me.expYear.SelectedValue), CInt(Me.expMonth.SelectedValue)), “00”)

'This needs to be 2 digits too
.expMonth = expMonth.SelectedValue
'This needs to be 4 digits
.expYear = expYear.SelectedValue
.cvv = Me.CVV.Text
.name = Me.CCNameOnCard.Text
'even if obsolete fields these need to be filled in
.issueNo = “”
.startDay = “”
.startMonth = “”
.startYear = “”
.type = “CC”

        End With

        Dim authToken As New adminWeb.AuthToken

        With authToken
            .accountId = <<admin account ID>>
            .login = <<admin user>>
            .password = <<admin password>>

'always needs to be filled in, even if not used
Dim arole As New adminWeb.Role
arole.accountId = 0
arole.login = “”

            .role = arole



        End With
        Dim aParam() As adminWeb.NamedParameter
        Dim planPeriod As Integer

        If Monthly.Checked = True Then
            planPeriod = 0
        Else
            planPeriod = 1

        End If
     

        aParam = aService.signupUser(authToken, CInt(Me.PlanType.Text), planPeriod, Me.username.Text, Me.Password.Text, "New Site", aContact, aContact, aPayment, True)


    Catch ex As Exception

        Response.Write(ex.Message & ex.StackTrace & ex.Source)

        For Each entry As Object In ex.Data

            Response.Write(ex.ToString())




        Next



        'Response.Write(ex.InnerException.Message & ex.InnerException.StackTrace)



    End Try