| Posted on 2011-08-15 18:29:24.834255-07 by kedom |
| Convert doc to string error when trying to use WSRF |
|
Hi,
I am extremely new to WSRF and am using it to try to connect to a web service that is published on IIS and requires the use of a certificate.
#!/usr/bin/perl
use strict;
use warnings;
use WSRF::Lite +trace => all => sub {};
use Net::SSLeay;
$Net::SSLeay::trace = 3;
use Data::Dumper;
use Crypt::OpenSSL::RSA;
$ENV{WSS_SIGN} = 'true';
$ENV{HTTPS_CA_DIR} = "./certs";
$ENV{HTTPS_CA_FILE} = "./certs/ca-bundle.crt";
$ENV{HTTPS_CERT_FILE} = "./certs/some.ca_wildcard_cert.pem";
$ENV{HTTPS_KEY_FILE} = "./certs/some.ca_wildcard_cert.key";
my $service = WSRF::Lite->new();
$service->autotype(0);
$service->soapversion('1.2');
$service->envprefix('soap12');
$SOAP::Constants::DEFAULT_HTTP_CONTENT_TYPE = 'application/soap+xml';
$service->wsaddress(WSRF::WS_Address->new()->Address($endpoint));
$service->on_fault( \&soapFault );
$service->on_action(sub {"urn:services:some-vsr-something.SomeContract.RetrieveSomething"});
$call = SOAP::Data->name('RetrieveSomeMessage')->attr({'xmlns' => 'urn:services:some-vsr-something'
+});
eval
{
$response = $service->call($call => SOAP::Data->name('RetrieveSomeMessage'));
};
Running this produces the following result
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Transport::new: ()
SOAP::Serializer::new: ()
SOAP::Deserializer::new: ()
SOAP::Parser::new: ()
WSRF::Lite::new: ()
SOAP::Data::new: ()
WSRF::Lite::call: ()
SOAP::Transport::HTTP::Client::new: ()
SOAP::Data::new: ()
WSRF::WSRFSerializer::std_envelope: ()
SOAP::Data::new: ()
WSRF::WSRFSerializer::std_envelope: SOAP::Data=HASH(0xaa1c650) SOAP::Data=HASH(0xaa161d0)
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
Failed to convert doc to string in doc->toStringC14N at /usr/lib64/perl5/site_perl/5.8.8/x86_64-lin
+ux-thread-multi/XML/LibXML.pm line 1347.
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
....
Is anyone able to assist me with determining what is causing the convert error?
Removing the setting of WSS_SIGN results in a SSL connection being established with IIS server and then the certificate is rejected after that. I'm assuming this is because it is not being sent correctly which is why I was trying to use WSRF.
DEBUG: .../IO/Socket/SSL.pm:1464: new ctx 458651872
DEBUG: .../IO/Socket/SSL.pm:334: socket not yet connected
DEBUG: .../IO/Socket/SSL.pm:336: socket connected
DEBUG: .../IO/Socket/SSL.pm:349: ssl handshake not started
DEBUG: .../IO/Socket/SSL.pm:392: Net::SSLeay::connect -> 1
DEBUG: .../IO/Socket/SSL.pm:447: ssl handshake done
DEBUG: .../IO/Socket/SSL.pm:1500: free ctx 458651872 open=458651872
DEBUG: .../IO/Socket/SSL.pm:1508: OK free ctx 458651872
SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x1b879620)
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Server Error
Date: Tue, 16 Aug 2011 01:16:56 GMT
Server: Microsoft-IIS/7.5
Content-Length: 1103
Content-Type: application/soap+xml; charset=utf-8
Client-Date: Tue, 16 Aug 2011 01:16:56 GMT
Client-Peer: 10.231.101.75:444
Client-Response-Num: 1
Client-SSL-Cert-Issuer: /C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=Terms of use at https:/
+/www.verisign.com/rpa (c)10/CN=VeriSign Class 3 Secure Server CA - G3
Client-SSL-Cert-Subject: /C=CA/ST=.../OU=Terms of use at www.verisign.com/rpa (c)05/CN=...
Client-SSL-Cipher: AES128-SHA
Client-SSL-Socket-Class: IO::Socket::SSL
Client-SSL-Warning: Peer hostname match with certificate not verified
X-Powered-By: ASP.NET
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/ad
+dressing"><s:Header><a:Action s:mustUnderstand="1">http://www.w3.org/2005/08/addressing/soap/fault
+</a:Action><a:RelatesTo>urn:www.sve.man.ac.uk-673551468495416116711122270</a:RelatesTo></s:Header>
+<s:Body><s:Fault><s:Code><s:Value>s:Sender</s:Value><s:Subcode><s:Value xmlns:a="http://schemas.xm
+lsoap.org/ws/2005/02/sc">a:BadContextToken</s:Value></s:Subcode></s:Code><s:Reason><s:Text xml:lan
+g="en-US">The message could not be processed. This is most likely because the action 'urn:services
+:some-vsr-something.SomeContract.RetrieveSomething' is incorrect or because the message contains a
+n invalid or expired security context token or because there is a mismatch between bindings. The s
+ecurity context token would be invalid if the service aborted the channel due to inactivity. To pr
+event the service from aborting idle sessions prematurely increase the Receive timeout on the serv
+ice endpoint's binding.</s:Text></s:Reason></s:Fault></s:Body></s:Envelope>
WSRF::Deserializer::deserialize: ()
SOAP::Parser::decode: ()
SOAP::SOM::new: ()
Any asistance is appreciated. |
| Direct Responses: Write a response |