views:

24

answers:

1

hi all

i have implement a simple web service the method signature of web service is:

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

the OperationResult class is as follows:

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;
    }

}

when i try to use the service it throws this exceptin

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

i am using weblogic 10, when i am testing the service with weblogic it works successfully

but when i am using it by a java code it fails.

thanks in advance

+5  A: 

My guess is, you would need to add parameterless constructor:

public OpreationResult() {
}

The stacktrace points in that direction.

I hope it helps.

OscarRyz
+1. It's required by the serialization mechanism.
Bozho
yes it works. thank you
arash