这个类有地方要注意,一种简单的方法就是这个类的编写要符合Java Bean规范(主要也就是get、set方法),然后通过类似 <beanMapping languageSpecificType="java:com.iconsh.miis.vo.config.group.GroupVO" qname="ns1:GroupVO" mlns:ns1="http://iconsh.com/miis/config/group"/>这样的标记进行注册。当然也有另外的方法,但这种方法将全很麻烦,但效率可能会更好,这种方法要编写serializer class 实现org.apache.axis.encoding.Serialize,编写serializer factory class实现org.apache.axis.encoding.SerialzerFactory,编写deserializer class和deserializer factory class,并通过TypeMapping元素进行注册。

解决方案 »

  1.   

    Creating Type Mappings
    Apache SOAP uses type mappings to determine how Java datatypes should be marshalled to/unmarshalled from XML so that they can be transmitted on/received from the wire. The type mappings are stored in a type mapping registry, with the default registry being org.apache.soap.encoding.SOAPMappingRegistry.Each type mapping carries several pieces of information: a URI describing the encoding style (i.e. http://schemas.xmlsoap.org/soap/encoding/,) a qualified name (QName) for the XML element (i.e. http://www.w3.org/2001/XMLSchema:int,) the Java class to be encoded from/decoded to, the name of the Java class to act as the serializer, and the name of the Java class to act as the deserializer. The Java classes acting as serializers/deserializers must implement org.apache.soap.util.xml.Serializer and org.apache.soap.util.xml.Deserializer, respectively.To make life a little easier, a set of type mappings has been predefined and registered into the SOAPMappingRegistry for the SOAP encoding style. These include mappings for the following Java types:most Java primitive types, such as int, float, boolean, byte, etc. and their corresponding wrapper classes (i.e. java.lang.Integer, java.lang.Boolean, etc.) 
    Java arrays 
    java.lang.String 
    java.util.Date 
    java.util.GregorianCalendar 
    java.util.Vector 
    java.util.Hashtable 
    java.util.Map (under Java editions in which this is supported) 
    java.math.BigDecimal 
    javax.mail.internet.MimeBodyPart 
    java.io.InputStream 
    javax.activation.DataSource 
    javax.activation.DataHandler 
    org.apache.soap.util.xml.QName 
    org.apache.soap.rpc.Parameter 
    java.lang.Object (a deserializer for null objects only) 
    The SOAPMappingRegistry also provides a type mapping to encode org.apache.soap.rpc.Parameters in the literal XML encoding style, and a set of mappings to encode types supported by the IBM XMI Framework in the XMI encoding style.If you want to pass your own objects as parameters to SOAP RPC services, then you will need to register new type mappings (and possibly create your own serializers/deserializers.) Remember that you will need to register the new type mappings on both the server and the client sides.Registering Type Mappings on the Server
    There are two main ways to register type mapping information into an Apache SOAP server:Registering them via the deployment descriptor. 
    Overriding the default mapping registry with a registry that has your new type mappings pre-registered. 
    The first way is probably the easiest to implement and manage, but it does require that you replicate the mapping information in each deployment descriptor that needs it. For more information on registering type mapping information via a deployment descriptor, look here.The second mechanism requires a little more work, but allows you to limit the amount of additional information that you need to put into each deployment descriptor. In addition, the same mapping registry may be used on the client side, and thus may cut down on the amount of additional code that must be written for the client. The new registry must be a subclass of the SOAPMappingRegistry. For information about overriding the default mapping registry, look here.Registering Type Mappings on the Client
    As is the case with the server, on the client there are also two main ways to register type mapping information:Create an instance of the SOAPMappingRegistry and use the mapTypes(...) method to add new mappings. 
    Create an instance of a subclass of the SOAPMappingRegistry that already has your mappings pre-registered. 
    The first way is probably the easiest to do, but if you have to use the same type mappings in multiple different clients or if you are also implementing the server-side as well, then the second method may save you a little bit of coding.The Bean Serializer/Deserializer
    In many cases, even if there is not a default type mapping for the object that you are trying to transmit, you still may not need to create a new serializer/deserializer. Apache SOAP comes with a Java Bean Serializer/Deserializer that may suit your needs. The org.apache.soap.encoding.soapenc.BeanSerializer can be used to serialize and deserialize JavaBeans using the SOAP encoding style. The public properties of the bean will become named accessors (elements) in the XML form. To use the BeanSerializer, simply pass "org.apache.soap.encoding.soapenc.BeanSerializer" as the last two parameters when you are registering the type mapping for your object.Note: The object that you are serializing with the BeanSerializer MUST be a JavaBean for this serializer to work:It MUST have a no-args constructor 
    It MUST expose all interesting state through properties 
    It MUST not matter what order the accessors for the properties (i.e. the setX/getX methods) are in 
    etc. 
    This is NOT a general/all-purpose serializer. It WILL NOT work if the object which you are serializing/deserializing does not conform to the JavaBeans definition. It is NOT a bug if you cannot serialize/deserialize your non-Bean, Java class with this, any more than it is a bug that you can't serialize a java.awt.Panel with the java.util.Date serializer. Creating New Serializers and Deserializers
    If you need to create a new serializer/deserializer, then looking at the source code for the predefined ones will probably provide you with the best guidance. Remember that they will need to implement org.apache.soap.util.xml.Serializer and org.apache.soap.util.xml.Deserializer respectively. You can implement them both in the same class, or use two different classes, it really makes no difference.Last updated 5/21/2001 by Bill Nagy <[email protected]>.
      

  2.   

    呵呵,首先应该明白Apache在实现Axis和Apache Soap基本上采用了不同的构架,我分析过Apache soap和Axis的一些源代码,以及阅读了相关的技术资料,Axis将具有更好的扩展性和灵活性,至少在实现在有状太EJB的调用的时候是这样。
      

  3.   

    It's a good suggestion, thank you!!!
      

  4.   

    Old pal, has some more suggestion?
      

  5.   

    至于见议我也讲不出来,但你有问题说出来我可能能回答一点,因为我基本上看了Axis的代码(异常传递部分了解较少,呵呵),对Axis的结构也比较了解,至于Apache Soap代码看的较少,因为公司里要用Webservice实现一些特殊的功能,我们选用的是Axis。
      

  6.   

    一个比较讨厌的问题就是Axis目录好像没有完全支持JAX_RPC。