Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: SOAP array construction with SOAP::Data::ComplexType

by erroneousBollock (Curate)
on Nov 19, 2007 at 13:39 UTC ( #651660=note: print w/ replies, xml ) Need Help??


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
  • handles the namespaces for you
  • constructs outgoing complexType values (including arrays) automatically from normal perl data-structures.
  • is a subclass of SOAP::Lite.

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


Comment on Re: SOAP array construction with SOAP::Data::ComplexType
Select or Download Code
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://651660]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2014-12-28 10:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (180 votes), past polls