Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

SOAP::Lite misbehavior or bug?

by McMahon (Chaplain)
on Jun 08, 2006 at 19:12 UTC ( [id://554340]=perlquestion: print w/replies, xml ) Need Help??

McMahon has asked for the wisdom of the Perl Monks concerning the following question:

I have a Perl SOAP client that insists on sending
<ConfirmUnsubscribes xsi:type="xsd:int">0</ConfirmUnsubscribes>
which is rejected by the server with an error
Fault: Validation constraint violation: data type mismatch xsd:int in element <ConfirmUnsubscribes>
However, I have a Ruby SOAP client that is behaving exactly correctly when it interprets the WSDL and sends data that looks like:
<ConfirmUnsubscribes xsi:type="n2:ConfirmUnsubEnum">0</ConfirmUnsubscribes>
That is: the data type for "ConfirmUnsubscribes" is in fact a member of an array "ConfirmUnsubEnum" and is not necessarily an int (even though, ok, it's an int at heart)

Can anyone suggest a way to either make the server less strict, or else to improve the WSDL-reading capability of the Perl SOAP client in SOAP::Lite?

Replies are listed 'Best First'.
Re: SOAP::Lite misbehavior or bug?
by duckyd (Hermit) on Jun 08, 2006 at 23:20 UTC
    SOAP::Lite doesn't have much WSDL support. You can either set the type manually as suggested above, or consider using SOAP::WSDL which should set the types correctly in the request based on the WSDL.
Re: SOAP::Lite misbehavior or bug?
by jhourcle (Prior) on Jun 09, 2006 at 14:23 UTC
    Can anyone suggest a way to either make the server less strict, or else to improve the WSDL-reading capability of the Perl SOAP client in SOAP::Lite?

    To make the server 'less strict', the only way that I know of is to change it to use document/literal encoding, which doesn't require the clients to send a type for each element, and so it's 'less strict' in that there's no type to match against. However, I have no idea what it would require to change your server to do this.

    For better WSDL support, I know there exists SOAP::WSDL, but I've never used it. My problem is the opposite -- supporting strict clients w/ a SOAP::Lite server. For that, I use a replacement serializer, which doesn't examine the value of the element to determine the type, but looks at the element's name (I either pull the name from the hash key, or bless items into a class).

Re: SOAP::Lite misbehavior or bug?
by Anonymous Monk on Jun 08, 2006 at 19:40 UTC
    It's possible to override most of SOAP::Lite's element generation, but it would be helpful to know what the WSDL is so we can find out what's wrong and improve it.
      The WSDL itself is gigantic, but the appropriate part is
      <simpleType name="ConfirmUnsubEnum"> &#8722; <restriction base="xsd:string"> <enumeration value="0"/> <enumeration value="1"/> <enumeration value="2"/> </restriction> </simpleType>
        Well, I can offer a suggestion for manually encoding your element, which ignores both the WSDL and the broken SOAP::Lite serializer:
        my $confirm = SOAP::Data->new; $confirm->name("{http://the.target.namespace/here}ConfirmUnsubscribes" +); $confirm->type("{http://the.schema.namespace/here}ConfirmUnsubEnum");

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://554340]
Approved by GrandFather
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (2)
As of 2024-04-16 23:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found