我发送字段CURRENT_BUSINESS的XML请求,这是一个ENUM值。应该反序列化的可能值是什么。 我得到了这个例外:
{http://xml.apache.org/axis/}stackTrace:java.lang.IllegalArgumentException
com.edu.service.provider.prime.entity.studentInfo._2012;
at com.edu.service.provider.prime.entity.studentInfo._2012.BusinessCode_Enum.fromValue(BusinessCode_Enum.java:33)
at com.edu.service.provider.prime.entity.studentInfo._2012.BusinessCode_Enum.fromString(BusinessCode_Enum.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.axis.encoding.ser.EnumDeserializer.makeValue(EnumDeserializer.java:53)
at org.apache.axis.encoding.ser.SimpleDeserializer.onEndElement(SimpleDeserializer.java:172)
at org.apache.axis.encoding.DeserializerImpl.endElement(DeserializerImpl.java:502)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:171)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:81)
at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
ENUM实施:
/**
* BusinessCode_Enum.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.edu.service.provider.prime.entity.studentInfo._2012;
public class BusinessCode_Enum implements java.io.Serializable {
private java.lang.String _value_;
private static java.util.HashMap _table_ = new java.util.HashMap();
// Constructor
protected BusinessCode_Enum(java.lang.String value) {
_value_ = value;
_table_.put(_value_,this);
}
public static final java.lang.String _CURRENT_BUSINESS = "CURRENT_BUSINESS";
public static final java.lang.String _NEXT_BUSINESS = "NEXT_BUSINESS";
public static final java.lang.String _CLIENT = "CLIENT";
public static final java.lang.String _PREV_BUSINESS = "PREV_BUSINESS";
public static final BusinessCode_Enum CURRENT_BUSINESS = new BusinessCode_Enum(_CURRENT_BUSINESS);
public static final BusinessCode_Enum NEXT_BUSINESS = new BusinessCode_Enum(_NEXT_BUSINESS);
public static final BusinessCode_Enum CLIENT = new BusinessCode_Enum(_CLIENT);
public static final BusinessCode_Enum PREV_BUSINESS = new BusinessCode_Enum(_PREV_BUSINESS);
public java.lang.String getValue() { return _value_;}
public static BusinessCode_Enum fromValue(java.lang.String value)
throws java.lang.IllegalArgumentException {
BusinessCode_Enum enumeration = (BusinessCode_Enum)
_table_.get(value);
if (enumeration==null) throw new java.lang.IllegalArgumentException();
return enumeration;
}
public static BusinessCode_Enum fromString(java.lang.String value)
throws java.lang.IllegalArgumentException {
return fromValue(value);
}
public boolean equals(java.lang.Object obj) {return (obj == this);}
public int hashCode() { return toString().hashCode();}
public java.lang.String toString() { return _value_;}
public java.lang.Object readResolve() throws java.io.ObjectStreamException { return fromValue(_value_);}
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.EnumSerializer(
_javaType, _xmlType);
}
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.EnumDeserializer(
_javaType, _xmlType);
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(BusinessCode_Enum.class);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("http://service.edu.com/provider/prime/entity/studentInfo/2012/", "BusinessCode_Enum"));
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
}
答案 0 :(得分:0)
我认为枚举中的自定义字段(例如_table_
)根本没有序列化。见this answer to the question "Is custom enum Serializable too?"
答案 1 :(得分:0)
'
需要:
private static java.util.HashMap _table_ = new java.util.HashMap();