Note that there are some explanatory texts on larger screens.

plurals
  1. POWeb services in java me midlet
    primarykey
    data
    text
    <p>I am trying to make midlet with web services (Country Details). I am not sure about how to display results, everything else seems to work fine.</p> <p>Here is the code for getting input information and results (which i can't get):</p> <pre><code>task = new SimpleCancellableTask(); task.setExecutable(new org.netbeans.microedition.util.Executable() { public void execute() throws Exception { String country = FieldCountry.getString(); result = CWS.getCurrencyByCountry(country); System.out.println(result); getResultBox().setString(String.valueOf(result)); } }); </code></pre> <p>In the run window I see it gets this information:</p> <pre><code>&lt;NewDataSet&gt; &lt;Table&gt; &lt;Name&gt;Norway&lt;/Name&gt; &lt;CountryCode&gt;no&lt;/CountryCode&gt; &lt;Currency&gt;Kroner&lt;/Currency&gt; &lt;CurrencyCode&gt;NOK&lt;/CurrencyCode&gt; &lt;/Table&gt; &lt;Table&gt; &lt;Name&gt;Norway&lt;/Name&gt; &lt;CountryCode&gt;no&lt;/CountryCode&gt; &lt;Currency&gt;Kroner&lt;/Currency&gt; &lt;CurrencyCode&gt;NOK&lt;/CurrencyCode&gt; &lt;/Table&gt; &lt;/NewDataSet&gt; </code></pre> <p>EDIT</p> <p>I have used this code and it works fine now:</p> <pre><code>task = new SimpleCancellableTask(); task.setExecutable(new org.netbeans.microedition.util.Executable() { public void execute() throws Exception { country CWS = new country_Stub(); String country = FieldCountry.getString(); String result = CWS.getCurrencyByCountry(country); if (list != null) {list = null; } String name = result.substring(result.indexOf("&lt;Name&gt;")+6, result.indexOf("&lt;/Name&gt;")); String countryc = result.substring(result.indexOf("&lt;CountryCode&gt;")+13, result.indexOf("&lt;/CountryCode&gt;")); String currency = result.substring(result.indexOf("&lt;Currency&gt;")+10, result.indexOf("&lt;/Currency&gt;")); String currencyc = result.substring(result.indexOf("&lt;CurrencyCode&gt;")+14, result.indexOf("&lt;/CurrencyCode&gt;")); getList().append("Country name: ", null); getList().append(name, null); getList().append("Country code: ", null); getList().append(countryc, null); getList().append("Country currency: ", null); getList().append(currency, null); getList().append("Country currency code: ", null); getList().append(currencyc, null); } }); </code></pre>
    singulars
    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.
    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