http://qs321.pair.com?node_id=651660


in reply to SOAP array construction with SOAP::Data::ComplexType

I was tired of writing a large complex data with plain SOAP::Data and was so glad to have found SOAP::Data::ComplexType
Stop right there. You don't have to construct SOAP::Data hierarchies by hand!. Use SOAP::WSDL (instead of SOAP::Lite), which

I simply cannot believe how many folks are doing this the hard way. It's almost like Perl-based users of SOAP hate themselves ;)

A service method Foo expecting an array of xsd:string elements for the argument called 'Words' can be called as follows:

  $soap->Foo(Words => [qw/this is a test!/]);

No need to hand-construct anything under SOAP::Data at all.

-David

Replies are listed 'Best First'.
Re^2: SOAP array construction with SOAP::Data::ComplexType
by takeos (Initiate) on Nov 20, 2007 at 01:35 UTC

    Thanks for the nice advice, David. Actually I've already tried it before. Unfortunately SOAP::WSDL available via ActivePerl's Perl Package Manager is 1.20 and has a bug which causes wrong typing. And the latest version, probably 1.25, requires some ActivePerl built-in components (including SOAP::Lite) to be updated and I gave it up.

    Reading your comment, it still seems to be the best way to go though. I will try some other versions of SOAP::WSDL to see if there's any version that works on ActivePerl with minimum updates.

    Of course the correct usage of SOAP::Data::ComplexType will be also welcome.

      Unfortunately SOAP::WSDL available via ActivePerl's Perl Package Manager is 1.20 and has a bug which causes wrong typing.
      I'm using 1.20 on my production box, 1.25 on my dev box.

      I've passed arrays of strings (and arrays of other complexTypes) to services before using both versions.

      What type errors in value construction are you seeing? If there's really a problem there, perhaps you could Report a bug ?

      And the latest version, probably 1.25, requires some ActivePerl built-in components (including SOAP::Lite) to be updated and I gave it up.
      SOAP::Lite and SOAP::WSDL are both Perl-Only modules (examples aside), so just upgrade them on your dev box via CPAN, then use PPM::Make to build PPM packages for your testing/production machines. If you don't have nmake.exe (from visual studio) installed, you can get instructions here.

      SOAP::WSDL is currently undergoing a re-write (v2 series). From what I understand it will have a mostly similar interface but will be much more flexible. A (developer) release is available now for testing.

      Why don't you check if your issues are resolved with the v2 series?

      -David

        Thank you again for your kind comments. I spent this morning to see what the problem is exactly and found SOAP::WSDL 1.20 was trying to find an appropriate input/output message using /definitions/service/port/@name value while it has to use /definitions/portType/@name value. I've added a line,

        $soap->_wsdl_portname('ServiceName'); #retrieved from /definitions/portType/@name

        and everything seems working so far. Well now it's so easy to write a code that I can't stop laughing :-)

        And thanks for V2 series info. I'm gonna try it when I feel the current version is not powerful enough for what I want to do.

        It has been almost 6 weeks since I started lerning Perl by myself and now I feel relieved to find there's so many supportive people around here at perlmonks. I wish I could help another one sooner.