【发布时间】:2015-07-25 08:59:45
【问题描述】:
我遇到此问题 2 天,但无法解决此问题。我正在尝试使用 JAX-WS 调用 Web 服务。服务调用,但其中的对象未解析。
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setServiceClass(ICustomer.class);
factory.setAddress("http://localhost:8080/backend/services/CustomerInfo");
ICustomer client = (ICustomer) factory.create();
// Below is the service call. where 'object' is my CustomerInfo object/data
client.saveCustomer(object);
服务实现类:
@WebService(endpointInterface = "com.dev.backend.services.interfaces.ICustomer", serviceName="CustomerInfo")
public class ICustomerImpl implements ICustomer {
public boolean saveCustomer(Object object) {
JAXBContext payloadContext;
try {
payloadContext = JAXBContext.newInstance(CustomerInfo.class);
CustomerInfo o = (CustomerInfo)payloadContext.createUnmarshaller().unmarshal((Node)object); // Line 'error'
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
(CustomerInfo)payloadContext.createUnmarshaller().unmarshal((Node)object) 是异常抛出“javax.xml.bind.UnmarshalException:意外元素(uri:”,local:“arg0”)的行。预期元素是 "
任何人都可以帮助我。我正在寻找解决方案 2 天。
谢谢
【问题讨论】:
标签: java xml web-services jaxb cxf