Hello Monks,

I'm having some issues both in using and understanding the nuances of SOAP::Lite. I'm trying to connect to our web service which is using WSDL, get a valid token, and return that token.

I get the following error when I run the script.

not well-formed (invalid token) at line 1, column 198, byte 198 at /usr/lib/perl5/XML/Parser.pm line 187

Here's the script below (with some elments X'd out).
#!/usr/bin/perl use SOAP::Lite +trace => 'debug'; use strict; use warnings; my $username = 'xxxxxx'; my $password = 'xxxxxx'; my $service = SOAP::Lite -> uri('http://xx-xx.xxxxxx.com/xxxws/xxxws?WSDL') -> proxy('http://ws.xxxxxx.com:80/xxxws') ; my $data = SOAP::Data ->name("GetToken" => \SOAP::Data->value( SOAP::Data->name("username" =>'$username'), SOAP::Data->name("password" => '$password') ) ); my $result = $service->call( SOAP::Data ->name('getToken') => $data ); print $result;

The output is below (I did not paste the HTML dump it gives of the elements (IE getToken, getEntitlements, ect).

SOAP::Transport::HTTP::Client::send_receive: POST
http://ws.xxxxxxx.com:80/xxxws HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
Content-Length: 513
Content-Type: text/xml; charset=utf-8
SOAPAction: "#getToken"

<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><getToken><GetToken><username xsi:type="xsd:string">$username</username><password xsi:type="xsd:string">$password</password></GetToken></getToken></soap:Body></soap:Envelope>
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK
Cache-Control: no-cache="set-cookie"
Cache-Control: no-cache="set-cookie"
Connection: Close
Date: Wed, 09 Dec 2015 19:26:08 GMT
Server: Apache-Coyote/1.1
Content-Length: 2167
Content-Type: text/html;charset=ISO-8859-1
Content-Type: text/html; charset=UTF-8
Client-Date: Wed, 09 Dec 2015 19:26:08 GMT
Client-Peer: 54.85.177.107:80
Client-Response-Num: 1
Link: </xxxws/?stylesheet=1>; rel="stylesheet";
type="text/css"
Set-Cookie: AWSELB=xxxxxx;PATH=/;MAX-AGE=30
Set-Cookie: AWSELB=xxxxxx;PATH=/;MAX-AGE=30
Title: CXF - Service list


I think I need to use the namespace somewhere but not sure "where" that is. I've tried a few attempts (well, more then a few) but no luck.

I see from our WSDL page the targetNameSpace is as follows: java:com.xx.xxxws.parameters

I'll keep trying but hoping that you might bestow upon me some small measure of Perl's satori. Thank you.

Kevin M

In reply to SOAP::Lite and getting error "not well-formed (invalid token)" by kdmurphy001

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.