Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Validating SOAP with a WSDL

by idsfa (Vicar)
on Apr 06, 2006 at 18:32 UTC ( [id://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/WSDL.pm line 504.

    That line in WSDL.pm 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="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http: +//schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http:// +schemas.xmlsoap.org/wsdl/mime/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl=" +http://schemas.xmlsoap.org/wsdl/" <wsdl:types> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://some_ip/package/various.other.soap.types /"> <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> <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 soapclient.com 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?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://541694]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-25 17:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found