0

I need to use an url to connect with OSTR to create a ticket via webservice, but I have a problem with certificates.

The error (picture here):

500 Can't connect to         (certificate verify failed)

What I've tried

  • $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;

  • my $UA = LWP::UserAgent->new( ssl_opts => { verify_hostname => 0, } );

  • I've also tried to add a new certificate in C:\otrs\Kernel\cpan-lib\Mozilla\CA\cacert.pem.


CODE

Code (Picture here)

Palak
  • 1
  • 3

1 Answers1

0

Well, please try this code and add/remove the line which sets the env variable, for me this just works.

use strict;
use warnings;

use SOAP::Lite;

$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
my $URL = 'https://self-signed.badssl.com/foo';
my $NameSpace = 'https://self-signed.badssl.com/';
my $Operation = 'TicketCreate';

my $XMLData = <<'XML';
<UserLogin>login</UserLogin>
<Password>pass</Password>
<Ticket>
  <Title>Title</Title>
</Ticket>
XML

my $SOAPObject = SOAP::Lite->uri($NameSpace)->proxy($URL)->$Operation($XMLData);

Without the $ENV{} line it gives 500 Can't connect ... (certificate verify failed) and with it it gives 405 Not Allowed (since the test URL does not actually run the SOAP web service).

Also, please place actual code snippets on SO, in text and not in a screenshot, and please try and keep them short.

Oh, and by the way, I wrote a small script to create tickets in OTRS using the web service, it's here, maybe it's useful for you -> https://github.com/mbeijen/App-OTRS-CreateTicket

MichielB
  • 4,181
  • 1
  • 30
  • 39