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

SOAP::Lite 0.66+ and sending WSDL: problem with "anyURI" type in serializer

Expand Messages
  • Pieter Neerincx
    Dear Byrne, I m working with a framework where services are stored in a central database. A client searches this database and the database server returns WSDL
    Message 1 of 5 , Jan 30, 2006
      Dear Byrne,

      I'm working with a framework where services are stored in a central
      database. A client searches this database and the database server
      returns WSDL data for the service that is found. The client uses the
      WSDL to execute the service. Service discovery, retrieval and
      execution are all done using SOAP. This used to work with SOAP::Lite
      0.60, but I couldn't make it work with several of the beta's that
      came after that. Last week I tried 0.66 and unfortunately it still
      didn't work. So I started digging and finally found the problem. I
      could see that the WSDL is still generated by the database server and
      send back to the client. It even arrives client-side, but somewhere
      during the parsing of the result it vanished into thin air.

      The difference between the result from the database server running
      S::L 0.60 or 0.66 is in the <s-gensym3> tag:

      S::L 0.60: <s-gensym3 xsi:type="xsd:string">

      S::L 0.66: <s-gensym3 xsi:type="xsd:anyURI">

      So a response for S::L 0.60 starts like this:

      <?xml version="1.0" encoding="UTF-8"?><soap:Envelope
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:soap="http://schemas.xmlsoap.org/soap/
      envelope/"><soap:Body><retrieveServiceResponse xmlns="http://
      bioinfw05/MOBY/Central"><s-gensym3 xsi:type="xsd:string"> ....
      result ....

      With the type = string it works, but the anyURI type that was added
      to later versions of S::L is not recognized by S::L on the client (I
      guess it's missing for some deserializer, but I'm not sure if this is
      the cruelpit). The result is that it is simply ignored. Serverside
      the anyURI thing is generated by:

      package SOAP::Serializer;

      ...some other subs...

      sub new {
      my $self = shift;
      return $self if ref $self;
      unless (ref $self) {
      my $class = ref($self) || $self;
      $self = bless {
      _level => 0,
      _autotype => 1,
      _readable => 0,
      _ns_uri => '',
      _ns_prefix => '',
      _use_default_ns => 1,
      _multirefinplace => 0,
      _seen => {},
      _typelookup => {

      ...some other types...

      'anyURI' =>
      [95, sub { $_[0] =~ /^(urn:)|(http:\/\/)/i; },
      'as_anyURI'],
      'string' =>
      [100, sub {1}, 'as_string'],

      The WSDL info has namespaces that contain "http://" -> it is
      recognized as "anyURI". As a temporay fix I commented out the lines
      for anyURI in the sub above. This results in sending the result back
      as type = string making it work again. I assume the anyURI type was
      added for a good reason, so disabling it is not a long term
      solution... Could you please have a look at it?

      Thanks,

      Pieter


      Wageningen University and Research centre (WUR)
      Laboratory of Bioinformatics
      Transitorium (building 312) room 1034
      Dreijenlaan 3
      6703 HA Wageningen
      The Netherlands
      phone: 0317-483 060
      fax: 0317-483 584
      mobile: 06-143 66 783
      pieter.neerincx@...
    • Gareth
      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
      Message 2 of 5 , Feb 10, 2006
        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;
      • Pieter Neerincx
        Hi All, I m still having big problems with the S::L (de)serialiser. The auto typing doesn t work for me anymore. My content is recognised as anyURI type,
        Message 3 of 5 , Mar 24, 2006
          Hi All,

          I'm still having big problems with the S::L (de)serialiser. The auto
          typing doesn't work for me anymore. My content is recognised as
          "anyURI" type, which is wrong and not de-serialised client-side.
          Therefore I tried to override the type and send raw XML as documented
          with:

          $data = SOAP::Data->type('xml' => $xml_content);
          $result = $client->someMethod($data);

          However this gives me the error:

          "String value expected instead of SOAP::Data reference"

          Tried different types as well with the same result :(. Does anyone
          have a clue what I'm doing wrong here?

          Cheers,

          Pieter

          On 30-Jan-2006, at 1:49 PM, Pieter Neerincx wrote:

          > Dear Byrne,
          >
          > I'm working with a framework where services are stored in a central
          > database. A client searches this database and the database server
          > returns WSDL data for the service that is found. The client uses the
          > WSDL to execute the service. Service discovery, retrieval and
          > execution are all done using SOAP. This used to work with SOAP::Lite
          > 0.60, but I couldn't make it work with several of the beta's that
          > came after that. Last week I tried 0.66 and unfortunately it still
          > didn't work. So I started digging and finally found the problem. I
          > could see that the WSDL is still generated by the database server and
          > send back to the client. It even arrives client-side, but somewhere
          > during the parsing of the result it vanished into thin air.
          >
          > The difference between the result from the database server running
          > S::L 0.60 or 0.66 is in the <s-gensym3> tag:
          >
          > S::L 0.60: <s-gensym3 xsi:type="xsd:string">
          >
          > S::L 0.66: <s-gensym3 xsi:type="xsd:anyURI">
          >
          > So a response for S::L 0.60 starts like this:
          >
          > <?xml version="1.0" encoding="UTF-8"?><soap:Envelope
          > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
          > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
          > soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
          > xmlns:soap="http://schemas.xmlsoap.org/soap/
          > envelope/"><soap:Body><retrieveServiceResponse xmlns="http://
          > bioinfw05/MOBY/Central"><s-gensym3 xsi:type="xsd:string"> ....
          > result ....
          >
          > With the type = string it works, but the anyURI type that was added
          > to later versions of S::L is not recognized by S::L on the client (I
          > guess it's missing for some deserializer, but I'm not sure if this is
          > the cruelpit). The result is that it is simply ignored. Serverside
          > the anyURI thing is generated by:
          >
          > package SOAP::Serializer;
          >
          > ...some other subs...
          >
          > sub new {
          > my $self = shift;
          > return $self if ref $self;
          > unless (ref $self) {
          > my $class = ref($self) || $self;
          > $self = bless {
          > _level => 0,
          > _autotype => 1,
          > _readable => 0,
          > _ns_uri => '',
          > _ns_prefix => '',
          > _use_default_ns => 1,
          > _multirefinplace => 0,
          > _seen => {},
          > _typelookup => {
          >
          > ...some other types...
          >
          > 'anyURI' =>
          > [95, sub { $_[0] =~ /^(urn:)|(http:\/\/)/i; },
          > 'as_anyURI'],
          > 'string' =>
          > [100, sub {1}, 'as_string'],
          >
          > The WSDL info has namespaces that contain "http://" -> it is
          > recognized as "anyURI". As a temporay fix I commented out the lines
          > for anyURI in the sub above. This results in sending the result back
          > as type = string making it work again. I assume the anyURI type was
          > added for a good reason, so disabling it is not a long term
          > solution... Could you please have a look at it?
          >
          > Thanks,
          >
          > Pieter
          >
          >
          > Wageningen University and Research centre (WUR)
          > Laboratory of Bioinformatics
          > Transitorium (building 312) room 1034
          > Dreijenlaan 3
          > 6703 HA Wageningen
          > The Netherlands
          > phone: 0317-483 060
          > fax: 0317-483 584
          > mobile: 06-143 66 783
          > pieter.neerincx@...
          >
          >
          >
          >
          >
          >
          > Yahoo! Groups Links
          >
          >
          >
          >
          >
          >


          Wageningen University and Research centre (WUR)
          Laboratory of Bioinformatics
          Transitorium (building 312) room 1034
          Dreijenlaan 3
          6703 HA Wageningen
          The Netherlands
          phone: 0317-483 060
          fax: 0317-483 584
          mobile: 06-143 66 783
          pieter.neerincx@...
        • Eric Bridger
          You need to use $client- call() method. my $method = SOAP::Data- name( someMethod ); my $result = $client- call($method = $data); Eric
          Message 4 of 5 , Mar 24, 2006
            You need to use $client->call() method.
            my $method = SOAP::Data->name('someMethod');

            my $result = $client->call($method => $data);

            Eric

            On Fri, 2006-03-24 at 09:30, Pieter Neerincx wrote:
            > Hi All,
            >
            > I'm still having big problems with the S::L (de)serialiser. The auto
            > typing doesn't work for me anymore. My content is recognised as
            > "anyURI" type, which is wrong and not de-serialised client-side.
            > Therefore I tried to override the type and send raw XML as documented
            > with:
            >
            > $data = SOAP::Data->type('xml' => $xml_content);
            > $result = $client->someMethod($data);
            >
            > However this gives me the error:
            >
            > "String value expected instead of SOAP::Data reference"
            >
            > Tried different types as well with the same result :(. Does anyone
            > have a clue what I'm doing wrong here?
            >
            > Cheers,
            >
            > Pieter
            >
            > On 30-Jan-2006, at 1:49 PM, Pieter Neerincx wrote:
            >
            > > Dear Byrne,
            > >
            > > I'm working with a framework where services are stored in a central
            > > database. A client searches this database and the database server
            > > returns WSDL data for the service that is found. The client uses the
            > > WSDL to execute the service. Service discovery, retrieval and
            > > execution are all done using SOAP. This used to work with SOAP::Lite
            > > 0.60, but I couldn't make it work with several of the beta's that
            > > came after that. Last week I tried 0.66 and unfortunately it still
            > > didn't work. So I started digging and finally found the problem. I
            > > could see that the WSDL is still generated by the database server and
            > > send back to the client. It even arrives client-side, but somewhere
            > > during the parsing of the result it vanished into thin air.
            > >
            > > The difference between the result from the database server running
            > > S::L 0.60 or 0.66 is in the <s-gensym3> tag:
            > >
            > > S::L 0.60: <s-gensym3 xsi:type="xsd:string">
            > >
            > > S::L 0.66: <s-gensym3 xsi:type="xsd:anyURI">
            > >
            > > So a response for S::L 0.60 starts like this:
            > >
            > > <?xml version="1.0" encoding="UTF-8"?><soap:Envelope
            > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            > > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
            > > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            > > soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
            > > xmlns:soap="http://schemas.xmlsoap.org/soap/
            > > envelope/"><soap:Body><retrieveServiceResponse xmlns="http://
            > > bioinfw05/MOBY/Central"><s-gensym3 xsi:type="xsd:string"> ....
            > > result ....
            > >
            > > With the type = string it works, but the anyURI type that was added
            > > to later versions of S::L is not recognized by S::L on the client (I
            > > guess it's missing for some deserializer, but I'm not sure if this is
            > > the cruelpit). The result is that it is simply ignored. Serverside
            > > the anyURI thing is generated by:
            > >
            > > package SOAP::Serializer;
            > >
            > > ...some other subs...
            > >
            > > sub new {
            > > my $self = shift;
            > > return $self if ref $self;
            > > unless (ref $self) {
            > > my $class = ref($self) || $self;
            > > $self = bless {
            > > _level => 0,
            > > _autotype => 1,
            > > _readable => 0,
            > > _ns_uri => '',
            > > _ns_prefix => '',
            > > _use_default_ns => 1,
            > > _multirefinplace => 0,
            > > _seen => {},
            > > _typelookup => {
            > >
            > > ...some other types...
            > >
            > > 'anyURI' =>
            > > [95, sub { $_[0] =~ /^(urn:)|(http:\/\/)/i; },
            > > 'as_anyURI'],
            > > 'string' =>
            > > [100, sub {1}, 'as_string'],
            > >
            > > The WSDL info has namespaces that contain "http://" -> it is
            > > recognized as "anyURI". As a temporay fix I commented out the lines
            > > for anyURI in the sub above. This results in sending the result back
            > > as type = string making it work again. I assume the anyURI type was
            > > added for a good reason, so disabling it is not a long term
            > > solution... Could you please have a look at it?
            > >
            > > Thanks,
            > >
            > > Pieter
            > >
            > >
            > > Wageningen University and Research centre (WUR)
            > > Laboratory of Bioinformatics
            > > Transitorium (building 312) room 1034
            > > Dreijenlaan 3
            > > 6703 HA Wageningen
            > > The Netherlands
            > > phone: 0317-483 060
            > > fax: 0317-483 584
            > > mobile: 06-143 66 783
            > > pieter.neerincx@...
            > >
            > >
            > >
            > >
            > >
            > >
            > > Yahoo! Groups Links
            > >
            > >
            > >
            > >
            > >
            > >
            >
            >
            > Wageningen University and Research centre (WUR)
            > Laboratory of Bioinformatics
            > Transitorium (building 312) room 1034
            > Dreijenlaan 3
            > 6703 HA Wageningen
            > The Netherlands
            > phone: 0317-483 060
            > fax: 0317-483 584
            > mobile: 06-143 66 783
            > pieter.neerincx@...
            >
            >
            >
            >
            >
            >
            > Yahoo! Groups Links
            >
            >
            >
            >
            >
            >
          Your message has been successfully submitted and would be delivered to recipients shortly.