Hi Monks,

I am trying to create Perl classes from a WSDL file of Servicenow Target table using perl wsdl2perl.pl -b /usr/share/XXXX/local/WebServiceClient/WebServiceName/ -p WebServiceName WsdlUrl, however after deploying the command, I am getting an error: "Connect failed: connect: Connection timed out; Connection timed out at /opt/xxxxxx/perl5/lib/perl5/SOAP/WSDL/XXXX/Base.pm line 73"

Based on the Base.pm script, I see that the source server where I am deploying this command is unable to get the 200 OK response Please let me know the probable causes for such an issue (or) if there are any alternatives in trying to create the Perl classes from WSDL XML directly, as I have downloaded the WSDL XML schema already and have checked that the WSDL file is accessible

package SOAP::WSDL::Expat::Base; use strict; use warnings; use URI; use XML::Parser::Expat; sub new { my ($class, $arg_ref) = @_; my $self = { data => undef, }; bless $self, $class; $self->set_user_agent($arg_ref->{ user_agent }) if $arg_ref->{ user_agent }; $self->{ parsed } = $arg_ref->{ parsed } if $arg_ref->{ parsed }; return $self; } sub clone { my $self = shift; my $class = ref $self; my $clone = $class->new($self); return $clone; } sub set_uri { $_[0]->{ uri } = $_[1]; } sub get_uri { return $_[0]->{ uri }; } sub set_user_agent { $_[0]->{ user_agent } = $_[1]; } sub get_user_agent { return $_[0]->{ user_agent }; } return $self->parse( $response->content() ); } sub set_uri { $_[0]->{ uri } = $_[1]; } sub get_uri { return $_[0]->{ uri }; } sub set_user_agent { $_[0]->{ user_agent } = $_[1]; } sub get_user_agent { return $_[0]->{ user_agent }; } # Mark a URI as "already parsed" sub set_parsed { my ($self, $uri) = @_; $self->{ parsed }->{ $uri } = 1; return; } # returns true if a specific URI has already been parsed sub is_parsed { my ($self, $uri) = @_; return exists $self->{ parsed }->{ $uri };# parse a URI. This is t +he preferred parsing method for WSDL files, as it's }#the only one allowing automatic import resolution sub parse_uri { my $self = shift; my $uri = shift; if ($self->is_parsed($uri)){ warn "$uri already imported; ignoring it.\n"; return; } $self->set_parsed($uri); $self->set_uri( $uri ); if (not $self->{ user_agent }) { require LWP::UserAgent; $self->{ user_agent } = LWP::UserAgent->new(); } my $response = $self->{ user_agent }->get($uri); die $response->message() if $response->code() ne '200'; return $self->parse( $response->content() ); } sub parse { eval { $_[0]->_initialize( XML::Parser::Expat->new( Namespaces => 1 ) + )->parse( $_[1] ); $_[0]->{ parser }->release(); }; $_[0]->{ parser }->xpcroak( $@ ) if $@;

In reply to Unable to create Perl classes from WSDL URL using wsdl2perl by reubenkoshy

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.