History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: XFIRE-73
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Dan Diephouse
Reporter: Dan Diephouse
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
XFire

ArrayType doesn't work with int[]

Created: 06/May/05 06:51 AM   Updated: 17/Jun/05 01:30 PM
Component/s: Aegis Module
Affects Version/s: None
Fix Version/s: 1.0-M5

Time Tracking:
Not Specified

File Attachments: 1. Java Source File AbstractBinding.java (8 kb)



 Description  « Hide
The ArrayType doesn't work with int[], long[], boolean[] etc

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Ralf Schaeftlein - 09/Jun/05 01:48 PM
additional a string[] as parameter type doesn't work either:

6374503 [http-8080-Processor24] DEBUG org.codehaus.xfire.exchange.RobustInOutExchange - Fault occurred.
org.codehaus.xfire.fault.XFireFault: Illegal argument.
java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.xfire.service.binding.ObjectInvoker.invoke(ObjectInvoker.java:65)
at org.codehaus.xfire.service.binding.AbstractBinding.invoke(AbstractBinding.java:58)
at org.codehaus.xfire.exchange.RobustInOutExchange.doExchange(RobustInOutExchange.java:89)
at org.codehaus.xfire.transport.SoapServiceEndpoint.onReceive(SoapServiceEndpoint.java:70)
at org.codehaus.xfire.transport.AbstractChannel.receive(AbstractChannel.java:39)
at org.codehaus.xfire.transport.http.XFireServletController.invoke(XFireServletController.java:232)
at org.codehaus.xfire.transport.http.XFireServletController.doService(XFireServletController.java:119)
at org.codehaus.xfire.transport.http.XFireServlet.doGet(XFireServlet.java:63)
at org.codehaus.xfire.transport.http.XFireServlet.doPost(XFireServlet.java:73)

with service method :public String concat(String[] array)


Dan Diephouse - 09/Jun/05 01:55 PM
Ralf,
I have unit tests which test submission of a string[] array. But I'll check into it.

And just an FYI - I worked on this for about an 45 mins last night with no solution :-\. I'll take another stab this weekend.


Ralf Schaeftlein - 09/Jun/05 02:02 PM
here is the submitted request

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:ProductService">
<soap:Header />
<soap:Body>
<tns:concat>
<tns:in0>
<tns:string>a</tns:string>
<tns:string>b</tns:string>
<tns:string>c</tns:string>
</tns:in0>
</tns:concat>
</soap:Body>
</soap:Envelope>


Ralf Schaeftlein - 09/Jun/05 03:44 PM
attached a solution for the issue

Dan Diephouse - 09/Jun/05 10:45 PM
Ralf, I put the makeArray method in ArrayType because I think thats where it belongs. I also took out the check for String.class because a String is an Object, unlike the primitives (int, float, etc) - so the Array.newInstance() should work just fine with it.

I'm still confused at what is going on in the casting method, so I haven't included it. Also, I just created a concat service and it worked just fine. Can you maybe checkout and try again?

My TestCase:
package org.codehaus.xfire.message.wrapped;

import org.codehaus.xfire.aegis.AbstractXFireAegisTest;
import org.codehaus.xfire.client.Client;
import org.codehaus.xfire.service.OperationInfo;
import org.codehaus.xfire.service.Service;
import org.codehaus.xfire.service.ServiceFactory;
import org.codehaus.xfire.service.binding.ObjectInvoker;
import org.codehaus.xfire.test.Echo;
import org.codehaus.xfire.test.EchoImpl;
import org.codehaus.xfire.transport.Channel;
import org.codehaus.xfire.transport.local.LocalTransport;

/**

  • XFireTest
    *
  • @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
    */
    public class StringClientTest
    extends AbstractXFireAegisTest
    {
    private Service service;
    private Service clientService;

public void setUp()
throws Exception

{ super.setUp(); ServiceFactory factory = getServiceFactory(); service = factory.create(ConcatService.class); clientService = factory.create(ConcatService.class); getServiceRegistry().register(service); }

public void testInvoke()
throws Exception
{
LocalTransport transport = new LocalTransport();
Channel channel = transport.createChannel(service);

Client client = new Client(transport, clientService, channel.getUri());

OperationInfo op = clientService.getServiceInfo().getOperation("concat");
Object[] response = client.invoke(op, new Object[] {new String[] {"bleh", "bleh2"}});
assertNotNull(response);
assertEquals(1, response.length);

String resString = (String) response[0];
assertEquals("blehbleh2", resString);
}
}

public class ConcatService
{
public String concat(String[] input)

{ StringBuffer sb = new StringBuffer(); for (int i = 0; i < input.length; i++) sb.append(input[i]); return sb.toString(); }

}


Ralf Schaeftlein - 10/Jun/05 02:55 PM
Dan, i grabbed your changes and my test cases works like with my solution.

Dan Diephouse - 17/Jun/05 01:30 PM
Writing int[] etc should now work too