Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Issues with Perl SOAP

by J_Alex (Initiate)
on Oct 28, 2010 at 06:04 UTC ( [id://867919]=perlquestion: print w/replies, xml ) Need Help??

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

Hiya all,

I've been tasked to write a program to automate some processes at work and I've run into an issue. There is a method call that should accept a hash, but for some reason it fails. I ran a program called SoapUI and it works if I recreate the call it in XML.

So I'm lost on how to debug this thing now. I've tried looking through the SOAP::Lite documentation to see if I can get the raw XML that is sent to the endpoint (since I can compare this to what I wrote in SoapUI which uses pure XML), but can only find methods to get the response.

Any advice on how I go about solving this issue?

Replies are listed 'Best First'.
Re: Issues with Perl SOAP
by mojotoad (Monsignor) on Oct 28, 2010 at 06:44 UTC
    Yes. Please describe the issue and provide some example code that illustrates it.

    Cheers,
    Matt

      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
Re: Issues with Perl SOAP
by shevek (Beadle) on Oct 28, 2010 at 09:32 UTC
    Hello,

    Please provide actual code in the future. Without code I am guessing, but I assume you are not familiar with how to debug SOAP::Lite and do not know about SOAP::Trace? Please check the following node: SOAP::Lite, WSDLs and Raw XML Data.

    Don't be afraid to use Super Search.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-24 05:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found