Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: Validating SOAP with a WSDL

by idsfa (Vicar)
on Apr 06, 2006 at 18:32 UTC ( #541694=note: print w/replies, xml ) Need Help??

in reply to Validating SOAP with a WSDL

On Topic

SOAP::WSDL appears to have been designed for this problem. Soap::Lite's POD says that it doesn't fully support WSDL. Something like ...

. . . my $soap=SOAP::WSDL->new(); $soap->wsdl($self->{'data'}->{'namespace'}); $soap->proxy($self->{'data'}->{'proxy'} ); $soap->wsdlinit; # This part is the big rebuild, as you no longer have # to hand-roll your XML ... good thing, too my $som=$soap->call( $method , name => 'value' , name => 'value' );

The intelligent reader will judge for himself. Without examining the facts fully and fairly, there is no way of knowing whether vox populi is really vox dei, or merely vox asinorum. — Cyrus H. Gordon

Replies are listed 'Best First'.
Re^2: Validating SOAP with a WSDL
by ptum (Priest) on Apr 07, 2006 at 14:02 UTC

    Thank you for this recommendation. SOAP::WSDL does, in fact, seem to have been designed for this problem.

    I was able to get the simple methods to work using the WSDL, which saves some grief in terms of rolling my own XML. Unfortunately, again, I got hung up on the complex types, and the error messages produced aren't very elaborate. It seems that when I call a method that involves complex types, the WSDL is not able to resolve the definitions. I suspect this is because of a corporate firewall, but I'm not sure.

    Here's the code I have so far (somewhat sanitized):

    #!/usr/local/bin/perl use strict; use warnings; use SOAP::WSDL +trace => 'all'; use Data::Dumper; Main: { my $soap=SOAP::WSDL->new( wsdl => 'http://some_ip/wsdl/myServiceName +.wsdl' ); $soap->proxy('http://some_ip:port/some/path/myServiceLocation'); $soap->servicename('myServiceName'); $soap->wsdlinit( caching => 1); my $response; eval { # this one worked with no troubles $response = $soap->call( 'queryItem' , id => 'blah' , pwd => 'bleh', itemId => '9015'); }; if ($@) { print "SOAP call failed: $@\n"; exit; } eval { # this one fails with the "error processing WSDL" message $response = SOAP_add_Item($soap); }; if ($@) { print "SOAP call failed: $@\n"; exit; } if ($response->fault) { print Dumper($response->faultdetail), "\n"; } else { my $body = $response->result; unless ($body == 0) { print "SOAP Message: ", Dumper($body); } } } sub SOAP_add_Item { my $soap = shift; my $response = $soap->call('addItem', 'id' => 'blah', 'pwd' => 'bleh', 'itemId' => '1234', 'itemName' => 'Test Item', 'Ranges' => [ { 'min' => '8605118310', 'max' => '8605118319' } ] ); return $response; } # 'Ranges' => [ # bless( { # 'min' => '8605118310', # 'max' => '8605118319' # }, 'SoapTypeRange' ) ] );

    I've tried the complex 'Ranges' type with and without the reference to the type 'SoapTypeRange', but in neither case does it seem to be able to resolve the type.

    Instead, I get this message:

    SOAP call failed: Error processing WSDL: './/xsd:element' not found at + /usr/local/lib/perl5/site_perl/5.8.6/SOAP/ line 504.

    That line in seems to be in the context of attempting to resolve definitions for complex types. The relevant lines in the WSDL seem to be:

    <wsdl:definitions name="myServiceName" targetNamespace="http://some_ip/wsdl/myServiceName/" xmlns:tns="http://some_ip/wsdl/myServiceName/" xmlns:soap="" xmlns:soap12="http: +//" xmlns:http="" xmlns:mime="http://" xmlns:xsd="" xmlns:soapenc="" xmlns:wsdl=" +" <wsdl:types> <xsd:schema xmlns:xsd="" targetNamespace="http://some_ip/package/various.other.soap.types /"> <xsd:import namespace="" /> <xsd:complexType name="SoapTypeRange"> <xsd:all> <xsd:element name="min" type="xsd:long" /> <xsd:element name="max" type="xsd:long" /> </xsd:all> </xsd:complexType> <xsd:complexType name="ArrayOfSoapTypeRange"> <xsd:complexContent> <xsd:restriction base="soapenc:Array"> <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="n11:SoapTypeRan +ge[]" /> </xsd:restriction> </xsd:complexContent> </xsd:complexType> </xsd:schema> </wsdl:types>

    I'm stumped. If I can't get outside the firewall to resolve the complex type definitions, then how can I build a workable SOAP call to this service? Any additional thoughts are very welcome.

    No good deed goes unpunished. -- (attributed to) Oscar Wilde

      One of the tools available on the site may be able to help in debugging. I've only used the Generic SOAP Client in the past, but it proved very handy indeed for pointing out that my initial code was a steaming pile of... ;-)

      Hope that helps.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://541694]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2017-03-26 19:35 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (315 votes). Check out past polls.