Newbe: soap ssl error send_post 301 Moved Permanently

W

Waterstraat, Joern

Try to convert following perl script to ruby but
get errors as listest in section "RESULT RUBY".

SOAP connection to external Server without SSL
is working. All scripts are running on same machine.

ruby 1.8.2 (2004-12-25) [x86_64-linux], http-access-2_0_5

Any Help?

Joern.

Working:
#!/usr/bin/perl
#################################### PERL ################
use LWP::protocol::https;
use SOAP::Lite
uri =3D> "https://uri",

proxy =3D> "https://myurl";

$ENV{HTTPS_CERT_FILE}=3D$ENV{HOME}.'/.certstore/client_'.$ENV{USER}.'.crt'
;
$ENV{HTTPS_KEY_FILE}=3D$ENV{HOME}.'/.keystore/client_'.$ENV{USER}.'.key';

eval {
my $head =3D undef;
my $soap =3D SOAP::Lite
-> new
-> on_fault(sub{print "Could not init SOAP\n" && exit
1});
my $ret;
my $som =3D $soap
-> call('CheckAuthentication'=3D>$head=3D>$data);
$ret=3D$som -> result;

if(ref $som && $som -> result && $som -> result =3D=3D 1) {
print "Success, authentication ok\n";=0D
} else {
print "Error, no authentication\n";=0D
}
}

Not Working:
#!/usr/local/bin/ruby
###################################### RUBY ##############
require 'http-access2'
require 'soap/rpc/driver'

url =3D "https://myurl"
client =3D SOAP::RPC::Driver.new(url, 'https://uri')
client.add_method("CheckAuthentication","from")
client.loadproperty('sslclient.properties')
p client.CheckAuthentication(__FILE__)

=3Dbegin content sslclient.properties

# verify server's certificate
protocol.http.ssl_config.verify_mode =3D NIL=0D
# certificates for verification
# key and certificate for client identity
protocol.http.ssl_config.client_cert =3D .certstore/client_user.crt
protocol.http.ssl_config.client_key =3D .keystore/client_user.key

=3Dend


Error Messages:
###################################### RESULT RUBY ########
rubysprdb.rb
at depth 1 - 19: self signed certificate in certificate chain
/shared/ruby/1.8.2/lib/ruby/1.8/soap/streamHandler.rb:270:in
`send_post': 301: Moved Permanently (SOAP::HTTPStreamError)
from
/shared/ruby/1.8.2/lib/ruby/1.8/soap/streamHandler.rb:103:in `send'
from /shared/ruby/1.8.2/lib/ruby/1.8/soap/rpc/proxy.rb:114:in
`invoke'
from /shared/ruby/1.8.2/lib/ruby/1.8/soap/rpc/proxy.rb:131:in
`call'
from /shared/ruby/1.8.2/lib/ruby/1.8/soap/rpc/driver.rb:275:in
`call'
from /shared/ruby/1.8.2/lib/ruby/1.8/soap/rpc/driver.rb:302:in
`CheckAuthentication'
from /shared/ruby/1.8.2/lib/ruby/1.8/soap/rpc/driver.rb:297:in
`CheckAuthentication'
from rubysprdb.rb:9


------------------------------------------------------------
--
-- Joern Waterstraat (e-mail address removed)
--

DISCLAIMER: This email (including any attachments) may contain confidential=
and/or privileged information. This email is for the intended addressee=
only. If you have received it in error, please notify the sender=
immediately and delete this email and any copies. Any use of this email is=
prohibited without the senders prior consent.
This email may not reflect the views of EADS SPACE Transportation=
(EADS-ST). Nothing in this email shall bind EADS-ST unless endorsed by a=
duly authorised representative and subject to a formal notification=
independent of this email either by fax or by post mail.
EADS-ST and the other companies of the EADS group refuse any and all=
liabilities if this email transmission was virus corrupted, altered or=
falsified.

HINWEIS: Diese E-Mail (einschliesslich ihrer eventuellen Anlagen) kann=
vertrauliche und/oder geschuetzte Informationen beinhalten. Diese E-Mail=
ist nur fuer den beabsichtigten Adressaten bestimmt. Falls Sie diese=
E-Mail irrtuemlich erhalten haben, informieren Sie bitte sofort den=
Absender und loeschen diese E-Mail und jegliche Kopie. Jegliche Nutzung=
oder Verwendung dieser E-Mail ist ohne vorheriges Einverstaendnis des=
Absenders untersagt.
Diese E-Mail entspricht nicht unbedingt der Meinung oder den Positionen von=
EADS SPACE Transportation (EADS-ST). Der Inhalt dieser E-Mail verpflichtet=
EADS-ST nur, wenn er durch eine hierzu autorisierte Person bestaetigt ist=
und ferner vorbehaltlich einer separaten formellen Notifizierung durch Fax=
oder per Post.
EADS-ST und die anderen Firmen der EADS Gruppe uebernehmen keinerlei=
Haftung, falls diese E-Mail mit Viren behaftet ist oder im Wege ihrer=
Uebertragung geaendert oder verfaelscht wurde.
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D
EADS SPACE Transportation GmbH (Amtsgericht Bremen, HRB-Nr. 21713) -=
Huenefeldstrasse 1-5 - 28199 Bremen - Deutschland/Germany
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D http://www.eads.net =3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 
N

NAKAMURA, Hiroshi

--------------enig5522BE0E267A991877741D74
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Sorry for late reply.

Try to convert following perl script to ruby but
get errors as listest in section "RESULT RUBY".

SOAP connection to external Server without SSL
is working. All scripts are running on same machine.
Error Messages:
###################################### RESULT RUBY ########
rubysprdb.rb
at depth 1 - 19: self signed certificate in certificate chain
/shared/ruby/1.8.2/lib/ruby/1.8/soap/streamHandler.rb:270:in
`send_post': 301: Moved Permanently (SOAP::HTTPStreamError)

Hmm. The https endpoint you are using tries to redirect a connection to
a different URL. Soap4r http client does not follow http redirection
for now. (from your example, SOAP::Lite seems to follow it silently)

Can you set a redirected URL as an endpoint URL of a client? For a
temporal fix, with the following patch, soap4r should follow a URL
redirection silently.

Regards,
// NaHi

Index: streamHandler.rb
===================================================================
- --- streamHandler.rb (revision 1552)
+++ streamHandler.rb (working copy)
@@ -161,7 +161,7 @@
send_string = conn_data.send_string
@wiredump_dev << "Wire dump:\n\n" if @wiredump_dev
begin
- - res = @client.post(endpoint_url, send_string, extra)
+ res = @client.post_content(endpoint_url, send_string, extra)
rescue
@client.reset(endpoint_url)
raise

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Cygwin)

iD8DBQFC2N0Af6b33ts2dPkRAlN8AKCJPGRjr1ZackG+RTD6pWqnE0YBFwCdEaj3
EnJKO66scIExSpFVciqVlzo=
=lIOj
-----END PGP SIGNATURE-----

--------------enig5522BE0E267A991877741D74
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Cygwin)

iD8DBQFC2N0Hf6b33ts2dPkRAsELAKDLz7VJ4CRKa8AdQAnCugR6FC+3yQCgqsJ7
D+noUKaHQbwGITdvZtuLOLw=
=NgdB
-----END PGP SIGNATURE-----

--------------enig5522BE0E267A991877741D74--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top