Search the web
Sign In
New User? Sign Up
soaplite · SOAP::Lite for Perl (soaplite.com)
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.

Messages

  Messages Help
Advanced
Deserializing booleans with Soap::Lite   Message List  
Reply Message #895 of 6437 |
Re: [soaplite] Deserializing booleans with Soap::Lite

Hi, Prasenjeet!

> Replacing the int with a boolean (the intention being true for
> long,
> false for short) on the other hand, consistently causes Soap::Lite
> to
> throw a fault: "Application failed during request deserialization:
> Wrong boolean value 'true'".
That's a known problem with SOAP::Lite v0.51. boolean type in XML
Schema 1999 doesn't accept 'true/false', only '1/0' which is
incorrect. You either need to use XML Schema 2001 (instead of 1999)
which does correct processing or do something like this (right after
'use SOAP::Lite;' or 'use SOAP::Transport::HTTP;'):

*SOAP::XMLSchema1999::Deserializer::as_boolean =
*SOAP::XMLSchemaSOAP1_1::Deserializer::as_boolean =
\&SOAP::XMLSchema2001::Deserializer::as_boolean;

It's already fixed in the current version which will be available
--cough, cough -- really soon. Let me know if you still have any
problem.

Best wishes, Paul.

--- Prasenjeet Dutta <prasenjeetd@...> wrote:
> Hi,
>
> I have a really basic question -- please forgive me if it's been
> already been answered. I wrote a simple web service to display a
> fortune, using Soap::Lite 0.51. The client was written in Java,
> using
> Apache Soap 1.2.
>
> The service has has one method, getFortune, that takes an int (zero
>
> for a short fortune, non-zero for a longer fortune) and returns a
> string -- the fortune itself. This works fine.
>
> Replacing the int with a boolean (the intention being true for
> long,
> false for short) on the other hand, consistently causes Soap::Lite
> to
> throw a fault: "Application failed during request deserialization:
> Wrong boolean value 'true'".
>
> I am constructing my parameter in Java this way:
> parameters.addElement(
> new Parameter(
> "bShortFortune",
> boolean.class,
> new Boolean(false),
> null
> )
> );
>
> And in perl, ...
> sub getFortune {
> my ($class, $bShort) = @_;
> my $fortune;
> if (not $bShort) {
> $fortune .= "bShort is false";
> } else {
> $fortune .= "bShort is TRUE";
> }
> }
>
> The request and response are below. As you can see, the client
> encodes the boolean as
> <bShortFortune xsi:type="xsd:boolean">true</bShortFortune>.
> Is this a problem?
>
> Regards,
> --Prasenjeet
>
>
> = REQUEST ===============================
>
> POST /cgi-bin/soapfortune2.pl HTTP/1.0
> Host: styx:80
> Content-Type: text/xml; charset=utf-8
> Content-Length: 466
> SOAPAction: ""
>
> <?xml version='1.0' encoding='UTF-8'?>
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/1999/XMLSchema">
> <SOAP-ENV:Body>
> <ns1:getFortune xmlns:ns1="SoapDev/Fortune"
>
> SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
> <bShortFortune xsi:type="xsd:boolean">true</bShortFortune>
> </ns1:getFortune>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
>
> = RESPONSE ===============================
>
> HTTP/1.1 500 Internal Server Error
> Date: Wed, 10 Oct 2001 14:15:07 GMT
> Server: Apache/1.3.19 (Unix) (Red-Hat/Linux) mod_ssl/2.8.1
> OpenSSL/0.9.6 DAV/1.0.2 PHP/4.0.4pl1
> SOAPServer: SOAP::Lite/Perl/0.51
> Content-Length: 612
> Connection: close
> Content-Type: text/xml; charset=utf-8
>
> <?xml version="1.0" encoding="UTF-8"?>
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
>
> SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/1999/XMLSchema">
> <SOAP-ENV:Body>
> <SOAP-ENV:Fault>
> <faultcode xsi:type="xsd:string">
> SOAP-ENV:Client
> </faultcode>
> <faultstring xsi:type="xsd:string">
> Application failed during request deserialization:
> Wrong
> boolean value 'true'
> </faultstring>
> </SOAP-ENV:Fault>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
>
>
>
>
>
> ------------------------ Yahoo! Groups Sponsor
>
> To unsubscribe from this group, send an email to:
> soaplite-unsubscribe@yahoogroups.com
>
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>


__________________________________________________
Do You Yahoo!?
NEW from Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1



Tue Oct 9, 2001 6:13 pm

paulclinger@...
Send Email Send Email

Message #895 of 6437 |
Expand Messages Author Sort by Date

Hi, I have a really basic question -- please forgive me if it's been already been answered. I wrote a simple web service to display a fortune, using Soap::Lite...
Prasenjeet Dutta
prasenjeetd@...
Send Email
Oct 9, 2001
4:55 pm

Hi, Prasenjeet! ... That's a known problem with SOAP::Lite v0.51. boolean type in XML Schema 1999 doesn't accept 'true/false', only '1/0' which is incorrect....
Paul Kulchenko
paulclinger@...
Send Email
Oct 9, 2001
6:13 pm

Hi Paul, I upgraded my soaplite from 0.50 to 0.52, but I ran into problems in boolean. I did a search on boolean in the messages and found the below message...
eat_lemon@...
eat_lemon
Offline Send Email
Nov 28, 2001
3:19 pm

Hi, Simon! ... "false". Hm, can't confirm that. Both "1" and "true" give me 1, "0" and "false" give me 0 and all other values produce "Wrong boolean value" ...
Paul Kulchenko
paulclinger
Offline Send Email
Nov 28, 2001
3:44 pm

Hi Paul, I forgot to mention to you that I'm talking to a Java Server using Apache SOAP. My code is basically: SOAP::Data->type(boolean => 1). On the Java...
eat_lemon@...
eat_lemon
Offline Send Email
Nov 28, 2001
4:47 pm

Hi, Simon! Unfortunately it depends on XML schema you're looking at. For example this schema [1] says: An instance of a datatype that is defined as boolean can...
Paul Kulchenko
paulclinger
Offline Send Email
Nov 28, 2001
5:40 pm
Advanced

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help