返回值是Customer对象时正常,返回List一直报错,不知道是deploy.wsdd写错了还是其他原因,请帮忙看一下
axis版本为1.4
服务端程序和Javabean
[code="java"]
public class Customer implements java.io.Serializable{
private String customerId;
private String name;
public String getCustomerId() {
return customerId;
}
public void setCustomerId(String customerId) {
this.customerId = customerId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
[/code]
[code="java"]
import java.util.List;
public class CustomerInfo {
public List getCustomerList() {
List list= null;
Customer customer = new Customer();
customer.setName("哈哈哈");
list.add(customer);
return list;
}
}
[/code]
deploy.wsdd文件代码
[code="java"]
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
type="java:org.apache.ws.axis.security.WSDoAllReceiver">
value="com.hundsun.insure.framework.webservice.handler.WsAuthHandler" />
value="com.hundsun.insure.webservice.CustomerInfo" />
languageSpecificType="java:com.hundsun.insure.webservice.Customer"
qname="ns2:List" xmlns:ns2="urn:CustomerInfo" />
[/code]
客户端代码:
[code="java"]
public class Test {
public static void main(String[] args) throws Exception {
CustomerInfoServiceLocator service = new CustomerInfoServiceLocator();
CustomerInfo customerInfo = service.getCustomerInfo();
Object obj = customerInfo.getCustomerList();
}
}
[/code]
执行客户端时报错信息
[color=red] faultDetail:
{http://xml.apache.org/axis/}hostname:hundsun-cfb9b40
java.lang.NullPointerException
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)[/color]
[b]问题补充:[/b]
谢谢 :oops:
帖的代码里这个是有问题List list= null;
改了之后报的错是
[color=red]No deserializer for {urn:CustomerInfo}List[/color]
Javabean中已经实现了Serializable接口,为什么还会包这个错呢 ? :cry:
Customer implements java.io.Serializable
[b]问题补充:[/b]
[code="java"]
languageSpecificType="java:com.hundsun.insure.webservice.Customer"
qname="ns1:List" xmlns:ns1="urn:CustomerInfo" />
[/code]
请问beanMapping有没有写对?正确的代码应该怎么写
[b]问题补充:[/b]
没人帮忙 8)