[Xml-compile] read timeout
Mike Baas
mbaas at candelacorp.com
Fri Jan 18 01:59:10 GMT 2019
Unsuccessful stat on filename containing newline at
/usr/local/share/perl/5.14.2/XML/Simple.pm line 967.
Unsuccessful stat on filename containing newline at
/usr/local/share/perl/5.14.2/XML/Simple.pm line 980.
File does not exist: read timeout at
/usr/local/share/perl/5.14.2/Net/HTTP/Methods.pm line 266.
at lib/Candela/SalesForce/API/Metadata.pm line 91.
Seems the content I'm getting back isn't able to be found. I get a
very long timeout when running my script. The debugger doesn't seem
to point to the problem. Is there way I might see the raw data xml
data coming back, if any?
Thanks,
mb
++++++
Script:
package Candela::SalesForce::API::Metadata;
use Moose;
use Types::Standard qw/ArrayRef HashRef/;
use Data::Dumper;
#$Data::Dumper::Deparse = 1;
use YAML qw/LoadFile DumpFile/;
use XML::Simple qw/XMLin/;
use XML::Compile::WSDL11;
use XML::Compile::SOAP11;
use XML::Compile::Transport::SOAPHTTP;
use XML::Validate;
use Log::Report mode => 'DEBUG'; # or 'VERBOSE'
use Path::Class;
use URI::Split qw/uri_split/;
has 'metadata_wsdl' => (
is => 'rw',
required => 1,
);
has 'sessionId' => (
is => 'rw',
required => 1,
);
has 'metadataServerUrl' => (
is => 'rw',
required => 1,
);
has 'object_name' => (
is => 'rw',
required => 1,
);
has 'call' => (
is => 'ro',
lazy_build => 1,
);
has 'object_data' => (
is => 'rw',
isa => 'HashRef',
default => sub { +{} },
);
sub BUILD {
my $self = shift;
$self->call;
}
# readMetadata call
# https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_readMetadata.htm
sub _build_call {
my $self = shift;
my $wsdl = $self->metadata_wsdl;
my $op_name = 'readMetadata';
my $call = $wsdl->compileClient(
operation => $op_name,
endpoint => $self->metadataServerUrl,
xml_format => 2,
);
$wsdl->compileCall($op_name);
# print $wsdl->explain($op_name, PERL => 'INPUT', recurse => 1);
return $call;
}
sub execute_query {
my $self = shift;
my ($metadata_type) = @_;
my @params = (
SessionHeader => { sessionId => $self->sessionId },
CallOptions => {
client => 'Candela-SalesForce-API',
},
parameters => {
type => $metadata_type,
fullNames => [ $self->object_name ],
},
);
my ($answer, $trace) = $self->call->(@params);
my $xml = $trace->response->decoded_content();
my $out = XMLin($xml);
my $result = $out->{'soapenv:Body'}{readMetadataResponse}{result};
return unless $result->{records}{fields};
my $fields = $result->{records}{fields};
foreach my $field (values $fields) {
$field->{type} = 'None' unless $field->{type};
push @{$self->object_data->{types}{$field->{type}}}, $field;
}
}
sub save_object_data {
my $self = shift;
DumpFile('yaml/metadata/' . $self->object_name . '.yaml', $self->object_data);
}
1;
More information about the Xml-compile
mailing list