http://www.perlmonks.org?node_id=868226


in reply to Re: Issues with Perl SOAP
in thread Issues with Perl SOAP

here is my perl script. I am trying to create a new space in Confluence (the Atlassian program).

#!perl use SOAP::Lite; use Data::Dumper; my $username = 'admin'; my $password = 'admin'; my $soap = SOAP::Lite->service("file:confluenceRemoteService.xml"); # +the wsdl print "logging in...\n"; $auth = $soap->login($username, $password); ### everything above here is fine, included for completeness ### $soap->addSpace($auth, { "key" => SOAP::Data->type(string => 'BOXER'), "name" => SOAP::Data->type(string => 'Battlecruiser opera +tional'), "description" => SOAP::Data->type(string => "This is a space") } ) or die "didnt work again\n"; exit 0;

So when I run it, the program dies at the end there because the addSpace call failed. I've been in contact with someone from Atlassian and they were able to tell me that when they run the script, the hash becomes a null object inside of the program.

I've tried a lot of little things, just fiddling around with the script. I've tried enclosing the hash in Soap::Data->type(struct =>...), ive tried creating the hash before the call and passing it in as %hash. I've tried creating a hash reference and passing in $hash.

I've even tried to use a different function called getSpace to get a Space object, and then printed it using Data::Dumper. I then used the output to create a Space object such that when I printed my object using Data::Dumper, it would print out in the same format as the space that I get when I call getSpace. (a little convoluted) but that didnt work either.

So now I'm trying to either get some help on how I create remote objects (structs) and send them through SOAP or find a way to print out the exact xml that is being sent, or something to determine why my hash doesn't isnt being processed correctly

Here is the relevant part of the Atlassian documentation

Space addSpace(String token, Space space) - create a new space, passing in name, key and description.

Where Space is

Space

Key Type Value
key String the space key
name String the name of the space
url String the url to view this space online
homePage String the id of the space homepage
description String the HTML rendered space description