I got a web service with a function that takes in an array of int's and returns a complex array. Here's the snippet of perl code:
=begin WSDL _IN smis @int session message id's to get data for _RETURN @SmiData smi data for each existing modality =end WSDL =cut sub getSmisData { my $class = shift; my (@smis) = @_; my $smiData = []; my $dbh = open_db(); if ($dbh) { # do something } else { # do something else } return ($smiData); }
Pod::WSDL generates a wsdl containing (partially):
<complexType name="ArrayOfInt"> <complexContent> <restriction base="soapenc:Array"> <attribute ref="soapenc:arrayType" wsdl:arrayT +ype="soapenc:int[]" /> </restriction> </complexContent> </complexType> <complexType name="ArrayOfSmiData"> <complexContent> <restriction base="soapenc:Array"> <attribute ref="soapenc:arrayType" wsdl:arrayT +ype="tns1:SmiData[]" /> </restriction> </complexContent> </complexType> <wsdl:message name="getSmisDataRequest"> <wsdl:part name="smis" type="tns1:ArrayOfInt"> <wsdl:documentation>session message id's to get data for</ +wsdl:documentation> </wsdl:part> </wsdl:message> <wsdl:message name="getSmisDataResponse"> <wsdl:part name="getSmisDataReturn" type="tns1:ArrayOfSmiData" +> <wsdl:documentation>smi data for each existing modality</w +sdl:documentation> </wsdl:part> </wsdl:message>
I am using soapUI to test the wsdl. It automatically generates a request (partial):
<soapenv:Body> <heal:getSmisData soapenv:encodingStyle="http://schemas.xmlsoap. +org/soap/encoding/"> <smis xsi:type="heal:ArrayOfInt" soapenc:arrayType="soapenc:i +nt[2]" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"> <xsd:int>111</xsd:int> <xsd:int>222</xsd:int> </smis> </heal:getSmisData> </soapenv:Body>
The response to this is as if the function did not find any data and looks like (partial):
<soap:Body> <getSmisDataResponse xmlns="http://monitor.site.local/HealthWS"> <soapenc:Array soapenc:arrayType="xsd:anyType[0]" xsi:type="s +oapenc:Array"/> </getSmisDataResponse>
However, if i change the request to (partial):
<soapenv:Body> <heal:getSmisData soapenv:encodingStyle="http://schemas.xmlsoap. +org/soap/encoding/"> <xsd:int>111</xsd:int> <xsd:int>222</xsd:int> </heal:getSmisData> </soapenv:Body>
(ie remove the array notion) i do get correct data for provided id's.

What is wrong with this? Is it the request or the wsdl issue? Any suggestions?

Thank you all in advance!

In reply to Pod::WSDL array question by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.