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

optional parameters/default values

Expand Messages
  • Marc Logghe
    Hi all, I m very new to SOAP::Lite and webservices and XML in general, so please be patient with me ;-) I tried the HelloService example from the soap book. I
    Message 1 of 1 , Jun 14 4:18 AM
    • 0 Attachment
      Hi all,
      I'm very new to SOAP::Lite and webservices and XML in general, so please be patient with me ;-)
      I tried the HelloService example from the soap book. I started experimenting with it, like using two input parameters firstName and lastName.
      The cgi script (between httpd listener and SOAP::Lite proxy) is exactly from the book:
      use SOAP::Transport::HTTP;

      SOAP::Transport::HTTP::CGI
      -> dispatch_to('Hello')
      -> handle
      ;

      and my 'application' looks like:
      package Hello;
      sub sayHello {
      my $class = shift;
      my ($firstName, $lastName) = @_;
      my $self = "Hello $lastName $firstName, how are you ?";

      }

      sub sayGoodbye {

      shift;
      my $self = "Goodbye " . shift;

      }
      1;

      An extract from the wsdl:
      <message name="SayHelloRequest">
      <part name="firstName" type="xsd:string"/>
      <part name="lastName" type="xsd:string"/>
      </message>
      <message name="SayHelloResponse">
      <part name="greeting" type="xsd:string"/>
      </message>

      <portType name="Hello_PortType">
      <operation name="sayHello">
      <input message="tns:SayHelloRequest" parameterOrder="firstName lastName"/>
      <output message="tns:SayHelloResponse"/>
      </operation>
      <operation name="sayGoodbye">
      <input message="tns:SayHelloRequest"/>
      <output message="tns:SayHelloResponse"/>
      </operation>
      </portType>


      I launch the webservice via Taverna scufl workbench.
      All works well as long as I define the two arguments firstName and lastName.
      As soon as I omit one of the two, it fails (no errors in error_log of apache).
      What I would really like to do is to apply a default value for all arguments and override them with the (eventually) passed arguments.
      But I don't know at what level to set these default values. In the cgi script ????
      I tried to get my hands to the request object there, but this object is only available after the handle() method was run. At that moment it is too late anyhow.
      Any help, pointers appreciated.
      Regards,
      Marc
    Your message has been successfully submitted and would be delivered to recipients shortly.