Loading ...
Sorry, an error occurred while loading the content.
 

VBScript handles complex structs?

Expand Messages
  • sarinder_virk@hotmail.com
    Hello, I am accessing a SOAP::Lite server with a VBScript client. I handle arrays and hashes with no problem, but I have problems handling more complex
    Message 1 of 4 , Aug 24, 2001
      Hello,

      I am accessing a SOAP::Lite server with a VBScript client. I handle
      arrays and hashes with no problem, but I have problems handling more
      complex structs. For example, my VBScript client chokes when
      encountering arrays of hashes.

      if server has following methods:

      sub getHash() { return {"foo" => "bar"}; }
      sub getArray() { return ["foo", "bar"]; }
      sub getStruct() { return ["foo", {"oh" => "no"}]; }

      then on client (client.asp):

      Set client = CreateObject("SOAP.Lite").new( _
      "proxy", "http://localhost/cgi-bin/server.pl", _
      "uri", "http://localhost/My/Server")

      Set hash = server.getHash().result
      Response.Write(hash.foo) ' works fine
      Dim array
      array = server.getArray().result
      Response.Write(array(0)) ' works fine
      array = server.getStruct().result
      Response.Write(array(0)) ' works fine
      hash = array(1)
      oh = hash.oh ' get error "Object required"

      I will investigate some more, but maybe someone out there knows if
      there's a bug or I'm doing something wrong?

      Many thanks!
    • Paul Kulchenko
      Hi, sarinder_virk! ... I don t think you re doing anything wrong, because I have a very similar issue with COM interface I m using to build SOAP.Lite object.
      Message 2 of 4 , Aug 24, 2001
        Hi, sarinder_virk!

        > I will investigate some more, but maybe someone out there knows if
        > there's a bug or I'm doing something wrong?
        I don't think you're doing anything wrong, because I have a very
        similar issue with COM interface I'm using to build SOAP.Lite object.
        If you have an ActiveState Perl installed, you can try it with simple
        script. Maybe you can find a syntax that works.

        Dim objPerlCOM
        Set objPerlCOM = CreateObject("PerlCOM.Script")

        objPerlCOM.EvalScript( _
        " sub something { " & Chr(10) & _
        " return [{a => 1}, {a => 2}]; " & Chr(10) & _
        "}")

        Dim arrayPath
        arrayPath = objPerlCOM.something()
        strInfo = ""
        For i = 0 to UBound(arrayPath)
        Set hash = arrayPath(i) ' neither 'hash = ' nor 'Set hash = '
        works
        strInfo = strInfo & hash.a & Chr(13) & Chr(10)
        Next
        MsgBox strInfo

        It looks like a limitation in ActiveState's COM interface (I didn't
        test it with latest PDK). Let me know how it goes for you. Thank you.

        Best wishes, Paul.

        --- sarinder_virk@... wrote:
        > Hello,
        >
        > I am accessing a SOAP::Lite server with a VBScript client. I handle
        >
        > arrays and hashes with no problem, but I have problems handling
        > more
        > complex structs. For example, my VBScript client chokes when
        > encountering arrays of hashes.
        >
        > if server has following methods:
        >
        > sub getHash() { return {"foo" => "bar"}; }
        > sub getArray() { return ["foo", "bar"]; }
        > sub getStruct() { return ["foo", {"oh" => "no"}]; }
        >
        > then on client (client.asp):
        >
        > Set client = CreateObject("SOAP.Lite").new( _
        > "proxy", "http://localhost/cgi-bin/server.pl", _
        > "uri", "http://localhost/My/Server")
        >
        > Set hash = server.getHash().result
        > Response.Write(hash.foo) ' works fine
        > Dim array
        > array = server.getArray().result
        > Response.Write(array(0)) ' works fine
        > array = server.getStruct().result
        > Response.Write(array(0)) ' works fine
        > hash = array(1)
        > oh = hash.oh ' get error "Object required"
        >
        > I will investigate some more, but maybe someone out there knows if
        > there's a bug or I'm doing something wrong?
        >
        > Many thanks!
        >
        >
        >
        > ------------------------ Yahoo! Groups Sponsor
        >
        > To unsubscribe from this group, send an email to:
        > soaplite-unsubscribe@yahoogroups.com
        >
        >
        >
        > Your use of Yahoo! Groups is subject to
        > http://docs.yahoo.com/info/terms/
        >
        >


        __________________________________________________
        Do You Yahoo!?
        Make international calls for as low as $.04/minute with Yahoo! Messenger
        http://phonecard.yahoo.com/
      • Sarinder Virk
        Paul, thanks for the quick response. In a (futile) workaround attempt, I decided from server to return @array, so on the client side I can do as follows: Set
        Message 3 of 4 , Aug 24, 2001
          Paul, thanks for the quick response.
           
          In a (futile) workaround attempt, I decided from server to return @array, so on the client side I can do as follows:
           
          Set envelope = soap.getArray()
          one = envelope.result ' first element in array
          Dim outparams
          outparams = envelope.List.paramsout ' remaining elements in array
           
          It works if outparams contains simple datatypes, like string or num. But not if it contains, for example, a hash. I put it through a debugger (Visual InterDev) and noticed said element shows up as "User-defined Type" (see screenshot). It's kinda weird.
           
          I want to do some more debugging, especially per your recommendations. However, when my code try to CreateObject("PerlCOM.Script") or CreateObject("PerlCOM.DebugScript") I get a message "ClassFactory cannot supply requested class", even after I did "regsvr32 PerlCOM.dll" I tried on other person's PC but still had the same problem. I cannot find any info anywhere on installing/configuring PerlCOM, even on ActiveState's website! Debugging with Visual InterDev did not yield any results either.
           
          Do you have any suggestions?
          -----Original Message-----
          From: Paul Kulchenko [mailto:paulclinger@...]
          Sent: Friday, August 24, 2001 3:29 PM
          To: soaplite@yahoogroups.com
          Subject: Re: [soaplite] VBScript handles complex structs?

          Hi, sarinder_virk!

          > I will investigate some more, but maybe someone out there knows if
          > there's a bug or I'm doing something wrong?
          I don't think you're doing anything wrong, because I have a very
          similar issue with COM interface I'm using to build SOAP.Lite object.
          If you have an ActiveState Perl installed, you can try it with simple
          script. Maybe you can find a syntax that works.

          Dim objPerlCOM
          Set objPerlCOM = CreateObject("PerlCOM.Script")

          objPerlCOM.EvalScript( _
              " sub something { " & Chr(10) & _
              " return [{a => 1}, {a => 2}]; " & Chr(10) & _
              "}")

          Dim arrayPath
          arrayPath = objPerlCOM.something()
          strInfo = ""
          For i = 0 to UBound(arrayPath)
             Set hash = arrayPath(i) ' neither 'hash = ' nor 'Set hash = '
          works
             strInfo = strInfo & hash.a & Chr(13) & Chr(10)
          Next
          MsgBox strInfo

          It looks like a limitation in ActiveState's COM interface (I didn't
          test it with latest PDK). Let me know how it goes for you. Thank you.

          Best wishes, Paul.

          --- sarinder_virk@... wrote:
          > Hello,
          >
          > I am accessing a SOAP::Lite server with a VBScript client. I handle
          >
          > arrays and hashes with no problem, but I have problems handling
          > more
          > complex structs. For example, my VBScript client chokes when
          > encountering arrays of hashes.
          >
          > if server has following methods:
          >
          > sub getHash() { return {"foo" => "bar"}; }
          > sub getArray() { return ["foo", "bar"]; }
          > sub getStruct() { return ["foo", {"oh" => "no"}]; }
          >
          > then on client (client.asp):
          >
          > Set client = CreateObject("SOAP.Lite").new( _
          >              "proxy", "http://localhost/cgi-bin/server.pl", _
          >              "uri",   "http://localhost/My/Server")
          >
          > Set hash = server.getHash().result
          > Response.Write(hash.foo) ' works fine
          > Dim array
          > array = server.getArray().result
          > Response.Write(array(0)) ' works fine
          > array = server.getStruct().result
          > Response.Write(array(0)) ' works fine
          > hash = array(1)
          > oh = hash.oh ' get error "Object required"
          >
          > I will investigate some more, but maybe someone out there knows if
          > there's a bug or I'm doing something wrong?
          >
          > Many thanks!
          >
          >
          >
          > ------------------------ Yahoo! Groups Sponsor
          >
          > To unsubscribe from this group, send an email to:
          > soaplite-unsubscribe@yahoogroups.com
          >

          >
          > Your use of Yahoo! Groups is subject to
          > http://docs.yahoo.com/info/terms/
          >
          >


          __________________________________________________
          Do You Yahoo!?
          Make international calls for as low as $.04/minute with Yahoo! Messenger
          http://phonecard.yahoo.com/


          To unsubscribe from this group, send an email to:
          soaplite-unsubscribe@yahoogroups.com



          Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
        • Paul Kulchenko
          Hi, Sarinder! ... It s not THAT strange. VB doesn t have a type similar to HASH in Perl, so ActiveState provides an object that behaves like hash. Check this
          Message 4 of 4 , Aug 24, 2001
            Hi, Sarinder!

            > num. But not
            > if it contains, for example, a hash. I put it through a debugger
            > (Visual
            > InterDev) and noticed said element shows up as "User-defined Type"
            > (see screenshot). It's kinda weird.
            It's not THAT strange. VB doesn't have a type similar to HASH in
            Perl, so ActiveState provides an object that behaves like hash. Check
            this
            [http://aspn.activestate.com/ASPN/Perl/Reference/Products/ASPNTOC-PERLDEVKIT-000-003%5d,
            esp 'Arrays in PerlCOM' and 'Hashes in PerlCOM' sections.

            > However, when my code try to CreateObject("PerlCOM.Script") or
            > CreateObject("PerlCOM.DebugScript") I get a message "ClassFactory
            > cannot
            > supply requested class", even after I did "regsvr32 PerlCOM.dll" I
            > Do you have any suggestions?
            You don't need to register PerlCOM.dll. It should be a part of
            perl56.dll and you should be able to run code I send you. Don't know
            for sure where it comes with ActiveState Perl or Perl Development Kit
            (PDK). As far as I remember you don't need PDK to run those examples,
            but you can download it (trial license for two weeks) from
            ActiveState site. Keep me informed if possible. Thank you.

            Best wishes, Paul.

            --- Sarinder Virk <sarinder_virk@...> wrote:
            > Paul, thanks for the quick response.
            >
            > In a (futile) workaround attempt, I decided from server to return
            > @array, so
            > on the client side I can do as follows:
            >
            > Set envelope = soap.getArray()
            > one = envelope.result ' first element in array
            > Dim outparams
            > outparams = envelope.List.paramsout ' remaining elements in array
            >
            > It works if outparams contains simple datatypes, like string or
            > num. But not
            > if it contains, for example, a hash. I put it through a debugger
            > (Visual
            > InterDev) and noticed said element shows up as "User-defined Type"
            > (see
            > screenshot). It's kinda weird.
            >
            > I want to do some more debugging, especially per your
            > recommendations.
            > However, when my code try to CreateObject("PerlCOM.Script") or
            > CreateObject("PerlCOM.DebugScript") I get a message "ClassFactory
            > cannot
            > supply requested class", even after I did "regsvr32 PerlCOM.dll" I
            > tried on
            > other person's PC but still had the same problem. I cannot find any
            > info
            > anywhere on installing/configuring PerlCOM, even on ActiveState's
            > website!
            > Debugging with Visual InterDev did not yield any results either.
            >
            > Do you have any suggestions?
            > -----Original Message-----
            > From: Paul Kulchenko [mailto:paulclinger@...]
            > Sent: Friday, August 24, 2001 3:29 PM
            > To: soaplite@yahoogroups.com
            > Subject: Re: [soaplite] VBScript handles complex structs?
            >
            >
            > Hi, sarinder_virk!
            >
            > > I will investigate some more, but maybe someone out there knows
            > if
            > > there's a bug or I'm doing something wrong?
            > I don't think you're doing anything wrong, because I have a very
            > similar issue with COM interface I'm using to build SOAP.Lite
            > object.
            > If you have an ActiveState Perl installed, you can try it with
            > simple
            > script. Maybe you can find a syntax that works.
            >
            > Dim objPerlCOM
            > Set objPerlCOM = CreateObject("PerlCOM.Script")
            >
            > objPerlCOM.EvalScript( _
            > " sub something { " & Chr(10) & _
            > " return [{a => 1}, {a => 2}]; " & Chr(10) & _
            > "}")
            >
            > Dim arrayPath
            > arrayPath = objPerlCOM.something()
            > strInfo = ""
            > For i = 0 to UBound(arrayPath)
            > Set hash = arrayPath(i) ' neither 'hash = ' nor 'Set hash = '
            > works
            > strInfo = strInfo & hash.a & Chr(13) & Chr(10)
            > Next
            > MsgBox strInfo
            >
            > It looks like a limitation in ActiveState's COM interface (I
            > didn't
            > test it with latest PDK). Let me know how it goes for you. Thank
            > you.
            >
            > Best wishes, Paul.
            >
            > --- sarinder_virk@... wrote:
            > > Hello,
            > >
            > > I am accessing a SOAP::Lite server with a VBScript client. I
            > handle
            > >
            > > arrays and hashes with no problem, but I have problems handling
            > > more
            > > complex structs. For example, my VBScript client chokes when
            > > encountering arrays of hashes.
            > >
            > > if server has following methods:
            > >
            > > sub getHash() { return {"foo" => "bar"}; }
            > > sub getArray() { return ["foo", "bar"]; }
            > > sub getStruct() { return ["foo", {"oh" => "no"}]; }
            > >
            > > then on client (client.asp):
            > >
            > > Set client = CreateObject("SOAP.Lite").new( _
            > > "proxy", "http://localhost/cgi-bin/server.pl", _
            > > "uri", "http://localhost/My/Server")
            > >
            > > Set hash = server.getHash().result
            > > Response.Write(hash.foo) ' works fine
            > > Dim array
            > > array = server.getArray().result
            > > Response.Write(array(0)) ' works fine
            > > array = server.getStruct().result
            > > Response.Write(array(0)) ' works fine
            > > hash = array(1)
            > > oh = hash.oh ' get error "Object required"
            > >
            > > I will investigate some more, but maybe someone out there knows
            > if
            > > there's a bug or I'm doing something wrong?
            > >
            > > Many thanks!
            > >
            > >
            > >
            > > ------------------------ Yahoo! Groups Sponsor
            > >
            > > To unsubscribe from this group, send an email to:
            > > soaplite-unsubscribe@yahoogroups.com
            > >
            > >
            > >
            > > Your use of Yahoo! Groups is subject to
            > > http://docs.yahoo.com/info/terms/
            > >
            > >
            >
            >
            > __________________________________________________
            > Do You Yahoo!?
            > Make international calls for as low as $.04/minute with Yahoo!
            > Messenger
            > http://phonecard.yahoo.com/
            >
            > Yahoo! Groups Sponsor
            >
            >
            >
            > To unsubscribe from this group, send an email to:
            > soaplite-unsubscribe@yahoogroups.com
            >
            >
            >
            > Your use of Yahoo! Groups is subject to the Yahoo! Terms of
            > Service.
            >
            >

            > ATTACHMENT part 2 image/jpeg name=test.jpg



            __________________________________________________
            Do You Yahoo!?
            Make international calls for as low as $.04/minute with Yahoo! Messenger
            http://phonecard.yahoo.com/
          Your message has been successfully submitted and would be delivered to recipients shortly.