Hi Dan,
This problem is reproducible with service which takes list as as an
argument. The following is the testcase,
package com.xxxxx.webservice.cxf.service;
public interface IDataTypeTester {
int helloUsers(List<String> users);
}
package com.xxxxx.webservice.cxf.service;
public class DataTypeTesterImpl implements IDataTypeTester {
public int helloUsers(List<String> users) {
return users.size();
}
}
package com.xxxxx.webservice.cxf.server;
public class CXFServer {
public static Server getServer(String host, int port) {
DataTypeTesterImpl helloworldImpl = new DataTypeTesterImpl();
ServerFactoryBean svrFactory = new ServerFactoryBean();
svrFactory.setServiceClass(IDataTypeTester.class);
svrFactory.setAddress("http://localhost:9000/DataTypeTester");
svrFactory.setServiceBean(helloworldImpl);
svrFactory.setStart(false);
//add logging interceptor
svrFactory.getInInterceptors().add(new LoggingInInterceptor());
svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());
Server server = svrFactory.create();
return server;
}
public static void startServer(Server server) {
server.start();
System.out.println("Server Started...");
}
public static void stopServer(Server server) {
server.stop();
System.out.println("Server Stopped...");
}
public static void main(String args[]) throws Exception {
Server server = CXFServer.getServer();
CXFServer.startServer(server);
Thread.sleep(5 * 60 * 1000);
CXFServer.stopServer(server);
}
}
package com.xxxxx.webservice.cxf.client;
public class CXFClient {
public static void cxf242ProblemTest(String host, int port) throws
Exception {
JaxWsDynamicClientFactory dcf =
JaxWsDynamicClientFactory.newInstance();
ClientImpl client =
(ClientImpl)dcf.createClient("http://locahost:9000/DataTypeTester?wsdl");
client.getOutInterceptors().add(new LoggingOutInterceptor());
client.getInInterceptors().add(new LoggingInInterceptor());
QName opName = new
QName("http://service.cxf.webservice.xxxxx.com/",
"helloUsers");
BindingOperationInfo boi =
client.getEndpoint().getEndpointInfo().getBinding().getOperation(opName);
BindingMessageInfo inputMessageInfo = boi.getInput();
List<MessagePartInfo> parts = inputMessageInfo.getMessageParts();
System.out.println(parts);
MessagePartInfo partInfo = parts.get(0);
Class<?> partClass = partInfo.getTypeClass();
Object inputObject = partClass.newInstance();
* // this inputObject contains attribute as 'arg0S' instead of
'arg0'*
//To get properties
Field[] fields = partClass.getDeclaredFields();
System.out.println(fields[0].getName());
List<String> names = new ArrayList<String>();
names.add("user1");
names.add("user2");
PropertyDescriptor namePropertyDescriptor = new
PropertyDescriptor("arg0", partClass);
namePropertyDescriptor.getWriteMethod().invoke(inputObject,names);
System.out.println("Invoking alert...");
Object[] response = client.invoke(boi,inputObject);
System.out.println(response[0]);
}
}
In the above client, at runtime the request object contains 'arg0S' instead
of 'arg0'.
Please let me know, if not clear.
Thanks
Srinivas
--
View this message in context:
http://cxf.547215.n5.nabble.com/CXF-Client-issue-with-upgrade-from-CXF-2-2-7-to-2-4-2-tp4845738p4955555.html
Sent from the cxf-user mailing list archive at Nabble.com.