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

5207Re: SOAP::Lite 0.67 deployed to CPAN

Expand Messages
  • Gareth
    Feb 10, 2006
    • 0 Attachment
      0.60 working but 0.67 not.

      The working 0.60 code can be found here:

      http://www.gsowww.uklinux.net/systemtests.xhtml
      (ref. SOAP test, requires a Mozilla based browser)

      Run the same code with 0.67 though and Mozilla's JavaScript reports
      the following error:

      Error: SOAP_GLOBAL_ACCESSOR: Decoded struct contained global accessor,
      which does not map well into a property name., called by JS frame ::
      http://localhost/~xxxxxxxx/mozwebservice.js :: anonymous :: line 59
      Source File: http://localhost/~xxxxxxxx/mozwebservice.js
      Line: 59


      **** The code starting with the webpage is as follows: ****

      <p><input id="soapTestButton" type="button" value="SOAP Test"/></p>

      <script type="text/javascript">
      <![CDATA[

      document.getElementById("soapTestButton").addEventListener("click",
      soapTest, false);

      function soapTest()
      {
      mozSOAPCallAsync(
      document.getElementById("soapServer").value,
      "SoapWSTest",
      "hellosoap",
      ["arg 1", "arg 2"],
      function (result, result2) {
      alert(result+"\n"+result2);
      }
      );
      }

      ]]>
      </script>

      function mozSOAPCallAsync(transportURI, targetObjectURI, method,
      argAry, callback)
      {
      var aryCeil = argAry.length;
      var parmAry = new Array();
      for(i = 0; i < aryCeil; i++) {
      var soapParam = new SOAPParameter();
      soapParam.value = argAry[i];
      parmAry.push(soapParam);
      }
      var soapCall = new SOAPCall();
      soapCall.transportURI = transportURI;
      soapCall.encode(0, method, targetObjectURI, 0, [], parmAry.length,
      parmAry);
      // NB hyphens in target object names result in a Perl class not
      found error
      soapCall.asyncInvoke(
      function (response,soapcall,error) {
      if (error != 0) {
      alert("Service failure");
      }
      else {
      var fault = response.fault;
      if (fault != null) {
      alert("SOAP Fault:\n\n" + "Code: " + fault.faultCode +
      "\n\nMessage: " + fault.faultString);
      }
      else {
      // RPC type call, returns only values (as list)
      var retValAry = new Array();
      var rspParmCount = new Object();
      var rspParmAry = response.getParameters(true,rspParmCount);
      if (rspParmCount.value > 0) {
      var parmZeroEnum = rspParmAry[0].value.enumerator; // .value of
      type SOAPPropertyBag

      **** THE ABOVE LINE IS WHERE IT FAILS ****

      while (parmZeroEnum.hasMoreElements()) {
      retValAry.push(parmZeroEnum.getNext().value); // nsIProperty
      (value and name properties)
      }
      }
      callback.apply(undefined, retValAry);
      }
      }
      }
      );
      } // TODO, return soapcall obj. or an error status


      **** The SOAP server: ****

      #!/usr/bin/perl -w

      #use lib 'SOAP-Lite-0.67';
      use lib 'SOAP-Lite-0.60';

      use SOAP::Transport::HTTP;
      # prerequisites Apache mod_perl, libxml-parser-perl (expat,
      XML::Parser), HTTP transport modules (liburi-perl, libwww-perl)

      SOAP::Transport::HTTP::CGI
      -> dispatch_to('./', 'SoapWSTest', 'RDFWSDemo')
      -> handle;


      **** And SOAP handler: ****

      package SoapWSTest;

      sub hellosoap {
      my $target_object = shift;

      return @_ ? @_ : undef
      }

      1;
    • Show all 5 messages in this topic