It's all about the answers!

Ask a question

using perl LWP for accesing ResourceOrientedWorkitemAPI


Aruljothi Sivakurunathan (3198) | asked Dec 15 '10, 6:57 a.m.
Dear Friends,

I have been trying to resolve following requirement

"Identify the workitems that has been fixed/delivered on a particular stream and find whether the workitem is created by internally by qa team or externally for customers (field defect)"

As i see there are two parts

1) Gather the workitems that has been delivered to a stream using baseline comparision or some methodology
2) For each of the above workitem query using REST API to find out whether the workitem is created internally or externally

First is there a best way to accomplish above requirements.

Second, For point (2), I tried to use perl LWP module, but it does not give the xml, rather it is gives some html output as shown below. Any help is appreciated

Thanks & Regards,
Aruljothi.S

<DOCTYPE>

<Licensed>

<html>

<head>
<meta>
<meta>
<title>Loading...</title>

<link>


<link></link>

<style>
#net-jazz-ajax-NoScriptMessage {
width: 100%;
color: #D0D0D0;
font-size: 2em;
text-align: center;
position: absolute;
top: 45%;
z-index: 999;
}
</style>

<if>
<style>
body {
width: expression(documentElement.clientWidth < 860 ? "860px": "" );
}
</style>
<endif>

</head>

<body>
<noscript><div>Javascript is either disabled or not available in your Browser</div></noscript>
<div>Loading...</div>
<div></div>

<script>
djConfig = {isDebug: false, usePlainJson: true, baseUrl: "/jazz/web/dojo/"};
net = {jazz: {ajax: {}}};
net.jazz.ajax._contextRoot = "/jazz";
net.jazz.ajax._webuiPrefix = "/web/";
</script>

<script></script>

<script>
dojo.require("net.jazz.ajax.ui.PlatformUI");
</script>

<script>
/* <CDATA> */
</script>



<script>
/* <CDATA> */
</script>
</body>
</html>

3 answers



permanent link
Aruljothi Sivakurunathan (3198) | answered Dec 15 '10, 7:01 a.m.
Following is the perl script i used

use LWP::UserAgent;
use HTTP::Request;
use Data::Dumper;
my $ua = LWP::UserAgent->new;
my $req = HTTP::Request->new(GET => 'https://rtcserver:9443/jazz/oslc/workitems/15137.xml');
$req->authorization_basic('user','password');
$req->header('Accept' => "text/xml");
$ua->agent('Mozilla/5.0');
my $res = $ua->request($req);
# Check the outcome of the response
if($res->is_success) {
print $res->content;
}
else {
print $res->status_line, "\n";
}

permanent link
Cliff Gardiner (92727) | answered Apr 27 '16, 10:11 a.m.
Hi Aruljothi,
I'm having the same problem, but for me it's when I retrieve the Project Areas doc from the URI specified in the CCM Root Services doc https://<server>:9443/ccm/process/project-areas. 
Curiously this worked fine until I was obliged to restart my machine for Windows updates!  Before that the expected XML was returned, today I get an HTML page very similar to the one you describe.

Did you find a way round this problem?

permanent link
Cliff Gardiner (92727) | answered Apr 28 '16, 11:02 a.m.
No worries, I managed to answer it myself :o)

Your answer


Register or to post your answer.