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

SOAP4R v1.5.6 and SOAP::Lite v0.69

Expand Messages
  • dkindlund
    I have a SOAP server running in ruby using SOAP4R v1.5.6 and a SOAP client running in perl using SOAP::Lite v0.69. When a SOAP4R client sends a get_time()
    Message 1 of 1 , Jun 27, 2007
    • 0 Attachment
      I have a SOAP server running in ruby using SOAP4R v1.5.6 and a SOAP
      client running in perl using SOAP::Lite v0.69.

      When a SOAP4R client sends a "get_time()" request to the SOAP4R
      server, it looks like:

      <?xml version="1.0" encoding="utf-8" ?>
      <env:Envelope
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <env:Body>
          <n1:get_time xmlns:n1="urn:Blah"
              env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
          </n1:get_time>
        </env:Body>
      </env:Envelope>

      In this case, valid data is passed back to the SOAP4R client.

      However, here is the SOAP message that the SOAP::Lite client sends to
      the SOAP4R ruby server:

      <?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>
          <get_time xmlns="urn:Blah" xsi:nil="true" />
        </soap:Body>
      </soap:Envelope>

      In this case, I seem to be encountering the following generic error
      message from the SOAP4R library:

          <env:Fault xmlns:n1="http://schemas.xmlsoap.org/soap/encoding/"
              env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
            <faultcode xsi:type="xsd:string">Server</faultcode>
            <faultstring xsi:type="xsd:string">not an RPC style</
      faultstring>
            <faultactor xsi:type="xsd:string">SOAPServer::Server</
      faultactor>
            <detail xmlns:n2="http://www.ruby-lang.org/xmlns/ruby/type/
      custom"
                xsi:type="n2:SOAPException">
              <cause xmlns:n3="http://www.ruby-lang.org/xmlns/ruby/type/1.6"
                  xsi:type="n3:SOAP..RPCRoutingError">
                <message xsi:type="xsd:string">not an RPC style</message>
                <backtrace xsi:type="n1:Array"
                    n1:arrayType="xsd:anyType[19]">
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/soap/rpc/
      router.rb:415:in `request_rpc&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/soap/rpc/
      router.rb:391:in `call&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/soap/rpc/
      router.rb:168:in `route&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/soap/rpc/
      soaplet.rb:88:in `do_POST&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/webrick/
      httpservlet/abstract.rb:35:in `__send__&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/webrick/
      httpservlet/abstract.rb:35:in `service&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/webrick/
      httpserver.rb:104:in `service&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/webrick/
      httpserver.rb:65:in `run&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/webrick/
      server.rb:173:in `start_thread&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/webrick/
      server.rb:162:in `start&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/webrick/
      server.rb:162:in `start_thread&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/webrick/
      server.rb:95:in `start&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/webrick/
      server.rb:92:in `each&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/webrick/
      server.rb:92:in `start&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/webrick/
      server.rb:23:in `start&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/webrick/
      server.rb:82:in `start&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/soap/rpc/
      httpserver.rb:123:in `run&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/logger.rb:
      659:in `start&apos;</item>
                  <item xsi:type="xsd:string">soap_server.rb:37</item>
                </backtrace>
              </cause>
              <excn_type_name xsi:type="xsd:string">SOAP..RPCRoutingError</
      excn_type_name>
            </detail>
          </env:Fault>

      It seems to be from SOAP4R being unable to validate the SOAP::Lite's
      data as a valid SOAPStruct object.  Could you please tell me if there
      is anything I can do to configure SOAP::Lite to send a valid
      SOAPStruct object, as seen by SOAP4R?

      To clarify, here is a copy of my test scripts:

      --------------
      soap_server.rb
      --------------
      require 'soap/rpc/standaloneServer'

      class SOAPServer

        class Blah
          def get_time
              Time.now.to_s
          end
        end

        class Server < SOAP::RPC::StandaloneServer
          def on_init
            s = Blah.new
            add_method(s, 'get_time')
            puts "Server started"
          end
        end

        if __FILE__ == $0
          svr = Server.new('Server', 'urn:Blah', '0.0.0.0', 12321)
          trap('INT') { svr.shutdown }
          svr.start
        end

      end

      --------------
      soap_client.rb
      --------------
      require 'soap/rpc/driver'

      class SOAPClient
        proxy = SOAP::RPC::Driver.new('http://127.0.0.1:12321',
          'urn:Blah')

        proxy.add_method('get_time')
        puts "get_time() = #{proxy.get_time}\n\n"

      end

      --------------
      soap_client.pl
      --------------
      #!/usr/bin/perl -w

      use strict;
      use warnings;
      use Carp ();

      # The on_action bit unsets the SOAPAction parameter
      use SOAP::Lite
        +trace => 'all',
        on_action => sub { return }
      ;

      print SOAP::Lite
          -> uri('urn:Blah')
          -> proxy('http://127.0.0.1:12321')
          -> call('get_time')
          -> result();
      --------------

      Calling soap_server.rb and soap_client.rb yields:
      --------------
      get_time() = Wed Jun 27 14:47:55 -0400 2007
      --------------

      Calling soap_server.rb and soap_client.pl yields:
      --------------
      SOAP::Transport::new: ()
      SOAP::Serializer::new: ()
      SOAP::Deserializer::new: ()
      SOAP::Parser::new: ()
      SOAP::Lite::new: ()
      SOAP::Lite::new: ()
      SOAP::Transport::HTTP::Client::new: ()
      SOAP::Lite::call: ()
      SOAP::Serializer::envelope: ()
      SOAP::Serializer::envelope: get_time
      SOAP::Data::new: ()
      SOAP::Data::new: ()
      SOAP::Data::new: ()
      SOAP::Data::new: ()
      SOAP::Transport::HTTP::Client::send_receive:
      HTTP::Request=HASH(0x1044435c)
      SOAP::Transport::HTTP::Client::send_receive: POST http://127.0.0.1:12321
      HTTP/1.1
      Accept: text/xml
      Accept: multipart/*
      Accept: application/soap
      Content-Length: 411
      Content-Type: text/xml; charset=utf-8

      <?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsi="http://
      www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://s
      chemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/
      XMLSchema" soap:encodingStyle="http://schemas.xmlsoap.org/soa
      p/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/
      envelope/"><soap:Body><get_time xmlns="urn:Blah" xsi:nil="true" /></
      soap:Body></soap:Envelope>
      SOAP::Transport::HTTP::Client::send_receive:
      HTTP::Response=HASH(0x107aa608)
      SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal
      Server Error
      Connection: close
      Date: Wed, 27 Jun 2007 18:48:24 GMT
      Server: WEBrick/1.3.1 (Ruby/1.8.5/2006-08-25)
      Content-Length: 3115
      Content-Type: text/xml; charset="utf-8"
      Client-Date: Wed, 27 Jun 2007 18:48:24 GMT
      Client-Peer: 127.0.0.1:12321
      Client-Response-Num: 1

      <?xml version="1.0" encoding="utf-8" ?>
      <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
          xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <env:Body>
          <env:Fault xmlns:n1="http://schemas.xmlsoap.org/soap/encoding/"
              env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
            <faultcode xsi:type="xsd:string">Server</faultcode>
            <faultstring xsi:type="xsd:string">not an RPC style</
      faultstring>
            <faultactor xsi:type="xsd:string">SOAPServer::Server</
      faultactor>
            <detail xmlns:n2="http://www.ruby-lang.org/xmlns/ruby/type/
      custom"
                xsi:type="n2:SOAPException">
              <excn_type_name xsi:type="xsd:string">SOAP..RPCRoutingError</
      excn_type_name>
              <cause xmlns:n3="http://www.ruby-lang.org/xmlns/ruby/type/1.6"
                  xsi:type="n3:SOAP..RPCRoutingError">
                <message xsi:type="xsd:string">not an RPC style</message>
                <backtrace xsi:type="n1:Array"
                    n1:arrayType="xsd:anyType[19]">
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/soap/rpc/
      router.rb:415:in `request_rpc&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/soap/rpc/
      router.rb:391:in `call&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/soap/rpc/
      router.rb:168:in `route&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/soap/rpc/
      soaplet.rb:88:in `do_POST&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/webrick/
      httpservlet/abstract.rb:35:in `__send__&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/webrick/
      httpservlet/abstract.rb:35:in `service&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/webrick/
      httpserver.rb:104:in `service&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/webrick/
      httpserver.rb:65:in `run&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/webrick/
      server.rb:173:in `start_thread&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/webrick/
      server.rb:162:in `start&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/webrick/
      server.rb:162:in `start_thread&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/webrick/
      server.rb:95:in `start&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/webrick/
      server.rb:92:in `each&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/webrick/
      server.rb:92:in `start&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/webrick/
      server.rb:23:in `start&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/webrick/
      server.rb:82:in `start&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/soap/rpc/
      httpserver.rb:123:in `run&apos;</item>
                  <item xsi:type="xsd:string">/usr/lib/ruby/1.8/logger.rb:
      659:in `start&apos;</item>
                  <item xsi:type="xsd:string">soap_server.rb:22</item>
                </backtrace>
              </cause>
            </detail>
          </env:Fault>
        </env:Body>
      </env:Envelope>
      SOAP::Deserializer::deserialize: ()
      SOAP::Parser::decode: ()
      SOAP::SOM::new: ()
      SOAP::SOM::DESTROY: ()
      SOAP::Transport::HTTP::Client::DESTROY: ()
      SOAP::Lite::DESTROY: ()
      SOAP::Deserializer::DESTROY: ()
      SOAP::Transport::DESTROY: ()
      SOAP::Serializer::DESTROY: ()
      SOAP::Data::DESTROY: ()
      SOAP::Data::DESTROY: ()
      SOAP::Data::DESTROY: ()
      SOAP::Data::DESTROY: ()
      SOAP::Parser::DESTROY: ()
      SOAP::Transport::DESTROY: ()
      SOAP::Serializer::DESTROY: ()
      SOAP::Deserializer::DESTROY: ()
      --------------

      Any additional help would be greatly appreciative.

      Thanks,
      -- Darien

      Cross posted from:
      http://groups.google.com/group/soap4r/browse_frm/thread/e6ef170c9a4e7857
    Your message has been successfully submitted and would be delivered to recipients shortly.