XFire 中 JAXBElement问题
最近在学习用XFire开发webService,遇到点问题请大帮我看看,谢谢
Client主要代码:
helloClient client = new helloClient();
helloPortType port = client.gethelloHttpPort();
User u = new User();
JAXBElement<String> name = new JAXBElement<String>(new QName("http://service.test.com","value"),String.class,"张三");
u.setName(name);
//u.getName().getValue();//这句话在这里不会报错,但到服务器上后就出错了,传过去的u不为空,但u.getName()返回空
System.out.println(port.example(u));
接口实现类主要代码:
public String example(User u) {
return u.getName().getValue();
//问题就在这里,传过来的u是不为空的,但u.getName()时返回就为空了,而u.getName().getValue将会报错
道底是哪出错了???
}
aegis.xml:
<?xml version="1.0" encoding="UTF-8"?>
<mappings>
<mapping>
<method name="example">
<parameter index="0" componentType="com.test.service.User" />
</method>
</mapping>
</mappings>
会的朋友请教教我,谢谢了!!!