Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Test::Mock::Object with SOAP::Lite - having no luck

Status
Not open for further replies.

Xaqte

IS-IT--Management
Oct 4, 2002
971
0
0
US
I'm trying to use Test::Mock::Object with SOAP::Lite, and I'm getting nowhere quick.

I first tried Test::Mock::LWP:
Code:
use Test::Mock::LWP;

BEGIN {
  $Mock_response->mock( content => sub { return  SOAP::SOM->new('<foo>bar</foo>'); } );
  $Mock_ua->set_isa('LWP::UserAgent');
  $Mock_ua->set_true('agent','options','endpoint');
  $Mock_ua->mock( http_request => sub { return HTTP::Response->new(200, '200 OK'); } );
};

The above with a SOAP::Lite call() produce the following error:
Code:
A service address has not been specified either by using SOAP::Lite->proxy() or a service description

This error comes from line 3642 of Lite.pm:
Code:
    die "A service address has not been specified either by using SOAP::Lite->proxy() or a service description)\n"
        unless defined $self->proxy && UNIVERSAL::isa($self->proxy => 'SOAP::Client');

Going a little deeper, I found this in the output from Dumper of the soap object when called:
Code:
                 '_transport' => bless( {
                                          '_proxy' => bless( {}, 'Test::MockObject' )
                                        }, 'SOAP::Transport' ),

This is giving me an indication of why the error is occurring... but I don't know how to begin to fix that w/o
trying to mock SOAP::Lite itself.

Trying to mock SOAP::Lite with Test::Mock::Object has proven unsuccessful so far...

I could continue with all my failed attempts at this... but its just been a stab in the dark as far as creating a decent test environment for SOAP.

Any thoughts/suggestions would greatly be appreciated!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top