现在从JAXRPC返回得到的是javabean形式的,我想把它变成xml,再做一些xslt等转换工作。这样做不行吗?请指教

解决方案 »

  1.   

    这个不太清楚,有没有可能返回wsdl?
      

  2.   

    JAXB AND CASTOR is OK.
    www.castor.org
      

  3.   

    返回的javabean是不是由wsdl映射生成的?
      

  4.   

    用castor的,每个javabean都可以实现转化吗??这个javabean为什么不行啊
    StockTableItemBean stocktableitembean =StockPriceFetcher.getStockTable(request,distributor);
                  filename="stocktable"+stockcode+".xml";    
                  fwriter = new FileWriter(filename);           
                  Marshaller.marshal(stocktableitembean, fwriter);
    --------------
    package stock;import java.io.Serializable;
    //股票代码表结构
    public class StockTableItemBean implements Serializable {    private int xFlag;            //停盘标志,'1'停,'0'开
    private String stkName;       //股票名称
    private int kind;           //类型 上指16,上A17,上B18,上债19;深指32,深A33,深B34,深债35
    private String stkCode;       //股票代码
    private int close_price;          //昨收盘价
    private int per_h;            //每手股数
    private int total5;           //5日平均总手数
        public StockTableItemBean() { }    public StockTableItemBean(int xFlag,String stkName,int kind,String stkCode,int close_price,int per_h,int total5) { 
            this.xFlag = xFlag;
            this.stkName = stkName;
            this.kind = kind;
            this.stkCode = stkCode;
            this.close_price = close_price;
            this.per_h = per_h;
            this.total5 = total5;
        }    public int getXFlag() {
            return xFlag;
        }    public void setXFlag(int xFlag) {
            this.xFlag = xFlag;
        }
        public String getStkName() {
            return stkName;
        }    public void setStkName(String stkName) {
            this.stkName = stkName;
        }
        public int getKind() {
            return kind;
        }    public void setKind(int kind) {
            this.kind = kind;
        }
        public String getStkCode() {
            return stkCode;
        }    public void setStkCode(String stkCode) {
            this.stkCode = stkCode;
        }
        public int getClosePrice() {
            return close_price;
        }    public void setClosePrice(int close_price) {
            this.close_price = close_price;
        }
        public int getPer_h() {
            return per_h;
        }    public void setPer_h(int per_h) {
            this.per_h = per_h;
        }
        public int getTotal5() {
            return total5;
        }    public void setTotal5(int total5) {
            this.total5 = total5;
        }}