Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

I'm trying -- and failing -- to write a simple test app using SOAP::LITE. (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(''); 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(''); my $som = $soap->call('RetrieveList'); die $som->faultstring if ($som->fault); print $som->result, "\n";

Can anyone help? This is becoming extremely frustrating. I can't find examples, or if I can, they aren't completely clear to me because I'm not sure I fully understand things like "endpoint", "namespace", "uri", and "urn".

Edit: The issue is that no matter what I do I get a "not authorized" return. No live URLs, as this is a business, and even assuming I gave you one, you couldn't get here. (Not to mention inviting people to try breaking in would probably get me fired.) 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(0x845c +630) SOAP::Transport::HTTP::Client::send_receive: POST http://<service_mana +ger>: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="ht +tp://" xmlns:SOAP-ENC="http://schem" xmlns:SOAP-ENV="http://schemas.xmlsoap" xmlns:xsd="" SOA +P-ENV:encodingStyle=""><SOAP +-ENV:Body><default_ns><c-gensym3 xsi:type="xsd:string">http://schemas</c-gensym3></default_ns></SOAP-ENV:Body></SOAP-ENV:Envel +ope> SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x859 +7238) 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: Client-Response-Num: 1 <HTML><BODY>Not Authorized</BODY></HTML>

Thanks, Sean.

In reply to Help with SOAP::LITE by slgilley

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others chilling in the Monastery: (9)
    As of 2015-11-25 15:08 GMT
    Find Nodes?
      Voting Booth?

      What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

      Results (679 votes), past polls