Solved

Perl Script: Internal Server Error

Posted on 2004-08-10
4
233 Views
Last Modified: 2008-01-09
I've developed a code where I'm sending an XML document via SOAP to a server but I'm getting an Internal server Error, I can't work out the problem. I'll list my code, can someone please point out to me where I'm going wrong.


#!perl -w
#!c:\indigoperl\bin\perl.exe

use lib 'c:\indigoperl';
#use SOAP::Lite;

#---------------------------------------------------------------------------------
#use this line of code underneath ->proxy and before the ; to get an output of the
#XML request and response pair.  Excellent for debugging
#
#           ->on_debug(sub{print@_})
#----------------------------------------------------------------------------------

#declare variables for use throughout the script
#$seekUserName = 'careers';
#$seekPassword = 'recruit';
#$seekRole = 'Client';
$seekxml = '<?xml version="1.0" encoding="UTF-8"?><FastLanePlus UploaderId="19997922" AgentID=""><Client ID="1732" MinJobs="0" MaxJobs="9999999"><Job Reference="CAR1059" TemplateID="85" ScreenID=""><Title>"GAMES DESIGNER"</Title><SearchTitle>GAMES DESIGNER</SearchTitle><Description>WHAT ON EARTH GOES IN DESCRIPTION</Description><AdDetails><![CDATA[<P>Our Client is a world leader in gaming technology. They are seeking to employ a Games Designer for the creation of poker machine concepts, and mathematical calculations, using probability theory. To be considered for this position, you should have:</P><P>Strong creative flair;</P><P>Tertiary qualifications with Math studies;</P><P>C programming;</P><P>Previous experience in the gaming industry is desirable.</P><br><B>To Apply for this job </B>]]></AdDetails><ApplicationEmail>rodgerp@dbasplus.com</ApplicationEmail><ApplicationURL>http://buzzwig.com</ApplicationURL><ResidentsOnly>Yes</ResidentsOnly><Items><Item Name="Bullet1">Leader in Gaming Technology</Item><Item Name="Bullet2">Games Designer with Creative Flair</Item><Item Name="Bullet3">Strong Math ability</Item><Item Name="Consultant">Richard Face</Item><Item Name="ConsultantTelephone">87410456</Item><Item Name="ResumeRequired">No</Item></Items><Listing MarketSegments="Main"><Classification Name="Location">Sydney</Classification><Classification Name="Industry">Accounting</Classification><Classification Name="Discipline">Acctg-Commerce</Classification><Classification Name="WorkType">Full Time</Classification><Classification Name="Function">General Management</Classification></Listing></Job></Client> </FastLanePlus>';

$seekUserName = 'Buzzwig2';
$seekPassword = 'test';
$seekRole = 'Client';
$testAuthProxy = 'http://test.webservices.seek.com.au/FastLanePlus.asmx';
$liveAuthProxy = 'http://webservices.seek.com.au/WebServiceAuthenticator.asmx';

$uri = 'http://webservices.seek.com.au';

#create an object that is a connection to the seek web service
#change the variable $liveProxy
my $s = SOAP::Lite
  ->uri($uri)
  ->proxy($liveAuthProxy)
  ->on_debug(sub{print@_})
  ->on_action(sub{sprintf '%s/%s', @_ })
  ;
print "PRIOR TO GETTING TOKEN\n";
#now we invoke the RpcAuthenticateWS method and store the result in $authToken
#set up the relevant username and password into SOAP data
$userName = SOAP::Data->name('userName')->value($seekUserName);
$password = SOAP::Data->name('password')->value($seekPassword);
$role = SOAP::Data->name('role')->value($seekRole);

#then call the RpcAuthenticateWS method and get the result
$authToken = $s
   ->RpcAuthenticateWS($userName, $password, $role)
   ->result
   ;

print "\nTOKEN RETURNED  $authToken\n";

#now we have the authorisation token, we call RpcUploadFile to upload the xml document
$liveUploadProxy = 'http://webservices.seek.com.au/FastLanePlus.asmx';

$testUploadProxy = 'http://test.webservices.seek.com.au/FastLanePlus.asmx';

#create object that is a connection to the soap server
my $uploader = SOAP::Lite
  ->uri($uri)
  ->proxy($liveUploadProxy)
  ->on_debug(sub{print@_})
  ->on_action(sub{sprintf '%s/%s', @_ })
  ;
print "\nPRIOR TO UPLOAD\n";
print "\n XML STRING BEING UPLOADED IS $seekxml \n\n";
#now we invoke the RpcUploadFile method.
#first set up the parameters passed to the function
$token = SOAP::Data->name('Token')->value($authToken);
#####$data = SOAP::Data->name("axmlFastlaneFile")->value($seekxml);
$data = SOAP::Data->name("xmlFastlaneFile")->value($seekxml);

#and then call the function
$uploadResult = $uploader
  ->RpcUploadFile($token, $data)
  ;
print "\nAFTER UPLOAD\n";
0
Comment
Question by:maykut
4 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 11770616
Did you mean to comment out
#use SOAP::Lite;
0
 
LVL 2

Expert Comment

by:PaulS_III
ID: 11772090
I have had this problem as well with other types of scripts.

I am sure you have already checked this, but I think it is worth restating.

Did you ensure that your script is executable and owned by your web server user?

Also, how are you executing the script? You might want to check either the web server error log or maybe the messages log (assuming this is being run from a linux box, maybe a wrong assumption) for some clues.

I could be way wrong, so if I am, my apologies.
0
 
LVL 48

Accepted Solution

by:
Tintin earned 50 total points
ID: 11778621
As ozo says, uncomment the

use SOAP::Lite;

command.

BTW, you shouldn't need the line:

use lib 'c:\indigoperl';

as that will be in the default search path.

Also, checking the Apache webserver error logs will give you the error, or you can add

use CGI::Carp qw(fatalsToBrowser);

to your script to see the errors in the browser.
0
 
LVL 1

Author Comment

by:maykut
ID: 11789530
guys I think its working I'm just doing some more testing on it.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now