Hello,
I try to get a direct access to the XML Stream, like it's described in the
XFire User Guide for Message Binding<http://xfire.codehaus.org/Message+Binding>
.
But I didn't get it to work!
When I use the tag
<bindingProvider>org.codehaus.xfire.service.binding.MessageBindingProvider</bindingProvider>
in the services.xml, I get an error when trying to deploy (TomCat 6) :
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'org.codehaus.xfire.spring.ServiceBean'
defined in class path resource [META-INF/xfire/services.xml]: Error
setting property values; nested exception is
org.springframework.beans.NotWritablePropertyException: Invalid
property 'bindingProvider' of bean class
[org.codehaus.xfire.spring.ServiceBean]: Bean property
'bindingProvider' is not writable or has an invalid setter method:
Does the parameter type of the setter match the return type of the
getter?
When I leave this tag out, I can deploy, but then I get the error:
22.05.2007 09:35:46
org.codehaus.xfire.service.binding.MessageBindingProvider readParameter
WARNUNG: Unknown type for serialization: class java.util.ArrayList
Exception in thread "main" java.lang.NullPointerException
at org.reich.HelloClientStream.main(HelloClientStream.java:26)
Here my Class Files:
---------------------------------------------------------------------------------------------------------------------
Service:
package org.reich;
import java.util.ArrayList;
import javax.xml.stream.XMLStreamReader;
public class HelloWorldImpl implements IHelloWorld {
public ArrayList<Customer> getCustomers() {
ArrayList<Customer> arrayList = new ArrayList<Customer>();
Customer customer = new Customer("Markus", "Reich");
arrayList.add(customer);
return arrayList;
}
public XMLStreamReader invoke(XMLStreamReader reader) {
System.out.println("Test");
return reader;
}
}
---------------------------------------------------------------------------------------------------------------------
Client:
package org.reich;
import java.net.MalformedURLException;
import java.util.ArrayList;
import org.codehaus.xfire.XFireFactory;
import org.codehaus.xfire.client.XFireProxyFactory;
import org.codehaus.xfire.service.Service;
import org.codehaus.xfire.service.binding.MessageBindingProvider;
import org.codehaus.xfire.service.binding.ObjectServiceFactory;
public class HelloClientStream {
/**
* @param args
*/
public static void main(String[] args) {
ObjectServiceFactory osfactory = new ObjectServiceFactory(new
MessageBindingProvider());
osfactory.setStyle("message");
Service srvcModel = osfactory.create(IHelloWorld.class);
XFireProxyFactory factory = new XFireProxyFactory(
XFireFactory.newInstance().getXFire());
String helloWorldURL = "
http://localhost:8080/WebService/services/HelloWorld";
try {
IHelloWorld srvc = (IHelloWorld)factory.create(srvcModel,
helloWorldURL);
ArrayList<Customer> arrayListCustomer = srvc.getCustomers();
if (!arrayListCustomer.isEmpty()) {
Customer customer = arrayListCustomer.get(0);
System.out.println(customer.toString());
}
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
}
---------------------------------------------------------------------------------------------------------------------
services.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xfire.codehaus.org/config/1.0">
<service>
<name>HelloWorld</name>
<serviceClass>org.reich.IHelloWorld</serviceClass>
<implementationClass>
org.reich.HelloWorldImpl
</implementationClass>
<style>message</style>
<use>literal</use>
<scope>application</scope>
</service></beans>
regards
Meex
by the way I'm using myEclipse 5.5 M2