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

1451RE: [soaplite] Returning a boolean value from Perl method!

Expand Messages
  • Michael Percy
    Apr 26, 2002
    • 0 Attachment
      That should work if you've got SOAP::Lite on both sides.

      Note that if you are trying to interop with Apache SOAP, you may have to
      write a custom deserializer on the Apache SOAP side (or possibly hack the
      source, as we did). For some reason Apache SOAP interprets both "1" and "0"
      as false; it requires a "true" or "false" string in the SOAP message to
      interpret it correctly. SOAP::Lite refuses to encode the strings by default,
      it puts the integers instead.

      You could also do this with a perl SOAP::Lite serializer but I'm not sure if
      it would interop with other implementations. SOAP::Lite seems to interpret
      1/0 "true"/"false" interchangeably however, if I remember correctly.

      Good luck,

      -----Original Message-----
      From: Duncan Cameron [mailto:dcameron@...]
      Sent: Thursday, April 25, 2002 6:01 PM
      To: colinfaulkingham; soaplite@yahoogroups.com
      Subject: Re: [soaplite] Returning a boolean value from Perl method!

      On 2002-04-26 colinfaulkingham wrote:
      >I must be missing something obvious.
      >How do I return a boolen value from a method?
      >For Example.
      >sub method{
      > $Class=shift(@_);
      > $Value=shift(@_);
      > if($value){
      > return true; # or return 1;
      > }
      > else{
      > return false; # or return 0;
      > }
      >I tried both true and false 0 and 1 and the response envelop always
      >has the type of int or string.
      >So, how do I say that return value 1; is a boolean value?
      Something like this should work (untested!):

      return SOAP::Data->type(boolean => $value ? 1 : 0);

      Duncan Cameron

      To unsubscribe from this group, send an email to:

      Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    • Show all 4 messages in this topic