Note that there are some explanatory texts on larger screens.

plurals
  1. POTrouble returning an array through Java Web Service
    primarykey
    data
    text
    <p>I am trying to return an object which has few Strings as well an another array of Strings (there's a reason for this, I promise). The trouble I'm having is that when I test my method with SoapUI, I only get the Strings; the array of Strings seems to be missing entirely. Any clue what I'm doing wrong? My class looks something like this...</p> <pre class="lang-java prettyprint-override"><code>public class EmailListing { public String type; public String category; public String[] emails; public EmailListing() { emails = new String[1]; } public void setEmailList(String emaillist) { this.emails = emaillist.split("\\|"); } } </code></pre> <p>In the web service function that uses this class, I do the following:</p> <pre class="lang-java prettyprint-override"><code>public EmailListing getEmailListing(int id) { EmailListing el = new EmailListing(); try { // get data from the database // ... // while(rs.next()) { el.type = rs.getString("type"); el.category = rs.getString("category"); el.setEmailList(rs.getString("emaillist")); } } catch(...) { ... } return el; } </code></pre> <p>The only information I see when I test this service, though, is the type and category. :(</p> <p>Edit: Method for printing and results of server-side output.</p> <pre class="lang-java prettyprint-override"><code>public void print() { StringBuffer sb = new StringBuffer(); sb.append("Emails\n"); for(int i = 0; i &lt; emails.length; i++) { sb.append(" " + emails[i] + "\n"); } System.out.println(sb.toString()); } </code></pre> <p>Output looks like :</p> <pre><code>Emails XXXXX@gmail.com XXXXXXX@gmail.com </code></pre> <p>Edit: Adding recieved soap message</p> <pre class="lang-xml prettyprint-override"><code>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt; &lt;soapenv:Body&gt; &lt;getEmailListingResponse xmlns="http://services.test.com"&gt; &lt;getEmailListingReturn&gt; &lt;type&gt;data&lt;/type&gt; &lt;category&gt;data&lt;/category&gt; &lt;/getEmailListingReturn&gt; &lt;/getEmailListingResponse&gt; &lt;/soapenv:Body&gt; &lt;/soapenv:Envelope&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload