浏览 871 次
|
该帖已经被评为新手帖
|
|
|---|---|
| 作者 | 正文 |
|
最后更新时间:2007-03-27 关键字: 有关JAVA6自带的webservice的问题
大致代码如下
@WebService(targetNamespace="http://ws.aaa.com/")
@SOAPBinding(style = SOAPBinding.Style.RPC)
public class aaaImpl
{
public void Hello(Collection c) throws Exception
{
// TODO Auto-generated method stub
}
}
现象 不能用Endpoint.publish发布 报错,找不到jaxws.ExceptionBean 问题: WS的方法不是不能抛出异常 怎么解决 声明:JavaEye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
|
|
| 返回顶楼 | |
|
最后更新时间:2007-03-26
1.不能没有包名,比如取包名aaa
2.用wsgen生成辅助的文件。比如 wsgen -cp ./bin -keep -d ./classes -r ./generated -wsdl aaa.aaaImpl 生成的ExceptionBean类似于
package aaa.jaxws;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* This class was generated by the JAXWS SI.
* JAX-WS RI 2.0_02-b08-fcs
* Generated source version: 2.0_02
*
*/
@XmlRootElement(name = "Exception", namespace = "http://ws.aaa.com/")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Exception", namespace = "http://ws.aaa.com/")
public class ExceptionBean {
private String message;
/**
*
* @return
* returns String
*/
public String getMessage() {
return this.message;
}
/**
*
* @param message
* the value for the message property
*/
public void setMessage(String message) {
this.message = message;
}
}
|
|
| 返回顶楼 | |
|
最后更新时间:2007-03-27
感谢楼上的解答
现在又有一个新的问题 webMethod里面返回的是一个ArrayList 客户端用wsimport产生stub会同时产生 AbstractCollection.java AbstractList.java ArrayList.java (不同与java.util.*下的同名类) 于是客户端得不到正确的结果 强行把产生的ArrayList删了 将所有所有ArrayList引用改成引用java.util.ArrayList 也不行 这个是什么问题 是不是不能返回ArrayList 大概代码如下
@WebService(targetNamespace="http://ws.aaa.com/")
@SOAPBinding(style = SOAPBinding.Style.RPC)
public class aaaImpl
{
public ArrayList get()
{
// TODO Auto-generated method stub
ArrayList list = ……
……
……
return list;
}
}
刚搜索了下 发现也有人遇到这个问题 http://www.blogjava.net/vip01/archive/2007/01/19/94876.html |
|
| 返回顶楼 | |




