Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Soap::Lite and Complex Types

by BaldPenguin (Friar)
on Dec 22, 2005 at 21:26 UTC ( [id://518632]=perlquestion: print w/replies, xml ) Need Help??

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

Fellow Monks:

I am using SOAP::Lite as a client to access a SOAP server (AXIS on Apache) and had found it really simple until I got to a specific Complex Type. The WSDL fro the type is:
<complexType name="HashMapBean"> <sequence> <element name="values" nillable="true" type="impl:ArrayOf_xsd_stri +ng"/> <element name="keys" nillable="true" type="impl:ArrayOf_xsd_string +"/> </sequence> </complexType>
If I query a method in the web service that returns a HashMapBean it comes back as:
$VAR = bless( { 'keys' => bless( [ 'name', 'addr', 'phone' ], 'string' ), 'values' => bless( [ 'bubba', 'home', '555-1212' ], 'string') }, 'HashMapBean' )
In another method, I need to pass in a HashMapBean, so I create the same structure and pass it in the the SOAP::Lite call and I get the error:
String value expected instead of string reference
From browsing the code it appears that inserializing the data before sending it it bounces back that message when anything declared as a string type has a value that is a reference.

Has anyone else encountered this message or have any ideas how I can send this complex type throught to the soap server.

Of all the messages I have found (Googled), they all suggest changing the soap server's method params. but I do not have that access.

Any information would be helpful, thanks in advance.

Don
WHITEPAGES.COM | INC
Everything I've learned in life can be summed up in a small perl script!

Replies are listed 'Best First'.
Re: Soap::Lite and Complex Types
by jhourcle (Prior) on Dec 23, 2005 at 15:11 UTC

    It took me a little bit to figure out what the problem was ...

    Here's a minimal test case:

    Because you've cast the array as a 'string', it's calling the 'as_string' method, which doesn't like references. You'd have to cast each one individually as strings ... which you can't do, because they're not references. But you don't actually have to cast items as strings (which you need to use SOAP::Data for), unless isn't something that SOAP::Lite might incorrectly guess on (eg, if it's all digits, it'll look like a number, and might be cast as an int)

    You can also find good information on dealing with more complex structures in SOAP::Lite at Byrne Reese's website

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2024-03-29 00:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found