Announcement

Collapse
No announcement yet.

MvCALL on Ebay

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    MvCALL on Ebay

    Every time I try to set up a new channel I run into issues with MvCall (probably because I am just really dense). In this case I am trying to work with the API's on eBay and I keep getting the same response no matter how I format the call. I am trying to send an xml string.

    The data setup:
    <MvASSIGN NAME = "l.sendxml" VALUE = "{ encodeentities('<?xml version="1.0" encoding="utf-8"?><GetOrdersRequest xmlns="urn:ebay:apis:eBLBaseComponents"> ..... </GetOrdersRequest>') }">
    <MvASSIGN NAME = "l.headers" VALUE = "{'X-EBAY-API-COMPATIBILITY-LEVEL:857 ..... X-EBAY-API-CALL-NAME:GetOrders'}">
    <MvASSIGN NAME="l.dataformat" VALUE="xml">
    <MvASSIGN NAME = "AccessURL" VALUE = "{'https://api.sandbox.ebay.com/ws/api.dll'}">

    The calls:
    <MvCALL
    ACTION="{AccessURL}"
    METHOD="POST"
    FIELDS = "l.headers, l.dataformat, l.sendxml">
    <MvEVAL EXPR="{callvalue}">
    </MvCALL>

    <MvCALL
    ACTION="{AccessURL}"
    HEADERS="{l.headers}"
    METHOD="POST"
    FIELDS = "l.dataformat, l.sendxml">
    <MvEVAL EXPR="{callvalue}">
    </MvCALL>

    <MvCALL
    ACTION="{AccessURL}"
    HEADERS="{l.headers}"
    METHOD="POST"
    CONTENT-TYPE = "text/xml"
    FIELDS = "l.sendxml">
    <MvEVAL EXPR="{callvalue}">
    </MvCALL>


    I have also tried appending the xml data to the url but that didn't work either.

    The result sent back is:
    <ShortMessage>
    <![CDATA[ Unsupported verb. ]]>
    </ShortMessage>

    Any ideas?

    Thanks
    DonB
    Don Barnett
    Farm & Home Supply Center

    #2
    Re: MvCALL on Ebay

    It's hard to diagnose this without seeing the rest of your request code and headers.

    A Google search for "unsupported verb ebay api" returned a number of pages with info on this error. They're all pretty old; you might want to check the latest documentation before taking their advice.

    I don't know how good eBay is at replying to tech-support requests for info like this. I've had good results getting info from companies like Amazon and PayPal, so that might be worth atry.

    Hope that helps --
    Last edited by Kent Multer; 02-07-14, 09:40 AM.
    Kent Multer
    Magic Metal Productions
    http://TheMagicM.com
    * Web developer/designer
    * E-commerce and Miva
    * Author, The Official Miva Web Scripting Book -- available on-line:
    http://www.amazon.com/exec/obidos/IS...icmetalproducA

    Comment


      #3
      Re: MvCALL on Ebay

      Don,

      MvCall can be tricky because how you can get it to work in any particular environment can depend a lot of who you are talking to (with the call).

      Here's a few things to try.

      1) Set method to "XML"

      2) Put a space after the MvCall statement and the call back value (yea, I know...sounds stupid but I swear it worked once).

      There are others, but try those first as the next methods would be kind of hackish. (BTW: XML in the URL almost never works...ok, never works that I've ever heard/seen)
      Bruce Golub
      Phosphor Media - "Your Success is our Business"

      Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
      phosphormedia.com

      Comment


        #4
        Re: MvCALL on Ebay

        I have attached my test file ( I had to attach it as a .txt because it said .mv was an invalid file type). It has 3 different test. Tests 1 & 3 returns with:
        <ShortMessage>
        <![CDATA[ Unsupported verb. ]]>
        </ShortMessage>

        Test 2 also returns with the same error unless I try to add HEADERS="l.headers" to the call in which case it returns with:
        Line 48: MvCALL: SSL Read Timeout

        I have tried it with HEADERS="l.headers" and HEADERS="{l.headers}" Both return the same result.

        I paid eBay for support but they do not know miva and they don't log calls on the sandbox so they were of no help. The did however verify that the header keys are correct and that the token embedded in the xml is correct.

        If you have any ideas they would be greatly appreciated.

        Thanks
        DonB
        Attached Files
        Don Barnett
        Farm & Home Supply Center

        Comment


          #5
          Re: MvCALL on Ebay

          Don, using the following code:

          Code:
          <MIVA STANDARDOUTPUTLEVEL="html,text,compresswhitespace">
          
          <MvASSIGN NAME = "l.headers" VALUE = "{'X-EBAY-API-COMPATIBILITY-LEVEL:857
          X-EBAY-API-DEV-NAME:1507daf9-3913-47a4-9817-b12016f9475b
          X-EBAY-API-APP-NAME:Creative-d255-48c7-9ae8-6d6cdb79ca2a
          X-EBAY-API-CERT-NAME:dab7ebf1-a4a6-4376-9871-dd08d4864bf4
          X-EBAY-API-SITEID:0
          X-EBAY-API-CALL-NAME:GetOrders'}">
          
          <MvASSIGN NAME = "l.sendxml" VALUE = "{ '<?xml version="1.0" encoding="utf-8"?><GetOrdersRequest xmlns="urn:ebay:apis:eBLBaseComponents"><CreateTimeFrom>2014-02-05T00:00:00.000Z</CreateTimeFrom><CreateTimeTo>2014-02-05T23:59:59.999Z</CreateTimeTo><RequesterCredentials><eBayAuthToken>AgAAAA**AQAAAA**aAAAAA**xMzzUg**nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6wFk4GhC5iBqQWdj6x9nY+seQ**GFECAA**AAMAAA**quD+wRNO6JtZMnoB6RgsWJWBXpUgb3uYSHPdgeFu7ydFMJM+TAx8x0ubOMs4OkIMwdpeBMJvQD4Fpj2poxjmvy5uKPX+QDNAQLDHgdhiz7p+6TAWflvkDNvXtJuHRW46sRir+ZIVNLy+6/dYtIfCAlsTvZlnNGxIIIABZL7GQaNrysQGO/DoZNVJWjohqG//in5g7lXNseyhR03+BWvw7GIuSuHkhOF2F1xWeB5cGTasLIIx8EZ2cGgPi6IMCE9ciho0hubstk2pAB83Iuyu2xI/GgBFzkCBxRcCImmN8h8wtd6olfGj3ei8jQ4i5Sib1BbU0F6Q03fGGiS6HbgF7/FOWIjjqm9VRKaaCr7DdM/Pqy0Z9wbzDlr5Es56Axv34JuwF9tgAiJaqqWAOKLeIl76dK+4hT1ojQkwp81Yt5wXLafkiA1jVsafTYwG01Oinz3O84zybY9To0sXu/x90WMN/zbYsExP62wcLlQRcWvv6LDXRQoqMNDNS/6gBKu/oCNWKLKsOsiztQ3esi2hS4syIZnA6TFY3U0kXXs85BTL2AvvXkmHvB9s8NpltGYemaeG5ZF1Q4ZHgRtl3+j0y04fu2izFcyuvIKp04Kh+Uj0IYsOBRNe6biwrvLZwD4yU8rYl5rAazHdbqtaIwxzYSYCjMegXuSGegjv3gU5OuZtrl01EhF5mbwkKDzwxZSjFpiFYqtWHYqWrw6JpU7Mmf8VQWAZeDbJu6B4OoyzJZeHdMeC47ufNMI4JbXMtoM/</eBayAuthToken></RequesterCredentials><WarningLevel>High</WarningLevel></GetOrdersRequest>' }">
          
          
          	<MvASSIGN NAME = "AccessURL" VALUE = "{'https://api.sandbox.ebay.com/ws/api.dll'}">
          	<MvCALL
          		ACTION="https://api.sandbox.ebay.com/ws/api.dll"
          		METHOD="XML"
          		FIELDS = "l.headers, l.sendxml">
          
          			<MvEVAL EXPR="{callvalue}">
          
          	</MvCALL>
          	<mvif expr="{ g.MvCall_Error }">
          		<mveval expr="{ g.MvCall_Error }">
          	</mvif>
          I get:

          2014-02-08 02:57:57 Failure Unsupported API call. The API call "GeteBayOfficialTime" is invalid or not supported in this release. 2 Error RequestError 16631620

          As I said, i usually use Method="XML" cause it works better with most systems. Also, Better to create separate test files. You had a couple of typo errors that may have invalidated certain attempts.

          Additionally, try to debug things step wise. For example, the first thing to try is an MvCall just to the url.
          Then, add the headers, then the actual content.
          Bruce Golub
          Phosphor Media - "Your Success is our Business"

          Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
          phosphormedia.com

          Comment


            #6
            Re: MvCALL on Ebay

            Well, I haven't seen the docs, but I doubt that the eBay API requires the XML in an uploaded file. This is a pretty short message, plenty small enough to manage in RAM; writing it to a file just adds overhead. So let's rule out test 3.

            The fact that all your tests get the same error tells us that it's caused by something that is the same for all of them. Can eBay tell you which part of the message is the "verb?" Is that a header, or the first XML tag?

            POST data is generally URL-encoded, which Miva Script does with the encodeattribute() function. I see you used encodeentities() in your test; that could be a problem. Actually, I'm pretty sure the MvCALL does this encoding automatically for all the data that you pass in the FIELDS attribute.

            If you use the HEADERS attribute, its value has to be an expression; i.e., if you want to use a variable name, you need to enclose it in braces.

            If you use METHOD="XML" in your MvCALL, you don't need to write a Content-Type header.

            Headers need to be separated by a "crlf:" asciichar(13) followed by asciichar(10). If you just type the Enter key on your computer, you may be putting in something else. I always write these separators explicitly to be safe.

            Here's a snippet from one of my own modules that illustrates the usage pretty well. It sets up a header for authentication with a username and password.
            Code:
            <MvASSIGN NAME="l.crlf" VALUE="{ asciichar(13) $ asciichar(10) }">
            <MvASSIGN NAME="l.auth" VALUE="{ crypto_base64_encode(g.My_settings:user $ ':' $ g.My_settings:pass) }">
            <MvASSIGN NAME="l.headers" VALUE="{ 'Authorization: Basic ' $ l.auth $ l.crlf }">
            <MvASSIGN NAME="l.xml" VALUE="{ ...variable or expression containing XML text ... }">
            
            <MvCALL METHOD="XML" ACTION="{ My_settings:url }" HEADERS="{ l.headers }" FIELDS="l.xml">
            Note that ACTION and HEADERS require bracces, but METHOD and FIELDS don't.

            HTH --
            Kent Multer
            Magic Metal Productions
            http://TheMagicM.com
            * Web developer/designer
            * E-commerce and Miva
            * Author, The Official Miva Web Scripting Book -- available on-line:
            http://www.amazon.com/exec/obidos/IS...icmetalproducA

            Comment


              #7
              Re: MvCALL on Ebay

              Thanks for the input.
              Well some progress. I am now getting the phrase (The API call "GeteBayOfficialTime" is invalid or not supported in this release) as did Bruce, which tells me at least the other end is reading the xml. I believe the problem is in the header. I reformatted the header to include crlf code as suggested by Kent so no my header line looks like:

              <MvASSIGN NAME = "l.headers" VALUE = "{'X-EBAY-API-COMPATIBILITY-LEVEL:857' $ l.crlf $ 'X-EBAY-API-DEV-NAME:1507daf9-3913-47a4-9817-b12016f9475b' $ l.crlf $ 'X-EBAY-API-APP-NAME:Creative-d255-48c7-9ae8-6d6cdb79ca2a' $ l.crlf $ 'X-EBAY-API-CERT-NAME:dab7ebf1-a4a6-4376-9871-dd08d4864bf4' $ l.crlf $ 'X-EBAY-API-SITEID:0' $ l.crlf $ 'X-EBAY-API-CALL-NAME:GeteBayOfficialTime'}">


              I then tried 3 different calls. They are:
              1) NO Header
              <MvCALL
              ACTION="{AccessURL}"
              METHOD="XML"
              FIELDS = "l.sendxml">


              2: Header in FIELDS
              <MvCALL
              ACTION="{AccessURL}"
              METHOD="XML"
              FIELDS = "l.headers, l.sendxml">


              3: Header in HEADERS
              <MvCALL
              ACTION="{AccessURL}"
              METHOD="XML"
              HEADERS="{l.headers}"
              FIELDS = "l.sendxml">

              Calls 1 and 2 give the same result with the unsupported call message. The 3rd call gives an (SSL Read Timeout) error. The timeout error comes regardless of whether I format the headers line with or without braces. Not sure if that means anything or not.

              Thanks for the help
              Donb
              Don Barnett
              Farm & Home Supply Center

              Comment


                #8
                Re: MvCALL on Ebay

                Don,

                I'd first focus on the error: GeteBayOfficialTime not supported.

                I believe your header format is not correct (i just quickly read a PHP version of the protocol). It looks like it should be:

                X-EBAY-API-COMPATIBILITY-LEVEL:857, X-EBAY-API-DEV-NAME:1507daf9-3913-47a4-9817-b12016f9475b, X-EBAY-API-APP-NAME:Creative-d255-48c7-9ae8-6d6cdb79ca2a, X-EBAY-API-CERT-NAME:dab7ebf1-a4a6-4376-9871-dd08d4864bf4, X-EBAY-API-SITEID:0, X-EBAY-API-CALL-NAME:GeteBayOfficialTime

                so assign that to a variable and use in 'headers=""'
                Bruce Golub
                Phosphor Media - "Your Success is our Business"

                Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                phosphormedia.com

                Comment


                  #9
                  Re: MvCALL on Ebay

                  Thanks Bruce,

                  I did as you suggested. The call still failed with an ssl timeout.

                  This is what the headers was formatted to: <MvASSIGN NAME = "l.headers" VALUE = "{'X-EBAY-API-COMPATIBILITY-LEVEL:857, X-EBAY-API-DEV-NAME:1507daf9-3913-47a4-9817-b12016f9475b, X-EBAY-API-APP-NAME:Creative-d255-48c7-9ae8-6d6cdb79ca2a, X-EBAY-API-CERT-NAME:dab7ebf1-a4a6-4376-9871-dd08d4864bf4, X-EBAY-API-SITEID:0, X-EBAY-API-CALL-NAME:GeteBayOfficialTime'}">


                  So after that failed I tried it with just one element:<MvASSIGN NAME = "l.headers" VALUE = "{'X-EBAY-API-CALL-NAME:GeteBayOfficialTime'}">

                  That also failed with a timeout. So out of curiosity I sent it with the header first to null: <MvASSIGN NAME = "l.headers" VALUE = "{''}">

                  That return with the unsupported call message.

                  Then I set header to a single space <MvASSIGN NAME = "l.headers" VALUE = "{' '}">

                  That failed with an ssl timeout.

                  I am running on miva 5.19


                  Thanks

                  Don
                  Don Barnett
                  Farm & Home Supply Center

                  Comment


                    #10
                    Re: MvCALL on Ebay

                    Problem Solved!!!

                    It turned out that the header string had to have a crlf appended to the end. Once that was done it worked.

                    Much thanks to Bruce and to Kent for their suggestions. I couldn't have done it without you.

                    Just for the record I am appending the code that worked at the end.

                    Thanks again for all your help.

                    DonB


                    <MvASSIGN NAME="l.crlf" VALUE="{ asciichar(13) $ asciichar(10) }">
                    <MvASSIGN NAME = "l.headers" VALUE = "{ 'X-EBAY-API-COMPATIBILITY-LEVEL:857' $ l.crlf $ 'X-EBAY-API-DEV-NAME:1507daf9-3913-47a4-9817-b12016f9475b' $ l.crlf $ 'X-EBAY-API-APP-NAME:Creative-d255-48c7-9ae8-6d6cdb79ca2a' $ l.crlf $ 'X-EBAY-API-CERT-NAME:dab7ebf1-a4a6-4376-9871-dd08d4864bf4' $ l.crlf $ 'X-EBAY-API-SITEID:0' $ l.crlf $ 'X-EBAY-API-CALL-NAME:GeteBayOfficialTime' $ l.crlf}">


                    <MvASSIGN NAME = "l.sendxml" VALUE = "{ '<?xml version="1.0" encoding="utf-8"?>
                    <GeteBayOfficialTimeRequest xmlns="urn:ebay:apis:eBLBaseComponents">
                    <RequesterCredentials>
                    <eBayAuthToken>AgAAAA**AQAAAA**aAAAAA**xMzzUg**nY+ sHZ2PrBmdj6wVnY+sEZ2PrA2dj6wFk4GhC5iBqQWdj6x9nY+se Q**GFECAA**AAMAAA**quD+wRNO6JtZMnoB6RgsWJWBXpUgb3u YSHPdgeFu7ydFMJM+TAx8x0ubOMs4OkIMwdpeBMJvQD4Fpj2po xjmvy5uKPX+QDNAQLDHgdhiz7p+6TAWflvkDNvXtJuHRW46sRi r+ZIVNLy+6/dYtIfCAlsTvZlnNGxIIIABZL7GQaNrysQGO/DoZNVJWjohqG//in5g7lXNseyhR03+BWvw7GIuSuHkhOF2F1xWeB5cGTasLIIx8E Z2cGgPi6IMCE9ciho0hubstk2pAB83Iuyu2xI/GgBFzkCBxRcCImmN8h8wtd6olfGj3ei8jQ4i5Sib1BbU0F6Q03 fGGiS6HbgF7/FOWIjjqm9VRKaaCr7DdM/Pqy0Z9wbzDlr5Es56Axv34JuwF9tgAiJaqqWAOKLeIl76dK+4h T1ojQkwp81Yt5wXLafkiA1jVsafTYwG01Oinz3O84zybY9To0s Xu/x90WMN/zbYsExP62wcLlQRcWvv6LDXRQoqMNDNS/6gBKu/oCNWKLKsOsiztQ3esi2hS4syIZnA6TFY3U0kXXs85BTL2AvvXk mHvB9s8NpltGYemaeG5ZF1Q4ZHgRtl3+j0y04fu2izFcyuvIKp 04Kh+Uj0IYsOBRNe6biwrvLZwD4yU8rYl5rAazHdbqtaIwxzYS YCjMegXuSGegjv3gU5OuZtrl01EhF5mbwkKDzwxZSjFpiFYqtW HYqWrw6JpU7Mmf8VQWAZeDbJu6B4OoyzJZeHdMeC47ufNMI4Jb XMtoM/</eBayAuthToken>
                    </RequesterCredentials>
                    </GeteBayOfficialTimeRequest>' }">


                    <MvASSIGN NAME = "AccessURL" VALUE = "{'https://api.sandbox.ebay.com/ws/api.dll'}">
                    <MvCALL
                    ACTION="{AccessURL}"
                    METHOD="XML"
                    HEADERS="{l.headers}"
                    FIELDS = "l.sendxml">
                    <MvEVAL EXPR="{callvalue}">
                    </MvCALL>

                    <mvif expr="{ g.MvCall_Error }">
                    <mveval expr="{ g.MvCall_Error }">
                    </mvif>
                    Don Barnett
                    Farm & Home Supply Center

                    Comment


                      #11
                      Re: MvCALL on Ebay

                      Scott,
                      First let me say, I am not a php guru (more of a novice). One question I have is does php support http ver 1.1? Last spring I wrote a php script for communication with Sears because I could not get MvCall to work. My main problem with it is passing data back to miva. I ended up do the following:

                      1. I created a file containing the data I wanted to pass. Usually an xml file.

                      2. I created a pass file with the posting url and the name of the file to send. ( I did this because I could not figure out how to pass the data in my call)

                      3 I made a call to a php program on my server ( called with MvCall ) which in turn made the call. Whatever was returned from the call was then passed on to miva through the MvCall.

                      It is not elegant but it does work. Any suggestions on how to improve this?

                      Thanks
                      Attached Files
                      Don Barnett
                      Farm & Home Supply Center

                      Comment


                        #12
                        Re: MvCALL on Ebay

                        I've done similar things from time to time, using MvCALL to run a PHP script to do something that Miva can't do natively. I was always able to pass data in a POST. I wouldn't use a file for this unless I had a large amount of data.

                        MvCALL takes any variables that you specify in the FIELDS attribute, converts them to the proper format, and includes them in the GET or POST. PHP has a standard variable, named something like $_REQUEST[], that will receive the data that's passed to it by a GET or POST. In some cases, these standard variables have to be enabled by the server config. If $_REQUEST is coming up empty, you might ask your hoster about that.

                        HTH --
                        Kent Multer
                        Magic Metal Productions
                        http://TheMagicM.com
                        * Web developer/designer
                        * E-commerce and Miva
                        * Author, The Official Miva Web Scripting Book -- available on-line:
                        http://www.amazon.com/exec/obidos/IS...icmetalproducA

                        Comment

                        Working...
                        X