项目中使用cxf作WebService的实现。但是在调用一个方法的时候,在客户端就出错,说是IllegalArgumentException。昨晚加班到凌晨4点,才找到原因。原来,在服务方法中有一个String类型的参数,当给这个参数传空指针的时候,就会出错。

      cxf也太弱了吧?给参数传空指针就会出错,而且错误信息十分不友好。为什么不提示说是空指针呢?或者干脆就支持空指针好了。

评论
jnn 2007-10-15
你是采用WSDL First 还是Code First来发布你的服务的, 我记得如果采用WSDL First的话,将参数的Element设置为nillable。
还有你采用Code First的话, 可以通过JAXWS API 中Annotation 设置你的来参数的内容。

JAXB has the ability to specify that stuff with attributes on the 
XmlElement annotation. JAX-WS allows you to define a "wrapper" type
that the runtime uses to for IO. Thus, you can create the wrapper type
with the annotations that you want and then use the @RequestWrapper and
@ResponseWrapper annotations to point the JAX-WS runtime at it.
发表评论

提醒: 该博客已发表在公共论坛,博客所有留言会成为论坛回贴,留言请注意遵守论坛发贴规则

您还没有登录,请登录后发表评论

Frederick
搜索本博客
最近加入圈子
存档
最新评论