Announcement

Collapse
No announcement yet.

Cannot make mvt:call operate as expected

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

    Cannot make mvt:call operate as expected

    Hello forum:
    I am attempting to retrieve the Washington State tax rate for a particular address. When I use the state's example URL:
    http://dor.wa.gov/AddressRates.aspx?...ity=&zip=98501
    I get the response as XML as requested by the output=xml in the URL.
    Try it, you should see a XML response.

    When I use the following mvt:call:
    <mvt:assign name="g.url" value="'http://dor.wa.gov/AddressRates.aspx'" />
    <mvt:assign name="g.output" value = "'XML'" />
    <mvt:assign name="g.addr" value = "'6500 Linderson way'" />
    <mvt:assign name="g.city" value = "''" />
    <mvt:assign name="g.zip" value = "'98501'" />
    <mvt:call action="g.url" method="'GET'" fields="'output,addr,city,zip'">
    <mvt:assign name="g.callvalue" value="s.callvalue" />
    </mvt:call>
    result: &mvt:global:callvalue; <br>

    from the GD variables dump:
    884 g.callvalue &mvt:global:callvalue; LocationCode=3406 Rate=0.087 ResultCode=0
    variable &mvt:global:callvalue; is shown as text even thought I requested xml.

    Am I doing something wrong or is there a problem with mvt:call?

    I'll open a ticket if there is no problem with the template code I've created. Just want to be certain it's not my fault first.

    Thanks, Larry
    Last edited by wajake41; 07-01-15, 02:29 PM.
    Larry
    Luce Kanun Web Design
    www.facebook.com/wajake41
    www.plus.google.com/116415026668025242914/posts?hl=en



    #2
    Re: Cannot make mvt:call operate as expected

    the variable scope tool probably can't display XML, or the browser is stripping it.

    (Also, your assignment to g.callvalue should probably be something like value="s.callvalue $ g.myCallValue" so you capture responses longer than one line.)
    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


      #3
      Re: Cannot make mvt:call operate as expected

      Hi Bruce:
      Actually the xml response contains several additional variables. Wonder why Miva would filter them? One of those variables is needed by my template else I'd be happy with the text reply. :(
      Larry
      Luce Kanun Web Design
      www.facebook.com/wajake41
      www.plus.google.com/116415026668025242914/posts?hl=en


      Comment


        #4
        Re: Cannot make mvt:call operate as expected

        miva isn't filtering anything.

        export g.myCallValue to a file, or into a <textarea></textarea> tab to see what is being returned from MvCall. Also, just because you ask for XML doesn't mean you get it. The rest of the request has to be correct sometimes in order for the other server to respond accordingly.
        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


          #5
          Re: Cannot make mvt:call operate as expected

          Hi Larry,

          I tried with the code you mentioned here and checked on the URL as well, if you convert your "XML" into lowercase "xml", I believe you'll get correct results, I think the site require 'output' variable in lowercase format.

          This is the code I used to obtain XML formatted result :

          Code:
          <mvt:assign name="g.url" value="'http://dor.wa.gov/AddressRates.aspx'" />
          <mvt:assign name="g.output" value="'xml'" />
          <mvt:assign name="g.addr" value="'6500 Linderson way'" />
          <mvt:assign name="g.city" value="''" />
          <mvt:assign name="g.zip" value="'98501'" />
          <mvt:assign name="g.localrate" value="''" />
          <mvt:call action="g.url" method="'GET'" fields="'output,addr,city,zip'">
              <mvt:assign name="g.localrate" value="g.localrate $ s.callvalue" />
          </mvt:call>
          &mvt:global:localrate;
          I guess, mvt isn't doing anything wrong, just a little problem from service provider's code implementation.
          Rajnish Sinha
          ---------------------
          https://twitter.com/rajnishsi

          Comment


            #6
            Re: Cannot make mvt:call operate as expected

            Hi rajnishsi:
            Thanks for the help on this. Looking at your solution I see a couple of things I was doing wrong. I had tried the lower case literal xml subsequent to this post but was not enclosing it in single quotes (error 1). Also the resultant variable from the <mvt:call apparently does not have scope beyond the </mvt:call>. Your creation of a global variable prior to the <mvt:call and then your assignment of the s.callvalue to it within the <mvt:call allows the value to be referenced beyond the </mvt:call.
            Thanks again for your help.
            Cheers, Larry
            Larry
            Luce Kanun Web Design
            www.facebook.com/wajake41
            www.plus.google.com/116415026668025242914/posts?hl=en


            Comment


              #7
              Re: Cannot make mvt:call operate as expected

              Bruce: After fixing my code errors and then putting the mvt:call result into a <textarea as you suggested, I see my result.
              Thanks for the help
              Larry
              Larry
              Luce Kanun Web Design
              www.facebook.com/wajake41
              www.plus.google.com/116415026668025242914/posts?hl=en


              Comment


                #8
                Re: Cannot make mvt:call operate as expected

                More: Found the documentation on mvcall.
                http://www.mivascript.com/item/MvCALL.html
                Even thought mvcall is mivascript, it appears that mvt:call operates much the same.
                This helps me better understand the solutions offered above in this thread.
                Cheers, Larry
                Larry
                Luce Kanun Web Design
                www.facebook.com/wajake41
                www.plus.google.com/116415026668025242914/posts?hl=en


                Comment


                  #9
                  Re: Cannot make mvt:call operate as expected

                  Still working with mvt:call:
                  Added following conditional to a working mvt:call:
                  <mvt:call action="g.url" method="GET" fields="'output,addr,city,zip'">
                  <Mvt:IF EXPR = "s.callobjecttype EQ 'tag'">
                  <mvt:callcontinue />
                  </Mvt:IF>

                  <mvt:assign name="g.localrate" value="g.localrate $ s.callvalue" />
                  </mvt:call>
                  Now getting a timeout when above mvt:call is executed. Appears to be in an infinite loop.
                  Mvt:IF code taken from an example in the MVCALL documentation.
                  Does variable s.callobjecttype exist for mvt:call?
                  Larry
                  Last edited by wajake41; 07-02-15, 10:20 AM.
                  Larry
                  Luce Kanun Web Design
                  www.facebook.com/wajake41
                  www.plus.google.com/116415026668025242914/posts?hl=en


                  Comment


                    #10
                    Re: Cannot make mvt:call operate as expected

                    It does exist and in your particular case, it will give you text because you are getting XML response which doesn't have any HTML tags.
                    Rajnish Sinha
                    ---------------------
                    https://twitter.com/rajnishsi

                    Comment


                      #11
                      Re: Cannot make mvt:call operate as expected

                      mvcall treats XML namespace tags as HTML.
                      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

                      Working...
                      X