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

Can't locate object method "result" via package "Hello Torsten"

Expand Messages
  • tmangner
    Hi, i have some problems with using WSDL and SOAP::Lite ... ... Can t locate object method result via package Hello Torsten at hello_clientwsdl.pl line 16.
    Message 1 of 2 , Jul 17, 2002
    • 0 Attachment
      Hi,

      i have some problems with using WSDL and SOAP::Lite ...

      why do i get this error when starting the client:
      >perl hello_clientwsdl.pl Torsten

      Can't locate object method "result" via package "Hello Torsten" at
      hello_clientwsdl.pl line 16.

      why doas the server want to access a package "Hello Torsten", which
      should be the requested output? and what is the "result" method?

      can anyone help me?

      thanks in advance,
      Torsten

      ####
      #the source files

      # hello.cgi - Hello Server
      use SOAP::Transport::HTTP;
      SOAP::Transport::HTTP::CGI
      ->dispatch_to('Hello')
      ->handle;

      package Hello;
      sub sayHello {
      shift;
      my $result = SOAP::Data
      ->name('sayHelloResult')
      ->uri('http://alphaone.de/Hello')
      ->value('Hello ' . shift);
      return $result;
      }

      # hello_client.pl - Hello Client
      use SOAP::Lite;
      my $name = shift;
      print "\n\ncalling the soap server to say hello\n\n";
      print "the soap server says: ";
      my $soap = SOAP::Lite
      -> service
      ('http://www.denver209.server4free.de/~alphaone/soap/hello.wsdl');
      print $soap -> sayHello( $name )-> result;
      print "\n\n";

      # WSDL File
      <?xml version="1.0"?>
      <definitions name="Hello"


      targetNamespace="http://debver209.server4free.de/~alphaone/soap/Hello
      .wsdl"

      xmlns:tns="http://debver209.server4free.de/~alphaone/soap/Hello.wsdl"
      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
      xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"
      xmlns="http://schemas.xmlsoap.org/wsdl/">

      <message name="HelloInput">
      <part name="body" element="xsd:string"/>
      </message>

      <message name="HelloOutput">
      <part name="body" type="xsd:string"/>
      </message>

      <portType name="HelloPortType">
      <operation name="sayHello">
      <input message="tns:HelloInput"/>
      <output message="tns:HelloOutput"/>
      </operation>
      </portType>

      <binding name="HelloSoapBinding" type="tns:HelloPortType">
      <soap:binding style="rpc"
      transport="http://schemas.xmlsoap.org/soap/http"/>
      <operation name="sayHello">
      <soap:operation
      soapAction="http://alphaone.de/Hello#sayHello"/>
      <input>
      <soap:body use="encoded"
      namespace="http://alphaone.de/Hello"

      encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      </input>
      <output>
      <soap:body use="encoded"
      namespace="http://alphaone.de/Hello"

      encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      </output>
      </operation>
      </binding>

      <service name="HelloService">
      <documentation>My first service</documentation>
      <port name="HelloPort" binding="tns:HelloSoapBinding">
      <soap:address
      location="http://denver209.server4free.de/~alphaone/soap/hello.cgi"/>
      </port>
      </service>

      </definitions>
    • Duncan Cameron
      ... When you use the service() method SOAP::Lite automatically calls the result() method and passes its result back to you. So your client is trying to call
      Message 2 of 2 , Jul 18, 2002
      • 0 Attachment
        On 2002-07-17 tmangner wrote:
        >Hi,
        >
        >i have some problems with using WSDL and SOAP::Lite ...
        >
        >why do i get this error when starting the client:
        >>perl hello_clientwsdl.pl Torsten
        >
        >Can't locate object method "result" via package "Hello Torsten" at
        >hello_clientwsdl.pl line 16.
        >
        >why doas the server want to access a package "Hello Torsten", which
        >should be the requested output? and what is the "result" method?
        >
        >can anyone help me?
        >
        >thanks in advance,
        >Torsten
        >
        >####
        >#the source files
        >
        ># hello.cgi - Hello Server
        >use SOAP::Transport::HTTP;
        >SOAP::Transport::HTTP::CGI
        > ->dispatch_to('Hello')
        > ->handle;
        >
        >package Hello;
        >sub sayHello {
        > shift;
        > my $result = SOAP::Data
        > ->name('sayHelloResult')
        > ->uri('http://alphaone.de/Hello')
        > ->value('Hello ' . shift);
        > return $result;
        >}
        >
        ># hello_client.pl - Hello Client
        >use SOAP::Lite;
        >my $name = shift;
        >print "\n\ncalling the soap server to say hello\n\n";
        >print "the soap server says: ";
        >my $soap = SOAP::Lite
        > -> service
        >('http://www.denver209.server4free.de/~alphaone/soap/hello.wsdl');
        >print $soap -> sayHello( $name )-> result;
        >print "\n\n";
        >

        When you use the service() method SOAP::Lite automatically calls the result()
        method and passes its result back to you.

        So your client is trying to call result() on the retuened value which is 'Hello Torsten'

        If you don't want this to happen then use the proxy() and uri() methods instead
        of service()

        Regards,
        Duncan Cameron
      Your message has been successfully submitted and would be delivered to recipients shortly.