Forum Discussion

dkasak's avatar
15 years ago

Newbie question: WSDL issue, complex type

Greetings.

I'm a Perl developer, and have written some services using SOAP::Lite. I've tested them with a simple perl script, and it works perfectly. But perl & SOAP::Lite don't care about WSDLs. I now want some Java developers to write client code, and so I'm using the SoapUI plugin for Eclipse to build it. I've *almost* got it working, but with one ( hopefully ) small issue.

My code wants to be passed a hash of options, eg ( perl code ):

my $request = {
    a_thing      => 1,
    something    => "hi there",
    ingredient_id => 16
};


For the WSDL, I've set up the input as a complex type, and added 'ingredient_id' as an int, and 'something' as a string, eg:

      <xsd:complexType name="IngredientRequest">
        <xsd:sequence>
                <xsd:element name="ingredient_id" type="xsd:int"></xsd:element>
                <xsd:element name="something" type="xsd:string"></xsd:element>
        </xsd:sequence>
      </xsd:complexType>


When I use SoapUI to test the WSDL, my code is receiving a series of arguments, instead of a single argument, of complex type.

Here is the request generated by my perl client:

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
  <getIngredientInfo xmlns="/ingredient">
  <c-gensym3>
    <a_thing xsi:type="xsd:int">1</a_thing>
    <ingredient_id xsi:type="xsd:int">16</ingredient_id>
    <something xsi:type="xsd:string">hi there</something>
  </c-gensym3>
  </getIngredientInfo>
</soap:Body>
</soap:Envelope>


Here is the request being generated by SoapUI with my WSDL ( also generated by SoapUI ).

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ing="/ingredient">
<soapenv:Header/>
<soapenv:Body>
  <ing:getIngredientInfo>
  <ingredient_id>4</ingredient_id>
  <something>text</something>
  </ing:getIngredientInfo>
</soapenv:Body>
</soapenv:Envelope>


Now I admit that these requests look very similar already, but as noted, it's coming out at the other end quite differently - as an array of arguments instead of a hash.

What do I have to do in SoapUI to define my input in such as way that clients pass a single complex argument ( ie a hash in perl-speak )?

Thanks
No RepliesBe the first to reply