> I've looked low and high and can't find any example code on how to construct a security header
> that contains both Timestamp and UsernameToken nodes. I need to construct a header
> that looks like this:
Hello,
I've looked low and high and can't find any example code on how to construct a
security header that contains both Timestamp and UsernameToken nodes. I need to
construct a header that looks like this:
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1">
<wsu:Timestamp wsu:Id="Timestamp">
<wsu:Created>2009-12-09T16:34:34.990Z</wsu:Created>
<wsu:Expires>2009-12-09T16:44:34.990Z</wsu:Expires>
</wsu:Timestamp>
<wsse:UsernameToken
xsi:type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-sec\
ext-1.0.xsd">
<wsse:Username>user</wsse:Username>
<wsse:Password>2dqe1e123</wsse:Password>
<wsse:Nonce>de87wdsd23d23e</wsse:Nonce>
<wsse:Created>2009-05-19T16:02:45.168Z</wsse:Created>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
Does anyone know of any code examples that demonstrate how to implement this?
I've got everything except for the Timestamp node. Here is what I've done so
far:
my $authhash_ref = {
Username => SOAP::Data->type( '' => $username )->prefix('wsse'),
Password => SOAP::Data->type( $token => $pw_digest )->prefix('wsse'),
Nonce => SOAP::Data->type( '' => $nonce)->prefix('wsse'),
Created => SOAP::Data->type('' => $timestamp)->prefix('wsu'),
};
my $security_header = SOAP::Header->new(
name => 'Security',
prefix => 'wsu',
uri => $wsu,
value => \SOAP::Data->new(
name => 'UsernameToken',
prefix => 'wsse',
type => $wsse,
value => $authhash_ref,
),
);
Any help would be greatly appreciated.
Hi,
New to the group -- I'm trying to configure a SOAP service using SOAP::Lite
under mod_perl on Apache on one of our servers.
* If I set up a standalone server using "SOAP::Transport::HTTP::Daemon", it
works just fine.
* If I "bypass" SOAP::Lite by injecting my own simplistic protocol (not really
an option for immediate use right now) between my module containing the service
code and the mod_perl layer, this also works.
* The same code and basic configuration are working on other servers (some
module versions may be slightly different).
When I try to use SOAP::Lite under Apache, however, on this one server, I get
the following message returned to the client:
Application failed during request deserialization:
no element found at line 1, column 0, byte -1 at
/usr/perl5/site_perl/5.8.4/sun4-solaris-64int/XML/Parser.pm line 187
This happens consistently for any given request (identical, other than port
number, to what I send to the standalone server, which works, using as much
identical code as possible to what is running under Apache).
Can anyone help me diagnose this issue?
Some details:
Apache/2.0.63 (Unix) DAV/2 mod_perl/2.0.0 Perl/v5.8.4 configured
Summary of my perl5 (revision 5 version 8 subversion 4) configuration:
Platform:
osname=solaris, osvers=2.10, archname=sun4-solaris-64int
package SOAP::Lite;
use 5.005;
use strict;
use vars qw($VERSION);
use version; $VERSION = qv('0.710.10');
package XML::Parser;
use Carp;
BEGIN {
require XML::Parser::Expat;
$VERSION = '2.36';
Partial httpd.conf (I removed a few things to protect specific internal details
and such -- PerlSetEnv used to configure my code layer, and a
PerlPostConfigRequire to help initialize something):
PerlSwitches -I/usr/apache2/perl
PerlModule Apache::DBI
PerlModule ModPerl::Registry
ScriptAlias /perl/ "/usr/apache2/perl/"
<Location /perl>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options +ExecCGI
</Location>
<Directory /usr/apache2/perl>
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
To run under Apache:
use SOAP::Lite +trace;
use SOAP::Transport::HTTP;
use xxxx;
SOAP::Transport::HTTP::CGI->dispatch_to('xxxx')->handle;
Trace info:
SOAP::Transport::new: ()
SOAP::Serializer::new: ()
SOAP::Deserializer::new: ()
SOAP::Parser::new: ()
SOAP::Server::new: ()
SOAP::Transport::HTTP::Server::new: ()
SOAP::Transport::HTTP::CGI::new: ()
SOAP::Transport::HTTP::Server::handle:
SOAP::Server::handle: ()
SOAP::Deserializer::deserialize: ()
SOAP::Parser::decode: ()
SOAP::Serializer::envelope: ()
SOAP::Serializer::envelope: Client Application failed during request
deserialization:
no element found at line 1, column 0, byte -1 at
/usr/perl5/site_perl/5.8.4/sun4-solaris-64int/XML/Parser.pm line 187
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Transport::HTTP::CGI::DESTROY: ()
SOAP::Deserializer::DESTROY: ()
SOAP::Parser::DESTROY: ()
SOAP::Transport::DESTROY: ()
SOAP::Serializer::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
For the standalone:
use SOAP::Lite +trace;
use SOAP::Transport::HTTP;
use xxxx;
my $daemon = SOAP::Transport::HTTP::Daemon->new(LocalPort => #####)
->dispatch_to('xxxx');
print "Server responds to ", $daemon->url, "\n";
$daemon->handle;
(where ##### is actually a port number :-)
Hi Guys,
Im still having problems with my soap request, it seems like its formed well but
i've noticed in when tracing it, the request made is different to what is
probably expected:
Looking for a standard soap request (from IBM) we get the following:
POST /EndorsementSearch HTTP/1.1
Host: www.snowboard-info.com
Content-Type: text/xml; charset="utf-8"
Content-Length: 261
SOAPAction: "http://www.snowboard-info.com/EndorsementSearch"
I've noticed when looking through the trace output to terminal, i see that the
soapaction generated is of the form
"http://www.snowboard-info.com/#EndorsementSearch"
How do you remove # from the soapaction header?
The soap::lite code i've used is as follows:
use SOAP::Lite (+trace => [qw(transport debug parameters)]);
my $proxy = SOAP::Lite->proxy('http:/localhost');
$proxy->readable(1);
$proxy->autotype(0);
$proxy->uri("http://www.betfair.com/publicapiv3BFGlobalService/");
my $response = $proxy->call("login",
SOAP::Data->name('request')->value(
\SOAP::Data->value(
SOAP::Data->name('locationId')->value(0)->attr( { xmlns =>
"" }),
SOAP::Data->name('password')->value('bfpassword')->attr( {
xmlns => "" }),
SOAP::Data->name('productId')->value(82)->attr( { xmlns =>
"" }),
SOAP::Data->name('username')->value('bfusername')->attr( {
xmlns => "" }),
SOAP::Data->name('vendorSoftwareId')->value(0)->attr( {
xmlns => "" }),
)
)
);
Hi,
> I) You also replied to another email in the soaplite, yahoo
> email. Where you specified that through this command:
> $proxy->uri("http://www.betfair.com/publicapi/v3/BFGlobalServi
> ce/"); # namespace of your method
>
> We can generate
> <soap:Body>
> <login xmlns="http://www.betfair.com/publicapi/v3/BFGlobalService/">
>
> Can I do this for my requirement too?
in priniple yes. If you use this, you can write:
$proxy->uri("http://docs.oasis-open.org/ws-sx/ws-trust/200512/")
$proxy->call("RequestSecurityToken",...
instead of
$proxy->serializer->register_ns("http://docs.oasis-open.org/ws-sx/ws-trust/2
00512/","ns2")
$proxy->call("ns2:RequestSecurityToken",...
I.e. you do not need prefixes ($prefix2) for your elements inside
RequestSecurityToken, when using ->uri(NS) and
when all request elements are within this namespace.
> 2) You also mentioned that I can register namespaces inside
> SOAP:Envelop , and then do not need to do that stuff again
> for SOAP::Header , SOAP:Body?
right.
> Are you sure that the code which you sent me , ( where we are
> not inserting namespaces inside Header / body ) would also work?
yes. Except - the server does strange things with the request :-/
But I don't excpect the server to do strange things...
>
> SOAP::Lite I guess creates the header and body automatically
> when I issue the method call at runtime.I do not have the
> control to insert namespaces there.
You can. But why do you need them? It is ok to put a namespace declaration
on a valid "place". Envelope is
a valid place.
Anyway, you can supply a namespace for every element, including the method
name (RequestSecurityToken) by using:
$proxy->call(SOAP::Data->name("xyxyxy:RequestSecurityToken")->attr( {
"xmlns:xyxyxy => "urn:theNamespace" }), ...
Cheers,
Martin
Hi Kartik,
i've fixed an cleaned your code. Now, with the attached code, you will
generate semantically the same request,
as your reference one. I mean semantically as the prefixes are different
sometimes, but they mean the same.
Also, your reference request contained unnecessary xmlns attribute, I've
removed them.
What's the point?
A namespace definition may occur anywhere in the code and is valid in that
element as well as in all chils.
(except it is overriden in childs)
"ns3:UsernameToken" and "wsu:usernameToken" are equal, if there the prefixes
are defined als follows:
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurit
y-utility-1.0.xsd"
xmlns:ns3="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurit
y-utility-1.0.xsd"
So it is perfectly ok to use just one prefix.
By default, SOAP::Lite puts the xmlns:* attributes into the Envelope, which
is correct. You also do not need to
generate the Header element, SOAP::Lite generates it when needed.
Cheers,
Martin
Hi Jared,
> bit of code to tell me
> how to create the following soap request:
>
> <?xml version="1.0" encoding="utf-8"?>
> <soap:Envelope
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <soap:Body>
> <login
> xmlns="http://www.betfair.com/publicapi/v3/BFGlobalService/">
> <request>
> <locationId xmlns="">0</locationId>
> <password xmlns="">bfpassword</password>
> <productId xmlns="">82</productId>
> <username xmlns="">bfusername</username>
> <vendorSoftwareId xmlns="">0</vendorSoftwareId>
> </request>
> </login>
> </soap:Body>
> </soap:Envelope>
here comes it:
# Debug options: see the request actually being generated
#
use SOAP::Lite (+trace => [qw(transport debug parameters)]);
my $proxy = SOAP::Lite->proxy('http:/localhost');
$proxy->readable(1);
$proxy->autotype(0); # disable generation of "xsi:type" attribute
$proxy->uri("http://www.betfair.com/publicapi/v3/BFGlobalService/"); #
namespace of your method
my $response = $proxy->call(
"login",
SOAP::Data->name('request')->value(
\SOAP::Data->value(
SOAP::Data->name('locationId')->value(0)->attr( { xmlns =>
"" }),
SOAP::Data->name('password')->value('bfpassword')->attr( {
xmlns => "" }),
SOAP::Data->name('productId')->value(82)->attr( { xmlns =>
"" }),
SOAP::Data->name('username')->value('bfusername')->attr( {
xmlns => "" }),
SOAP::Data->name('vendorSoftwareId')->value(0)->attr( {
xmlns => "" }),
)
)
);
the weird about your request is, that the elements inside "request" do have
a null namespace, this needs to be
generated using ->attr( {xmlns => ""} ). The rest is just a
straight-forward.
Cheers,
Martin
Hi Guys
I've been fiddling around with SOAP::Lite and think its great so far, but am
really struggling to get a result. I was wondering if anyone could give me a
bit of code to tell me how to create the following soap request:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<login xmlns="http://www.betfair.com/publicapi/v3/BFGlobalService/">
<request>
<locationId xmlns="">0</locationId>
<password xmlns="">bfpassword</password>
<productId xmlns="">82</productId>
<username xmlns="">bfusername</username>
<vendorSoftwareId xmlns="">0</vendorSoftwareId>
</request>
</login>
</soap:Body>
</soap:Envelope>
I've even gone as far as creating a stub and trying to call the login method,
but i trip up trying to put the keys and values into the soap request (im
guessing this is what im doing wrong).
Any help would be appreciated - it will probably mean a lightbulb moment and
then i can move on ;) thanks guys!~
Hi,
> When a SOAP::Lite server returns a hash array to a Python
> client, and one of the hash fields is a large chunk of binary
> data (actually the contents of a .wav file), the following is
> printed on stdout:
>
> Use of inherited AUTOLOAD for non-method
> SOAP::Serializer::as_base64Binary() is deprecated at
> /usr/lib/perl5/vendor_perl/5.8.8/SOAP/Lite.pm line 1167.
>
> When using a Perl client, it works correctly. Here's the SOAP
> request from the Python client:
If this is a server message, then it should be returned, whatever client
sends the request. I suppose, perl and python do not generate the same
request.
You might try SoapUI (www.soapui.com) to find out what part of a request
causes the problem.
> Use of inherited AUTOLOAD for non-method
SOAP::Serializer::as_base64Binary()
> is deprecated at /usr/lib/perl5/vendor_perl/5.8.8/SOAP/Lite.pm line 1167.
The code causing the problem has to do with the "autotype" feature.
Cheers,
Martin
Hi Dave,
the problem is, that SOAP::Lite does not serialize ArrayOfXXX types.
There are 2 ways to solve it:
1. define an own serializer:
---------------------
sub serialize_array {
my ($self, $value, $name, $type, $attr) = @_;
return [
$name,
{ %$attr },
[ map { SOAP::Data->name("item")->value($_)->type("") } @$value ],
];
}
*SOAP::Serializer::as_ArrayOfInt = \&serialize_array;
*SOAP::Serializer::as_ArrayOfString = \&serialize_array;
$service->serializer->typelookup->{ArrayOfInt} = [99, sub { ref($_[0]) eq
'ARRAY' }, 'as_ArrayOfInt'];
$service->serializer->typelookup->{ArrayOfString} = [99, sub { ref($_[0]) eq
'ARRAY' }, 'as_ArrayOfString'];
my @cp2 = (123);
my @columns = ("abc","def");
my $t = $service->getTrafficSummaryForCPCode( \@cp2
,'2009-11-00T00:00:00','2009-11-05T00:00:00','PST8PDT',\@columns);
-------------------------
2. Do not use the SOAP::Lite's serialization at all, construct your request
yourself.
As you are using a stub, make the parameters array emtpy, i.e. delete the
following lines:
parameters => [
SOAP::Data->new(name => 'cpcodes', type => 'tns1:ArrayOfInt', attr =>
{}),
SOAP::Data->new(name => 'start', type => 'xsd:dateTime', attr => {}),
SOAP::Data->new(name => 'end', type => 'xsd:dateTime', attr => {}),
SOAP::Data->new(name => 'timeZone', type => 'xsd:string', attr => {}),
SOAP::Data->new(name => 'columns', type => 'tns1:ArrayOfString', attr
=> {}),
], # end parameters
then call the service as follows:
my $t = $service->getTrafficSummaryForCPCode(
SOAP::Data->name('cpcodes')->type(undef)->value( \SOAP::Data->value(
SOAP::Data->name('item')->value(123)->type(undef)
)),
SOAP::Data->name('start')->type('xsd:dateTime')->value('2009-11-26T00:00:00'
),
...
);
Cheers,
Martin
Hi,
> How to insert a Namespace inside SOAP:Header Tag? I know how
> to do it for childnodes but not for the first node , the actual
>
> SOAP::Header?
>
> Same query for SOAP::Body
$namespace = "urn:myns";
$proxy->serializer->register_ns($namespace);
my $prefix = $proxy->serializer->find_prefix($namespace);
then you can use the prefix in your elements, e.g.:
SOAP::Data->name("$prefix:mydata")
Cheers,
Martin
--- In soaplite@yahoogroups.com, Aleksandar Jelenak <aleksandar.jelenak@...>
wrote:
>
> > my @cp2;
> > $cp2[0] = '33333';
>
> It is shorter to write:
>
> my @cp2 = (33333);
>
> > my $returnResult =
$service->getTrafficSummaryForCPCode(\@cp2,'2009-11-00T00:00:00','2009-11-05T00:\
00:00','PST8PDT',\@columns);
>
> The start date is not valid: 2009-11-00. You probably meant
> 2009-11-01. Maybe this is the real culprit?
>
> -Aleksandar
>
You are correct, but even after fixing the date (which had been correct in
previous versions) SOAP::Lite still does not pass in my array to the server.
my @cp2 = (33333);
my $returnResult =
$service->getTrafficSummaryForCPCode(\@cp2,'2009-11-01T00:00:00','2009-11-05T00:\
00:00','PST8PDT',\@columns); # WS Call
<soap:Body><akasiteDeldt:getTrafficSummaryForCPCode><cpcodes xsi:nil="true"
xsi:type="akasiteDeldt:ArrayOfInt" /><start
xsi:type="xsd:dateTime">2009-11-01T00:00:00</start><end
xsi:type="xsd:dateTime">2009-11-05T00:00:00</end><timeZone
xsi:type="xsd:string">PST8PDT</timeZone><columns xsi:nil="true"
xsi:type="akasiteDeldt:ArrayOfString"
/></akasiteDeldt:getTrafficSummaryForCPCode></soap:Body>
Is there any more debugging I can turn on to find out why it won't properly
format my data structure?
-Dave
> my @cp2;
> $cp2[0] = '33333';
It is shorter to write:
my @cp2 = (33333);
> my $returnResult =
$service->getTrafficSummaryForCPCode(\@cp2,'2009-11-00T00:00:00','2009-11-05T00:\
00:00','PST8PDT',\@columns);
The start date is not valid: 2009-11-00. You probably meant
2009-11-01. Maybe this is the real culprit?
-Aleksandar
Hi,
I'm kinda at wits end so hopefully this will make some sense. I'm trying to
get a report from Akamai using their SOAP interface.
I downloaded their WSDL file and used stubmaker.pl to generate the Perl
module. I'm using SOAP::Lite version 0.710.10.
Here is the call I make from my client:
my @cp2;
$cp2[0] = '33333';
my $returnResult =
$service->getTrafficSummaryForCPCode(\@cp2,'2009-11-00T00:00:00','2009-11-05T00:\
00:00','PST8PDT',\@columns);
Which is a call to:
getTrafficSummaryForCPCode => {
endpoint =>
'https://control.akamai.com/nmrws/services/SiteAcceleratorReportService',
soapaction => '',
namespace => 'https://control.akamai.com/SiteAcceleratorReportService.xsd',
parameters => [
SOAP::Data->new(name => 'cpcodes', type => 'akasiteDeldt:ArrayOfInt', attr
=> {}),
SOAP::Data->new(name => 'start', type => 'xsd:dateTime', attr => {}),
SOAP::Data->new(name => 'end', type => 'xsd:dateTime', attr => {}),
SOAP::Data->new(name => 'timeZone', type => 'xsd:string', attr => {}),
SOAP::Data->new(name => 'columns', type => 'akasiteDeldt:ArrayOfString',
attr => {}),
], # end parameters
}, # end getTrafficSummaryForCPCode
The problem is when I run this, all the fields that are straight up xsd types
(dateTime and string) work fine, but the akasiteDeldt types just show up as
blank.
<soap:Body><akasiteDeldt:getTrafficSummaryForCPCode><cpcodes xsi:nil="true"
xsi:type="akasiteDeldt:ArrayOfInt" /><start
xsi:type="xsd:dateTime">2009-11-00T00:00:00</start><end
xsi:type="xsd:dateTime">2009-11-05T00:00:00</end><timeZone
xsi:type="xsd:string">PST8PDT</timeZone><columns xsi:nil="true"
xsi:type="akasiteDeldt:ArrayOfString"
/></akasiteDeldt:getTrafficSummaryForCPCode></soap:Body>
However, for example, the first field is supposed to look like:
<cpcodes xsi:type="akasiteDeldt:ArrayOfInt"
soapenc:arrayType="xsd:int[]"><item>33244</item><item>33234</item></cpcodes>
If I change the type from akasiteDeldt:ArrayOfInt to xsd:string and pass in a
string, then it gets sent correctly (which of course breaks on the receiving
(server) end).
I'm guessing SOAP::Lite must not like the datastructure I'm passing in and
therefore will not format the fields correctly.
This is how ArrayOfInt is defined in the WSDL:
<complexType name="ArrayOfInt">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:int[]"/>
</restriction>
</complexContent>
</complexType>
I've tried passing in arrays, arrays of arrays, hashes of arrays, references to
arrays, hashes, etc. Still no luck.
How can I nail down what getTrafficSummaryForCPCode is expecting for a data
structure or why SOAP::Lite is not populating my field correctly?
Any help would be greatly appreciated. I've run this as far with Akamai support
as I can.
Cheers,
-Dave
Hi all,
I'm having an issue and it may be a simple thing to resolve it.
When a SOAP::Lite server returns a hash array to a Python client, and one of the
hash fields is a large chunk of binary data (actually the contents of a .wav
file), the following is printed on stdout:
Use of inherited AUTOLOAD for non-method SOAP::Serializer::as_base64Binary() is
deprecated at /usr/lib/perl5/vendor_perl/5.8.8/SOAP/Lite.pm line 1167.
When using a Perl client, it works correctly. Here's the SOAP request from the
Python client:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<ns1:get_message xmlns:ns1="Integrics/Enswitch/API" SOAP-ENC:root="1">
<v1 xsi:type="xsd:string">username</v1>
<v2 xsi:type="xsd:string">password</v2>
<v3 xsi:type="xsd:string">1234</v3>
<v4 xsi:type="xsd:string">INBOX</v4>
<v5 xsi:type="xsd:string">voicemail</v5>
<v6 xsi:type="xsd:string">msg0000</v6>
</ns1:get_message>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
and here's what the client is reporting returned:
<?xml version="1.0" encoding="UTF-8"?><soap:Envelope
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><get_mess
ageResponse xmlns="Integrics/Enswitch/API"><gensym><name
xsi:type="xsd:string">msg0000.wav</name><mimetype
xsi:type="xsd:string">audio/x-wav</mimetype></gensym></get_messageResponse>
</soap:Body></soap:Envelope>
but there should also be a <data></data> field returned with about 500KB of
data. SOAP::Lite is 0.710.10, Perl is 5.8.8, the server OS is Centos 4.8.
Any ideas on what could be wrong?
Thanks!
Now it's working. Also, I had a single slash between http: and the IP.
Thank you very much for your help !!!!!!
Cheers,
Paolo
Martin Busik ha scritto:
Hi Paolo,
Sorry to bother still, but looks like the perl module isn't geting the hostname correctly.
I get this error
Client-Warning: Internal response
500 Can't connect to :80 (Bad hostname '')
my $proxy = SOAP::Lite->proxy('http:/192.168.1.1/:20000');
Invalid url is the problem.
It should be propably 'http://192.168.1.1:20000/'
I've copied the above string from the wsdl you've uploaded to the list.
There comes
the error from.
Cheers,
Martin
Hi Paolo,
> Sorry to bother still, but looks like the perl module isn't
> geting the hostname correctly.
>
> I get this error
> Client-Warning: Internal response
>
> 500 Can't connect to :80 (Bad hostname '')
my $proxy = SOAP::Lite->proxy('http:/192.168.1.1/:20000');
Invalid url is the problem.
It should be propably 'http://192.168.1.1:20000/'
I've copied the above string from the wsdl you've uploaded to the list.
There comes
the error from.
Cheers,
Martin
Hi Paolo,
> Is there someone that could provide me some sample code for
> this request ?
my $proxy = SOAP::Lite->proxy('http:/192.168.1.1/:20000'); # Endpoint,
defined in your wsdl
my $TNS_NS = "http://www.gruppounieuro.com/wsdl";
my $TEMPURI_NS = "http://tempuri.org";
$proxy->serializer->register_ns($TNS_NS);
$proxy->serializer->register_ns($TEMPURI_NS);
my $tnsprefix = $proxy->serializer->find_prefix($TNS_NS);
my $tempuriprefix = $proxy->serializer->find_prefix($TEMPURI_NS);
my $response = $proxy->call(
"$tnsprefix:S_IntCli",
SOAP::Data->name('Cogn')->value('ANITA')->type("$tempuriprefix:scastring.wit
hnull"),
SOAP::Data->name('Nome')->value('CALLIKU')->type("$tempuriprefix:scastring.w
ithnull"),
SOAP::Data->name('Cap')->value('17055')->type("$tempuriprefix:scastring.with
null"),
SOAP::Data->name('P_iva')->value('')->type("$tempuriprefix:scastring.withnul
l"),
);
Cheers,
Martin
Hello,
I'm trying to create a request with SOAP::Lite with the enclosed WSDL.
I'd like to obtain something like the attached request (generated by
NuSoap in PHP) but I can't find a way to write it.
Is there someone that could provide me some sample code for this request ?
Thanks a lot in advance.
Best regards,
Paolo
Hi Wes,
> As of now I'm parsing the string with XML::LibXML, so the question
> still stands. Can I force SOAP::Lite to parse that interior XML
> string, even though it's been escaped?
No. If the XML-Schema-Type of the result element is "string", then
SOAP::Lite
(as well as other WS-packages) can treat it as a string only.
Cheers,
Martin
I am running a local StockQuoteService ,
http://localhost:8080/axis2/services/StockQuoteService?wsdl
$stockprice=SOAP::Lite ->service('http://localhost:8080/axis2/service/
StockQuoteService?wsdl') ->getPrice('IBM'); print Dumper($stockprice);
The result returns $VAR1 = undef;
I am getting a undef value , what is
the correct way to call a webservice using Perl?
When I run the code with URL I get the following SOAP message returned
<code>
<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header
xmlns:wsa="http://www.w3.org/2005/08/addressing"><wsa:Action>http://www.w3.org/2\
005/08/addressing/soap/fault</wsa:Action></soapenv:Header><soapenv:Body><soapenv\
:Fault><faultcode>VersionMismatch</faultcode><faultstring>Only SOAP 1.1 or SOAP
1.2 messages are supported in the system</faultstring><detail
/></soapenv:Fault></soapenv:Body></soapenv:Envelope>
</code>
Can somebody guide me where I am getting wrong? Which are the best modules to
parse WSDLs in Perl?
It turns out SOAP::Lite was Doing The Right Thing. I'd overlooked a
note in the service docs that that said
>Note: The special characters inside <ns:return> tag are encoded to entities.
(e.g. an xml return >value will contain < characters, which will be encoded to
< entities) Therefore entity decoding >is needed on the client side.
What I thought was just a trace output inconsistency was actually the
problem. SOAP::Lite being nice and unescaping the entities before they
ended up in the Dumper confused me as well. I originally included the
documentation's example because it was already formatted nicely.
Here's the actual output:
>
> <?xml version='1.0' encoding='utf-8'?>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
> <soapenv:Body>
> <ns:getVersionInfoResponse xmlns:ns="http://webservice.jchem.chemaxon">
> <ns:return>
> <Info>
> <JChem>
> <Version>5.2.6</Version>
> </JChem>
> <Java>
> <Vendor>Sun Microsystems Inc.</Vendor>
> <VmName>Java HotSpot(TM) Client VM</VmName>
> <Version>1.6.0_05</Version>
> </Java>
> <Os>
> <Arch>x86</Arch>
> <Name>Windows XP</Name>
> <Version>5.1</Version>
> </Os>
> </Info>
> </ns:return>
> </ns:getVersionInfoResponse>
> </soapenv:Body>
> </soapenv:Envelope>
Plus, everyone knows < is the same as <, right? Right? ;_;
As of now I'm parsing the string with XML::LibXML, so the question
still stands. Can I force SOAP::Lite to parse that interior XML
string, even though it's been escaped?
FWIW, I'm on version 0.710.08, the newest in the Win32-Trouchelle repo.
Thanks again,
Wes
On Mon, Nov 9, 2009 at 2:55 PM, Martin Busik <martin.busik@...> wrote:
>
> Hi,
> which SOAP::Lite Version are you using?
>
> I've tried your example with 0.69 as well as with 0.710.10.
>
> The result of the 0.69 differs from the result of 0.710.10, but also differs
> from your code.
> (The difference between 0.69 and 0.710.10 is, that in 0.710.10 there is an
> instance of SOAP::Data for
> every xml element returned, i.e. for JChem, Os, Java etc, where the 0.69
> returned just getVersionInfoResponse as
> a SOAP::Data instance)
>
> Cheers,
> Martin
>
>
> > -----Ursprüngliche Nachricht-----
> > Von: soaplite@yahoogroups.com
> > [mailto:soaplite@yahoogroups.com] Im Auftrag von Wes Malone
> > Gesendet: Montag, 9. November 2009 01:47
> > An: soaplite@yahoogroups.com
> > Betreff: [soaplite] Why does Soap::Lite stop parsing this response?
> >
> > I'm trying to write a simple SOAP client. After making a request, the
> > response only seems to be parsed into perl data structure a couple
> > levels down. After that it's just a string of the remaining XML. I
> > feel like it would be really kludgy to take that string and parse it
> > manually with another XML parser.
> >
> > > my $response = $soap->getVersionInfo;
> > > my $data = $response->dataof('//getVersionInfoResponse');
> >
> >
> > The SOAP response looks like this in the trace:
> >
> > > <?xml version='1.0' encoding='utf-8'?>
> > > <soapenv:Envelope
> > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
> > > <soapenv:Body>
> > > <ns:getVersionInfoResponse
> > xmlns:ns="http://webservice.jchem.chemaxon">
> > > <ns:return>
> > > <Info>
> > > <JChem>
> > > <Version>5.2.1</Version>
> > > </JChem>
> > > <Java>
> > > <Vendor>Sun Microsystems Inc.</Vendor>
> > > <VmName>Java HotSpot(TM) Server VM</VmName>
> > > <Version>1.6.0_06</Version>
> > > </Java>
> > > <Os>
> > > <Arch>x86</Arch>
> > > <Name>Windows XP</Name>
> > > <Version>5.1</Version>
> > > </Os>
> > > </Info>
> > > </ns:return>
> > > </ns:getVersionInfoResponse>
> > > </soapenv:Body>
> > > </soapenv:Envelope>
> >
> > But what gets parsed into $data looks like this:
> >
> > > \bless( {
> > > _attr => {},
> > > _name => "getVersionInfoResponse",
> > > _prefix => "ns",
> > > _signature => [],
> > > _uri => "http://webservice.jchem.chemaxon",
> > > _value => [
> > > {
> > > return =>
> > "<Info>\n<JChem>\n<Version>5.2.6</Version>\n</JChem>\n<Java>\n
> > <Vendor>Sun Microsystems Inc.</Vendor>\n<VmName>Java
> > HotSpot(TM) Client
> > VM</VmName>\n<Version>1.6.0_05</Version>\n</Java>\n<Os>\n<Arch
> > >x86</Arch>\n<Name>Windows
> > XP</Name>\n<Version>5.1</Version>\n</Os>\n</Info>\n"
> > > }
> > > ]
> > > }, 'SOAP::Data' )
> >
> > This is a simple example, but for more complex responses, it could
> > become a huge hassle to have to parse out that XML.
> >
> > I found this post
> > (http://tech.groups.yahoo.com/group/soaplite/message/2641) on the
> > mailing list (from 2003!) that had a worrisome quote on it:
> >
> > > Keep in mind the requirement that any
> > > attributes not natively known to SOAP
> > > must be namespace-qualified.
> >
> > And I noticed that everything that wasn't getting parsed was not
> > namespaced. Is there a way to force SOAP::Lite to parse that
> > non-namespaced xml? Is that even the problem?
> >
> > Thanks,
> > Wes
> >
> >
> > ------------------------------------
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
>
Hi,
which SOAP::Lite Version are you using?
I've tried your example with 0.69 as well as with 0.710.10.
The result of the 0.69 differs from the result of 0.710.10, but also differs
from your code.
(The difference between 0.69 and 0.710.10 is, that in 0.710.10 there is an
instance of SOAP::Data for
every xml element returned, i.e. for JChem, Os, Java etc, where the 0.69
returned just getVersionInfoResponse as
a SOAP::Data instance)
Cheers,
Martin
> -----Ursprüngliche Nachricht-----
> Von: soaplite@yahoogroups.com
> [mailto:soaplite@yahoogroups.com] Im Auftrag von Wes Malone
> Gesendet: Montag, 9. November 2009 01:47
> An: soaplite@yahoogroups.com
> Betreff: [soaplite] Why does Soap::Lite stop parsing this response?
>
> I'm trying to write a simple SOAP client. After making a request, the
> response only seems to be parsed into perl data structure a couple
> levels down. After that it's just a string of the remaining XML. I
> feel like it would be really kludgy to take that string and parse it
> manually with another XML parser.
>
> > my $response = $soap->getVersionInfo;
> > my $data = $response->dataof('//getVersionInfoResponse');
>
>
> The SOAP response looks like this in the trace:
>
> > <?xml version='1.0' encoding='utf-8'?>
> > <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
> > <soapenv:Body>
> > <ns:getVersionInfoResponse
> xmlns:ns="http://webservice.jchem.chemaxon">
> > <ns:return>
> > <Info>
> > <JChem>
> > <Version>5.2.1</Version>
> > </JChem>
> > <Java>
> > <Vendor>Sun Microsystems Inc.</Vendor>
> > <VmName>Java HotSpot(TM) Server VM</VmName>
> > <Version>1.6.0_06</Version>
> > </Java>
> > <Os>
> > <Arch>x86</Arch>
> > <Name>Windows XP</Name>
> > <Version>5.1</Version>
> > </Os>
> > </Info>
> > </ns:return>
> > </ns:getVersionInfoResponse>
> > </soapenv:Body>
> > </soapenv:Envelope>
>
> But what gets parsed into $data looks like this:
>
> > \bless( {
> > _attr => {},
> > _name => "getVersionInfoResponse",
> > _prefix => "ns",
> > _signature => [],
> > _uri => "http://webservice.jchem.chemaxon",
> > _value => [
> > {
> > return =>
> "<Info>\n<JChem>\n<Version>5.2.6</Version>\n</JChem>\n<Java>\n
> <Vendor>Sun Microsystems Inc.</Vendor>\n<VmName>Java
> HotSpot(TM) Client
> VM</VmName>\n<Version>1.6.0_05</Version>\n</Java>\n<Os>\n<Arch
> >x86</Arch>\n<Name>Windows
> XP</Name>\n<Version>5.1</Version>\n</Os>\n</Info>\n"
> > }
> > ]
> > }, 'SOAP::Data' )
>
> This is a simple example, but for more complex responses, it could
> become a huge hassle to have to parse out that XML.
>
> I found this post
> (http://tech.groups.yahoo.com/group/soaplite/message/2641) on the
> mailing list (from 2003!) that had a worrisome quote on it:
>
> > Keep in mind the requirement that any
> > attributes not natively known to SOAP
> > must be namespace-qualified.
>
> And I noticed that everything that wasn't getting parsed was not
> namespaced. Is there a way to force SOAP::Lite to parse that
> non-namespaced xml? Is that even the problem?
>
> Thanks,
> Wes
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>
I'm trying to write a simple SOAP client. After making a request, the
response only seems to be parsed into perl data structure a couple
levels down. After that it's just a string of the remaining XML. I
feel like it would be really kludgy to take that string and parse it
manually with another XML parser.
> my $response = $soap->getVersionInfo;
> my $data = $response->dataof('//getVersionInfoResponse');
The SOAP response looks like this in the trace:
> <?xml version='1.0' encoding='utf-8'?>
> <soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
> <soapenv:Body>
> <ns:getVersionInfoResponse
xmlns:ns="http://webservice.jchem.chemaxon">
> <ns:return>
> <Info>
> <JChem>
> <Version>5.2.1</Version>
> </JChem>
> <Java>
> <Vendor>Sun Microsystems Inc.</Vendor>
> <VmName>Java HotSpot(TM) Server VM</VmName>
> <Version>1.6.0_06</Version>
> </Java>
> <Os>
> <Arch>x86</Arch>
> <Name>Windows XP</Name>
> <Version>5.1</Version>
> </Os>
> </Info>
> </ns:return>
> </ns:getVersionInfoResponse>
> </soapenv:Body>
> </soapenv:Envelope>
But what gets parsed into $data looks like this:
> \bless( {
> _attr => {},
> _name => "getVersionInfoResponse",
> _prefix => "ns",
> _signature => [],
> _uri => "http://webservice.jchem.chemaxon",
> _value => [
> {
> return =>
"<Info>\n<JChem>\n<Version>5.2.6</Version>\n</JChem>\n<Java>\n<Vendor>Sun
Microsystems Inc.</Vendor>\n<VmName>Java HotSpot(TM) Client
VM</VmName>\n<Version>1.6.0_05</Version>\n</Java>\n<Os>\n<Arch>x86</Arch>\n<Name\
>Windows XP</Name>\n<Version>5.1</Version>\n</Os>\n</Info>\n"
> }
> ]
> }, 'SOAP::Data' )
This is a simple example, but for more complex responses, it could
become a huge hassle to have to parse out that XML.
I found this post
(http://tech.groups.yahoo.com/group/soaplite/message/2641) on the
mailing list (from 2003!) that had a worrisome quote on it:
> Keep in mind the requirement that any
> attributes not natively known to SOAP
> must be namespace-qualified.
And I noticed that everything that wasn't getting parsed was not
namespaced. Is there a way to force SOAP::Lite to parse that
non-namespaced xml? Is that even the problem?
Thanks,
Wes