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

Patrick Powell papowell at astart.com
Tue Sep 25 15:23:14 GMT 2012


On 09/21/12 20:12, David McMath wrote:
> 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
>
> _______________________________________________
> Xml-compile mailing list
> Xml-compile at lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/xml-compile
>

You might want to throw in a 'timeout => 10' into that list of options.

WARNING:  I have read reports that some versions of LWP timeout support 
may not do timeouts for DNS lookups.

-- 
Patrick Powell                 Astart Technologies
papowell at astart.com            1530 Jamacha Road, Suite X,
Network and System             El Cajon, CA 92019
   Consulting                   858-874-6543
Web Site: www.astart.com




More information about the Xml-compile mailing list