Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

SOAP::WSDL can't pass abstract complextypes (w/ 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 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:
  • Comment on SOAP::WSDL can't pass abstract complextypes (w/ bindings)
  • Download Code

Replies are listed 'Best First'.
Re: SOAP::WSDL can't pass abstract complextypes (w/ bindings)
by Khen1950fx (Canon) on Mar 29, 2010 at 21:44 UTC
    I think that you need to set the type like:

     xmlns:xsi="" xsi:type="TargetCopyRequest">

    A more complete example:

    <soapenv:Envelope xmlns:soapenv=" +ope/"> <soapenv:Body> <copy xmlns="" xmlns:xsi="" 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/ 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?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://831633]
Approved by Old_Gray_Bear
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2018-01-22 07:18 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (232 votes). Check out past polls.