YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

"My Kingdom for a horse" (actually, just a working BMUpdateButton...) Options
swheeler
#1 Posted : Friday, July 08, 2011 8:44:32 AM
Rank: Starting Member

Groups: Registered

Joined: 6/9/2011
Posts: 3
Location: Minneapolis
Hello,

After an exhaustive search, I've determined that there are no VB/C# code samples available for the Buttom Manager API. So, I've been 'guessing' my way around this part of the SDK and am now tired, frustrated, and at the end of my rope. Your help could actually save my sanity.

I'm attempting to use SOAP protocol in the .NET environment to do an update on Price, but with no success. The code segment below is giving me the following error in the IDE:

Value of type 'com.paypal.soap.api.OptionSelectionDetailsType' cannot be converted to '1-dimensional array of com.paypal.soap.api.OptionSelectionDetailsType'.

The class members seem to support the assignment of Price but the OptionSelectionDetails and OptionDetails types are not cooperating with me.

If anyone else has figured this out, I would be ultra appreciative of a code correction (because I really don't have a Kingdom).

Sincerely,
Scott

Code:

Private Sub PayPal_UpdateButton(ByVal ButtonId As String)

        Dim caller As New CallerServices
        Dim profile As IAPIProfile = ProfileFactory.createSignatureAPIProfile()

        profile.APIUsername = gvEbayUserName
        profile.APIPassword = gvEbayPassword
        profile.APISignature = gvEbaySignature
        profile.Environment = "live"
        caller.APIProfile = profile

        ' Create the request object.
        Dim concreteRequest As New BMUpdateButtonRequestType()

        ' Add request-specific fields.
        concreteRequest.HostedButtonID = ButtonId
        concreteRequest.ButtonType = "BUYNOW"

        Dim tODetails As New com.paypal.soap.api.OptionDetailsType
        Dim tOSDetails As New com.paypal.soap.api.OptionSelectionDetailsType

        tOSDetails.Price = "3.27"
        tOSDetails.OptionSelection = "0"

        tODetails.OptionSelectionDetails = tOSDetails   'Problem is here....

        concreteRequest.OptionDetails = tODetails       'and problem is here.

        ' Execute the API operation and obtain the response.
        Dim pp_response As New BMUpdateButtonResponseType
        pp_response = DirectCast(caller.[Call]("BMUpdateButton", concreteRequest), BMUpdateButtonResponseType)

        Dim SerializedContent As New StringWriter

        Try
            Dim x As New System.Xml.Serialization.XmlSerializer(pp_response.[GetType]())

            x.Serialize(SerializedContent, pp_response)
            Console.WriteLine(SerializedContent.ToString)

        Catch ex As Exception

        End Try

End Sub

Sponsor  
 
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAFVision Theme by Jaben Cargman (Tiny Gecko)
Powered by YAF | YAF © 2003-2009, Yet Another Forum.NET
This page was generated in 0.161 seconds.