2010-10-19 224 views
0

我有實現一個簡單的Web服務的Web服務的方法簽名是:問題與Java Web服務

public OperationResult createUser(int systemId, int refId, String name, 
      String password, int planId, BigDecimal amount) 

的OperationResult類如下:

public class OperationResult implements Serializable { 

    private static final long serialVersionUID = 1L; 
    int resultType; 
    String result; 

    public OperationResult(int resultType, String result) { 
     super(); 
     this.resultType = resultType; 
     this.result = result; 
    } 

    public int getResultType() { 
     return resultType; 
    } 

    public void setResultType(int resultType) { 
     this.resultType = resultType; 
    } 

    public String getResult() { 
     return result; 
    } 

    public void setResult(String result) { 
     this.result = result; 
    } 

} 

當我嘗試使用服務它拋出此除了

java.rmi.RemoteException: java.lang.InstantiationException: com.pardis.quota.core.OperationResult; nested exception is: 
    com.bea.xml.XmlRuntimeException: java.lang.InstantiationException: com.pardis.quota.core.OperationResult 
    at com.pardis.quota.webservice.Quota_Stub.createUser(Quota_Stub.java:216) 
    at Test.main(Test.java:20) 
Caused by: com.bea.xml.XmlRuntimeException: java.lang.InstantiationException: com.pardis.quota.core.OperationResult 
    at com.bea.staxb.runtime.internal.ClassLoadingUtils.newInstance(ClassLoadingUtils.java:139) 
    at com.bea.staxb.runtime.internal.ByNameRuntimeBindingType.createIntermediary(ByNameRuntimeBindingType.java:207) 
    at com.bea.staxb.runtime.internal.AttributeUnmarshaller.unmarshal(AttributeUnmarshaller.java:36) 
    at com.bea.staxb.runtime.internal.UnmarshalResult.unmarshalBindingType(UnmarshalResult.java:179) 
    at com.bea.staxb.runtime.internal.UnmarshalResult.unmarshalType(UnmarshalResult.java:217) 
    at com.bea.staxb.runtime.internal.UnmarshallerImpl.unmarshalType(UnmarshallerImpl.java:127) 
    at weblogic.wsee.bind.runtime.internal.LiteralDeserializerContext.unmarshalType(LiteralDeserializerContext.java:72) 
    at weblogic.wsee.bind.runtime.internal.BaseDeserializerContext.internalDeserializeType(BaseDeserializerContext.java:172) 
    at weblogic.wsee.bind.runtime.internal.BaseDeserializerContext.deserializeType(BaseDeserializerContext.java:86) 
    at weblogic.wsee.bind.runtime.internal.BaseDeserializerContext.deserializeWrappedElement(BaseDeserializerContext.java:135) 
    at weblogic.wsee.codec.soap11.SoapDecoder.decodePart(SoapDecoder.java:486) 
    at weblogic.wsee.codec.soap11.SoapDecoder.decodeReturn(SoapDecoder.java:404) 
    at weblogic.wsee.codec.soap11.SoapDecoder.decodeParts(SoapDecoder.java:174) 
    at weblogic.wsee.codec.soap11.SoapDecoder.decode(SoapDecoder.java:125) 
    at weblogic.wsee.codec.soap11.SoapCodec.decode(SoapCodec.java:180) 
    at weblogic.wsee.ws.dispatch.client.CodecHandler.decodeOutput(CodecHandler.java:127) 
    at weblogic.wsee.ws.dispatch.client.CodecHandler.decode(CodecHandler.java:104) 
    at weblogic.wsee.ws.dispatch.client.CodecHandler.handleResponse(CodecHandler.java:81) 
    at weblogic.wsee.handler.HandlerIterator.handleResponse(HandlerIterator.java:287) 
    at weblogic.wsee.handler.HandlerIterator.handleResponse(HandlerIterator.java:271) 
    at weblogic.wsee.ws.dispatch.client.ClientDispatcher.handleResponse(ClientDispatcher.java:213) 
    at weblogic.wsee.ws.dispatch.client.ClientDispatcher.dispatch(ClientDispatcher.java:150) 
    at weblogic.wsee.ws.WsStub.invoke(WsStub.java:87) 
    at weblogic.wsee.jaxrpc.StubImpl._invoke(StubImpl.java:337) 
    at com.pardis.quota.webservice.Quota_Stub.createUser(Quota_Stub.java:207) 
    ... 1 more 
Caused by: java.lang.InstantiationException: com.pardis.quota.core.OperationResult 
    at java.lang.Class.newInstance0(Class.java:340) 
    at java.lang.Class.newInstance(Class.java:308) 
    at com.bea.staxb.runtime.internal.ClassLoadingUtils.newInstance(ClassLoadingUtils.java:137) 
    ... 25 more 

我使用的是weblogic 10,當我測試服務與weblogic它的作品成功

但是當我通過java代碼使用它失敗。

在此先感謝

回答

5

我的猜測是,你需要添加參數的構造函數:

public OpreationResult() { 
} 

在這個方向的堆棧跟蹤點。

我希望它有幫助。

+0

+1。這是序列化機制所要求的。 – Bozho 2010-10-19 11:03:01

+0

是的,它的工作原理。謝謝 – arash 2010-10-19 11:04:54