Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
go ahead... be a heretic
 
PerlMonks  

SOAP::WSDL can't pass abstract complextypes (w/ wsdl2perl.pl bindings)

by netpenthe (Initiate)
on Mar 29, 2010 at 14:23 UTC ( #831633=perlquestion: print w/ replies, xml ) Need Help??
netpenthe has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks

I realise that SOAP::WSDL can create WSDL types and ComplexTypes from ordinary Perl hashes/array and I have this working.

The problem is with abstract types, I used wsdl2perl.pl to generate the bindings for a WSDL but when I try to call a Web Service which has abstract types as parameters I get back:

'faultstring' => 'Server was unable to read request. ---> There is an error in XML document (1, 492). ---> The specified type is abstract: name=

From what I understand I need to specifically set the concrete type of the data in the XML request using an "xsi:type" attribute ( i can see in the message it is sending that the "xsi:type" is NOT set).

I have no idea how to do this as I am just using hashes and arrays to pass the parameters (i.e. no where to specify a type!)

I'd be very grateful if anyone could point me in the right direction, i've been looking at this for about 10 hours now :(

Thanks - xsi:type required for abstract types said here: http://osdir.com/ml/axis-dev-ws.apache.org/2009-04/msg00087.html

Comment on SOAP::WSDL can't pass abstract complextypes (w/ wsdl2perl.pl bindings)
Download Code
Re: SOAP::WSDL can't pass abstract complextypes (w/ wsdl2perl.pl bindings)
by Khen1950fx (Canon) on Mar 29, 2010 at 21:44 UTC
    I think that you need to set the type like:

     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="TargetCopyRequest">

    A more complete example:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envel +ope/"> <soapenv:Body> <copy xmlns="http://www.strongmail.com/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Ta +rgetCopyRequest"> <fromId><id>123</id></fromId> <newName>New Name</newName> </copy> </soap:Body> </soap:Envelope>

      Thanks for the reply, yes i think you're right, i need to set the type.

      The problem is i'm using SOAP::WSDL so i'm not actually writing the XML myself, i'm just creating a Perl hash/array and SOAP::WSDL converts it into the XML.

      The question I have is: is it possible to tell SOAP::WSDL what "xsi:type" and "xmlns" should be added to a particular ComplexType? (in default it does not set anything).

Re: SOAP::WSDL can't pass abstract complextypes (w/ wsdl2perl.pl bindings)
by gghildyal (Initiate) on Mar 22, 2011 at 11:29 UTC

    I'm facing the same ( or a similar ) problem.. I am trying to generate a SOAP message like:

    <RetrieveServiceContent xmlns="urn:vim25"> <_this> type = "ServiceInstance" ServiceInstance </_this> </RetrieveServiceContent>

    but no matter how hard I try, I cannot get SOAP::WSDL to generate this, all it generates is

    <RetrieveServiceContent xmlns="urn:vim25"> <_this> ServiceInstance </_this> </RetrieveServiceContent>
    .

    The ServiceInstance is of type which has an attribute of type, but even if I set that attribute to the right value, it doesn't show up in the SOAP message..

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://831633]
Approved by Old_Gray_Bear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (12)
As of 2014-04-18 22:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (472 votes), past polls