[Xml-compile] Request advice on a networking (??) issue

David McMath mcdave at stanford.edu
Sat Sep 22 03:12:00 GMT 2012


On 09/21/2012 04:20 PM, Mark Overmeer wrote:
>
> This is not how XML::Compile::SOAP is intented to be used: you do the
> expensive compilation step each time again.  This should be:
>
>    my $wsdl = XML::Compile::WSDL11->new( 'centra2.wsdl' ) ;
>    my $method = $wsdl->compileClient('getVersion', port => 'CWSSoap');
>    for my $i (1 .. 300 ) {
>        my $ans = $method->() ;
>
> The other side is, that it seems that the caching in ::SOAPHTTP
> should be smart enough not to recreate LWP::UserAgents all the time.
> Hum.
>
> Can you test this:  XML/Compile/Transport/SOAPHTTP.pm
>
>    + my $default_ua;
>      sub userAgent(;$)
>      {   my ($self, $agent) = (shift, shift);
>          return $self->{user_agent} = $agent
>              if defined $agent;
>
>    -     $self->{user_agent} ||= LWP::UserAgent->new
>    +     $self->{user_agent} ||= $default_ua ||= LWP::UserAgent->new
>            ( requests_redirectable => [ qw/GET HEAD POST M-POST/ ]
>            , parse_head => 0
>            , protocols_allowed => [ qw/http https/ ]
>            , @_
>            );
>      }
>
> But the reorder is the real fix.
>

To close the loop for the list:

Each solution worked as advertised.  I'll go with "fix my code" and just 
use "compileClient" correctly.

Thanks,

dave



More information about the Xml-compile mailing list