geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevan Miller <kevan.mil...@gmail.com>
Subject Re: Returning String[] from WebService method
Date Wed, 02 Apr 2008 22:02:30 GMT
Strange. Can you share your jsp with us? Are you running with Tomcat/ 
Axis2 or Jetty/CXF?

--kevan

On Mar 29, 2008, at 12:32 PM, <frowe@nc.rr.com> <frowe@nc.rr.com> wrote:

> BTW, the original post wasn't so much about the sample, as it was  
> about the proper way to return a String[] from a webservice.  I was  
> simply using the calculator sample as an easy example of what wasn't  
> working.
>
> Fred
> ---- frowe@nc.rr.com wrote:
>> No difference, except it pointed out a bug in the geronimo-web.xml  
>> of the sample:
>>      <uri>/jaxws-calculator/calculator</uri>
>> should be
>>      <uri>/jaxws-calculator-1.0/calculator</uri>
>> But once corrected, the result is the same:
>> The string array returned has 7 element(s):
>> Value
>> 1
>> 34532
>> Value
>> 2
>> 54534
>>
>> Other suggestions?  I've tried a lot of different things so far,  
>> none have fixed the problem.
>>
>> Fred
>>
>>
>> ---- Jarek Gawor <jgawor@gmail.com> wrote:
>>> Just from a quick glance it looks like the result.jsp is not quite
>>> right. It should look like the one shown here:
>>> http://cwiki.apache.org/GMOxDOC21/simple-web-service-with-jax- 
>>> ws.html
>>> (titled add.jsp where jndi lookup is done). See if changing that
>>> helps.
>>>
>>> Jarek
>>>
>>> On Fri, Mar 28, 2008 at 6:00 PM,  <frowe@nc.rr.com> wrote:
>>>> I'm having a problem returning a String array from a method of a  
>>>> webservice.  In order to provide a simple way to recreate the  
>>>> problem, I modified the 2.1 webservices sample ( http://cwiki.apache.org/GMOxDOC21/developing-a-simple-calculator-web-service.html

>>>>  ) such that the add() method returns a String[] instead of an  
>>>> int.  The mods were simple, I changed the "return" element of the  
>>>> addResponse in the wsdl of the sample
>>>> from:
>>>>        <xsd:element name="return" type="xsd:int"/>
>>>> to:
>>>>        <xsd:element name="return" type="xsd:string" minOccurs="0"  
>>>> maxOccurs="unbounded"/>
>>>> and the CalculatorService.java (and the corresponding interface  
>>>> it implements) from:
>>>>    public int add(int value1, int value2) {
>>>> ...
>>>>      return value1 + value2;
>>>> to:
>>>>    public String[] add(int value1, int value2) {
>>>> ...
>>>>      return new String[]{"Value 1", String.valueOf(value1),  
>>>> "Value 2", String.valueOf(value2), String.valueOf(value1 +  
>>>> value2)};
>>>>
>>>> and then changed the result.jsp to expect a String[] and iterate  
>>>> over the contents printing out each element,  If I add 3 + 4, I  
>>>> expected the result.jsp to display:
>>>>
>>>> Value 1
>>>> 3
>>>> Value 2
>>>> 4
>>>> 7
>>>>
>>>> but I get instead:
>>>> Value
>>>> 1
>>>> 3
>>>> Value
>>>> 2
>>>> 4
>>>> 7
>>>>
>>>> It seems that in the process of converting the response into a  
>>>> Java String[], the whitespace of the individual strings is acting  
>>>> as a delimiter.  Thus instead of getting an array of 5 strings, I  
>>>> get an array of 7 strings instead.  What have I misconfigured?
>>>>
>>>> Fred
>>>>
>


Mime
View raw message