Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9313767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T01:57:48+00:00 2026-06-19T01:57:48+00:00

I’m trying — and failing — to write a simple test app using SOAP::LITE

  • 0

I’m trying — and failing — to write a simple test app using SOAP::LITE to access an HP Service Manager site. (I’ve also tried SOAP::WSDL, but further reading made me believe that it really isn’t required for what I want to do.)

I’m new to SOAP, new to these packages, and new to what I’m trying to do, so I don’t know how many things I’m doing wrong, but I think I’ve distilled it down to a few lines of code that seem to me should work. I think the essential problem is in authentication, but I’ve also given some thought that it may be the way I’m trying to call the service manager routine via SOAP.

Here’s the first method I found:

#!/usr/local/perl5/bin/perl
use SOAP::Lite+trace => 'all';

$USER = "working_user_name";
$PASS = "working_password";

sub SOAP::Transport::HTTP::Client::get_basic_credentials {
        print "###\n";
        print "###\n";
        print "### Authenticating...\n";
        print "###\n";
        print "###\n";
        return $USER => $PASS;
}


my $soap = SOAP::Lite->new(proxy => 'http://<hp_service_manager>:13080/SM/7/ws');
$soap->default_ns('http://schemas.hp.com/SM/7');
my $som = $soap->call('RetrieveList');
die $som->faultstring if ($som->fault);
print $som->result, "\n";

And the LWP method I tried:

#!/usr/local/perl5/bin/perl
use SOAP::Lite+trace => 'all';
use LWP::UserAgent;
use LWP::Debug;
LWP::Debug::level('+');

$USER = "working_user_name";
$PASS = "working_password";

my @ua_args = (keep_alive => 1);
my @credentials = ($SERVICE_NS, "", $USER, $PASS);
my $schema_ua = LWP::UserAgent->new(@ua_args);
$schema_ua->credentials(@credentials);

my $soap = SOAP::Lite->new(proxy => 'http://<hp_service_manager>:13080/SM/7/ws', @ua_args, credentials => \@credentials);
$soap->default_ns('http://schemas.hp.com/SM/7');
my $som = $soap->call('RetrieveList');
die $som->faultstring if ($som->fault);
print $som->result, "\n";

The issue is that no matter what I do I get a “not authorized” return. It’s an HP Service Manager installation. I’ll provide the WSDL entry for what I’m trying to do. I doubt it’s useful.

<soap:operation soapAction="RetrieveList" style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>

While there is a lot more where this came from, this is the pertinent output, I believe:

SOAP::Transport::HTTP::Client::send_receive: HTTP::Request=HASH(0x845c630)
SOAP::Transport::HTTP::Client::send_receive: POST http://<service_manager>:13080/SM/7/ws HTTP/1.1
Accept: text/xml
Accept: multipart/*
Content-Length: 488
Content-Type: text/xml; charset=utf-8
SOAPAction: "#default_ns"

<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><default_ns><c-gensym3 xsi:type="xsd:string">http://schemas.hp.com/SM/7</c-gensym3></default_ns></SOAP-ENV:Body></SOAP-ENV:Envelope>
SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x8597238)
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 401 Unauthorized
Connection: close
Date: Fri, 15 Feb 2013 19:42:06 GMT
Server: Apache-Coyote/1.1
WWW-Authenticate: Basic realm="CASM"
Content-Length: 40
Content-Type: text/html;charset=utf-8
Client-Date: Fri, 15 Feb 2013 19:42:07 GMT
Client-Peer: nnn.nn.nn.nn:13080
Client-Response-Num: 1

<HTML><BODY>Not Authorized</BODY></HTML>

Can anyone help? I’ve tried pretty much every example I’ve been able to find, and then tried variations of those examples, and I’ve never managed to get any futher. In every case I get a “Not Authorized” return.

Thanks,

Sean.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T01:57:50+00:00Added an answer on June 19, 2026 at 1:57 am

    Don’t be mislead: SOAP::Lite’s debugging output doesn’t show the Authorization header (for some reason?).

    The “overriding get_basic_credentials”-method globally sets the username/password, regardless of domain and realm. Which is actually a bad thing…

    This (tested) piece of code should fix your issue:

    #!/usr/local/perl5/bin/perl -w
    use strict;
    use SOAP::Lite+trace => 'all';
    
    my $soap = SOAP::Lite->new('proxy' => [
                            'http://<yourdomain>:<yourport>/<yourpath>',
                            'credentials' => [
                                    "<yourdomain>:<yourport>",
                                    "<yourrealm>",
                                    "<yourusername>",
                                    "<yourpassword>"
                            ]
                    ]);
    my $som = $soap->RetrieveList();
    die $som->faultstring if ($som->fault);
    print $som->result, "\n";
    

    Where “<yourrealm>” should be set to “CASM”, “<yourpath>” should be set to “/SM/7/ws”, “<yourport>” should be set to “13080”.

    Old reply: Try doing it like this instead (note the extra asterisk):

    *SOAP::Transport::HTTP::Client::get_basic_credentials = sub { 
     return ($USER, $PASS);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
We're building an app, our first using Rails 3, and we're having to build
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I am using Paperclip to handle profile photo uploads in my app. They upload
I'm making a simple page using Google Maps API 3. My first. One marker
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.