Hi there,

Here is a full sample of my code that calls the doSelect web service function. In the code sample I make a retrieveCategories subroutine call that prints the full result and valueof result. Notice, the full result is correctly displayed but valueof method does not return the value.

Here is my code sample

#!/usr/bin/perl -w use SOAP::Lite trace=>'debug'; #use SOAP::Lite; use Data::Dumper; use strict; # Perl sub routine to call Service Desk login method # and specify Service Desk Web Services end point sub login_get_SID { # Edit $server, $user and $pw as needed. my $server = '192.168.1.152:8180'; my $endpoint = '/axis/services/USD_R11_WebService?WSDL'; my $user = ''; #user id my $pw = ''; #user pwd my $wsdl = 'http://' . $server . $endpoint; my $service = SOAP::Lite->service($wsdl); my $sid = $service->login($user, $pw); return ($service, $sid); } # Always a best practice to call logout() when done sub logout { my ($service, $sid) = @_; $service->logout($sid) } # method to retrieve all Incident Areas sub retrieveCategories { my ($service, $sid, $service_name) = @_; my $method = SOAP::Data->uri('http://www.ca.com/UnicenterServicePl +us/ServiceDesk')->name('doSelect'); # Attributes for object to be created can be pulled # from majic files. my @params = ( SOAP::Data->name("sid" => $sid), SOAP::Data->name("objectType" => 'pcat'), SOAP::Data->name("whereClause" => "sym like 'Appl% +'"), SOAP::Data->name("maxRows" => "1"), SOAP::Data->name("attributes" => \SOAP::Data->value( SOAP::Data->name("string" => "sym"), SOAP::Data->name("string" => 'description') ) ), ); #print "dumper: ".Dumper(@params)."\n"; my $result = $service->call($method => @params); print "----result method call ---\n".$result->result."----- end re +sult ----\n"; print "----valueof method call ----\n".$result->valueof('//AttrNam +e[1]')."----- end valueof ----\n"; return ($result); } # Main calls my ($service, $sid) = login_get_SID(); retrieveCategories($service, $sid); logout($service, $sid);

Here is the output from retrieveCategories() subroutine:

----result method call --- <?xml version="1.0" encoding="UTF-8"?> <UDSObjectList> <UDSObject> <Handle>pcat:5103</Handle> <Attributes> <Attribute DataType="2002"> <AttrName>sym</AttrName> <AttrValue>Applications</AttrValue> </Attribute> <Attribute DataType="2002"> <AttrName>description</AttrName> <AttrValue>Applications</AttrValue> </Attribute> </Attributes> </UDSObject> </UDSObjectList> ----- end result ---- ----valueof method call ---- ----- end valueof ----

This section is the full trace output.

SOAP::Transport::HTTP::Client::send_receive: POST http://192.168.1.152 +:8180/axis/services/USD_R11_WebService HTTP/1.1 Accept: text/xml Accept: multipart/* Accept: application/soap Content-Length: 713 Content-Type: text/xml; charset=utf-8 SOAPAction: "" <?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:wsdlsoap="h +ttp://schemas.xmlsoap.org/wsdl/soap/" xmlns:apachesoap="http://xml.ap +ache.org/xml-soap" soap:encodingStyle="http://schemas.xmlsoap.org/soa +p/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" x +mlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:impl="http://www.c +a.com/UnicenterServicePlus/ServiceDesk" xmlns:xsi="http://www.w3.org/ +2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/so +ap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body +><impl:login><username xsi:type="xsd:string">ServiceDesk</username><p +assword xsi:type="xsd:string">Un1c3nt3r</password></impl:login></soap +:Body></soap:Envelope> SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK Connection: close Date: Mon, 15 Sep 2008 18:58:44 GMT Server: Apache-Coyote/1.1 Content-Type: text/xml;charset=utf-8 Client-Date: Mon, 15 Sep 2008 18:58:45 GMT Client-Peer: 192.168.1.152:8180 Client-Response-Num: 1 <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envel +ope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http:// +www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <loginResponse xmlns="http://www.ca.com/UnicenterServicePlus/Service +Desk"> <loginReturn xsi:type="xsd:int" xmlns="">639087957</loginReturn> </loginResponse> </soapenv:Body> </soapenv:Envelope> SOAP::Transport::HTTP::Client::send_receive: POST http://192.168.1.152 +:8180/axis/services/USD_R11_WebService HTTP/1.1 Accept: text/xml Accept: multipart/* Accept: application/soap User-Agent: SOAP::Lite/Perl/0.710.05 Content-Length: 1000 Content-Type: text/xml; charset=utf-8 SOAPAction: "" <?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:wsdlsoap="h +ttp://schemas.xmlsoap.org/wsdl/soap/" xmlns:apachesoap="http://xml.ap +ache.org/xml-soap" xmlns:namesp7="http://www.ca.com/UnicenterServiceP +lus/ServiceDesk" soap:encodingStyle="http://schemas.xmlsoap.org/soap/ +encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xml +ns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsi="http://www.w3.o +rg/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org +/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:B +ody><namesp7:doSelect xmlns:namesp7="http://www.ca.com/UnicenterServi +cePlus/ServiceDesk"><sid xsi:type="xsd:int">639087957</sid><objectTyp +e xsi:type="xsd:string">pcat</objectType><whereClause xsi:type="xsd:s +tring">sym like 'Appl%'</whereClause><maxRows xsi:type="xsd:int">1</m +axRows><attributes><string xsi:type="xsd:string">sym</string><string +xsi:type="xsd:string">description</string></attributes></namesp7:doSe +lect></soap:Body></soap:Envelope> SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK Connection: close Date: Mon, 15 Sep 2008 18:58:44 GMT Server: Apache-Coyote/1.1 Content-Type: text/xml;charset=utf-8 Client-Date: Mon, 15 Sep 2008 18:58:46 GMT Client-Peer: 192.168.1.152:8180 Client-Response-Num: 1 <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envel +ope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http:// +www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <doSelectResponse xmlns="http://www.ca.com/UnicenterServicePlus/Serv +iceDesk"> <doSelectReturn xmlns="">&lt;?xml version=&quot;1.0&quot; encoding= +&quot;UTF-8&quot;?&gt;&#xd; &lt;UDSObjectList&gt;&#xd; &lt;UDSObject&gt;&#xd; &lt;Handle&gt;pcat:5103&lt;/Handle&gt;&#xd; &lt;Attributes&gt;&#xd; &lt;Attribute DataType=&quot;2002&quot;&gt;&#xd; &lt;AttrName&gt;sym&lt;/AttrName&gt;&#xd; &lt;AttrValue&gt;Applications&lt;/AttrValue&gt;&#xd; &lt;/Attribute&gt;&#xd; &lt;Attribute DataType=&quot;2002&quot;&gt;&#xd; &lt;AttrName&gt;description&lt;/AttrName&gt;&#xd; &lt;AttrValue&gt;Applications&lt;/AttrValue&gt;&#xd; &lt;/Attribute&gt;&#xd; &lt;/Attributes&gt;&#xd; &lt;/UDSObject&gt;&#xd; &lt;/UDSObjectList&gt;&#xd; &#xd; </doSelectReturn> </doSelectResponse> </soapenv:Body> </soapenv:Envelope> Use of uninitialized value in concatenation (.) or string at C:\dev\us +dservices\perlmonk_sample.pl line 54. SOAP::Transport::HTTP::Client::send_receive: POST http://192.168.1.152 +:8180/axis/services/USD_R11_WebService HTTP/1.1 Accept: text/xml Accept: multipart/* Accept: application/soap User-Agent: SOAP::Lite/Perl/0.710.05 Content-Length: 648 Content-Type: text/xml; charset=utf-8 SOAPAction: "" <?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:wsdlsoap="h +ttp://schemas.xmlsoap.org/wsdl/soap/" xmlns:apachesoap="http://xml.ap +ache.org/xml-soap" soap:encodingStyle="http://schemas.xmlsoap.org/soa +p/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" x +mlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:impl="http://www.c +a.com/UnicenterServicePlus/ServiceDesk" xmlns:xsi="http://www.w3.org/ +2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/so +ap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body +><impl:logout><sid xsi:type="xsd:int">639087957</sid></impl:logout></ +soap:Body></soap:Envelope> SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK Connection: close Date: Mon, 15 Sep 2008 18:58:46 GMT Server: Apache-Coyote/1.1 Content-Type: text/xml;charset=utf-8 Client-Date: Mon, 15 Sep 2008 18:58:47 GMT Client-Peer: 192.168.1.152:8180 Client-Response-Num: 1 <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envel +ope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http:// +www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <logoutResponse xmlns="http://www.ca.com/UnicenterServicePlus/Servic +eDesk"/> </soapenv:Body> </soapenv:Envelope>

Thanks,

fujiman

In reply to Re^2: Why SOAP::Lite Method call returned partially XML formatted? by fujiman
in thread Why SOAP::Lite Method call returned partially XML formatted? by fujiman

Title:
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, details, 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, summary, 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.