You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@xml.apache.org by Marcel Schelvis <ma...@instill.com> on 2000/11/21 19:47:11 UTC

[PATCH] : Serializer should map java *type* to xsi:type, deserial izer maps xsi:type to java *class*

Problem
------------
Currently, the SOAP 2.0 runtime requires that the type and the class of Java
objects be identical.
This makes it impossible to use interfaces (see sample). I consider this a
fundamental flaw which should
be fixed in the core.

Patch in diff -C3 format
---------------------------------
 <<DeploymentDescriptor.java.diffC3>>  <<TypeMapping.java.diffC3>>  
<<TypeMappingSerializer.java.diffC3>>  
<<XMLJavaMappingRegistry.java.diffC3>> 

What this does:
1) deserializer: map xsi:type to *javaClass* to create new instance of. Get
the javaClass name from new dd isd:map attribute "javaClass"
2) serializer: map object's *javaType* to xsi:type. Get the javaType from
old dd isd:map attribute "javaType"
Note: patch is backward-compatible, i.e., if javaClass attribute is absent,
things work as before.

Sample
-----------
public interface PhoneNumber {
..
}
public interface Address {
	public void setPhoneNumber(PhoneNumber phoneNumber);
	public PhoneNumber getPhoneNumber();
	..
}
public class server.PhoneNumberImpl implements PhoneNumber {
..
}
public class server.AddressImpl implements Address {
..
}
public class client.PhoneNumberImpl implements PhoneNumber {
..
}
public class client.AddressImpl implements Address {
..
}

  <isd:mappings>
    <isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
	xmlns:x="urn:xml-soap-address-demo" qname="x:address"
	javaType="samples.addressbook.Address"
	javaClass="samples.addressbook.AddressImpl"
	java2XMLClassName="org.apache.soap.encoding.soapenc.BeanSerializer"
	
xml2JavaClassName="org.apache.soap.encoding.soapenc.BeanSerializer"/>
    <isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
	xmlns:x="urn:xml-soap-address-demo" qname="x:phone"
	javaType="samples.addressbook.PhoneNumber"
	javaClass="samples.addressbook.PhoneNumberImpl"
	java2XMLClassName="org.apache.soap.encoding.soapenc.BeanSerializer"
	
xml2JavaClassName="org.apache.soap.encoding.soapenc.BeanSerializer"/>
  </isd:mappings>


Re: [PATCH] : Serializer should map java *type* to xsi:type, deserial izer maps xsi:type to java *class*

Posted by Dennis Faynberg <de...@nj.paradyne.com>.
Speaking about mappings. SOAP 2.0 deployment descriptor entry
(among other things) assosiates QName with a java class/interface, 
incase name can not be determined at run-time (like names of method
argument list). This assosiation does not seem to be complete
without an xml schema element *type* field. Has anyone ever discussed
that?  

On Tue, 21 Nov 2000, Marcel Schelvis wrote:

> Problem
> ------------
> Currently, the SOAP 2.0 runtime requires that the type and the class of Java
> objects be identical.
> This makes it impossible to use interfaces (see sample). I consider this a
> fundamental flaw which should
> be fixed in the core.
> 
> Patch in diff -C3 format
> ---------------------------------
>  <<DeploymentDescriptor.java.diffC3>>  <<TypeMapping.java.diffC3>>  
> <<TypeMappingSerializer.java.diffC3>>  
> <<XMLJavaMappingRegistry.java.diffC3>> 
> 
> What this does:
> 1) deserializer: map xsi:type to *javaClass* to create new instance of. Get
> the javaClass name from new dd isd:map attribute "javaClass"
> 2) serializer: map object's *javaType* to xsi:type. Get the javaType from
> old dd isd:map attribute "javaType"
> Note: patch is backward-compatible, i.e., if javaClass attribute is absent,
> things work as before.
> 
> Sample
> -----------
> public interface PhoneNumber {
> ..
> }
> public interface Address {
> 	public void setPhoneNumber(PhoneNumber phoneNumber);
> 	public PhoneNumber getPhoneNumber();
> 	..
> }
> public class server.PhoneNumberImpl implements PhoneNumber {
> ..
> }
> public class server.AddressImpl implements Address {
> ..
> }
> public class client.PhoneNumberImpl implements PhoneNumber {
> ..
> }
> public class client.AddressImpl implements Address {
> ..
> }
> 
>   <isd:mappings>
>     <isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> 	xmlns:x="urn:xml-soap-address-demo" qname="x:address"
> 	javaType="samples.addressbook.Address"
> 	javaClass="samples.addressbook.AddressImpl"
> 	java2XMLClassName="org.apache.soap.encoding.soapenc.BeanSerializer"
> 	
> xml2JavaClassName="org.apache.soap.encoding.soapenc.BeanSerializer"/>
>     <isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> 	xmlns:x="urn:xml-soap-address-demo" qname="x:phone"
> 	javaType="samples.addressbook.PhoneNumber"
> 	javaClass="samples.addressbook.PhoneNumberImpl"
> 	java2XMLClassName="org.apache.soap.encoding.soapenc.BeanSerializer"
> 	
> xml2JavaClassName="org.apache.soap.encoding.soapenc.BeanSerializer"/>
>   </isd:mappings>
> 
> 


Re: [PATCH] : Serializer should map java *type* to xsi:type, deserial izer maps xsi:type to java *class*

Posted by Dennis Faynberg <de...@nj.paradyne.com>.
Speaking about mappings. SOAP 2.0 deployment descriptor entry
(among other things) assosiates QName with a java class/interface, 
incase name can not be determined at run-time (like names of method
argument list). This assosiation does not seem to be complete
without an xml schema element *type* field. Has anyone ever discussed
that?  

On Tue, 21 Nov 2000, Marcel Schelvis wrote:

> Problem
> ------------
> Currently, the SOAP 2.0 runtime requires that the type and the class of Java
> objects be identical.
> This makes it impossible to use interfaces (see sample). I consider this a
> fundamental flaw which should
> be fixed in the core.
> 
> Patch in diff -C3 format
> ---------------------------------
>  <<DeploymentDescriptor.java.diffC3>>  <<TypeMapping.java.diffC3>>  
> <<TypeMappingSerializer.java.diffC3>>  
> <<XMLJavaMappingRegistry.java.diffC3>> 
> 
> What this does:
> 1) deserializer: map xsi:type to *javaClass* to create new instance of. Get
> the javaClass name from new dd isd:map attribute "javaClass"
> 2) serializer: map object's *javaType* to xsi:type. Get the javaType from
> old dd isd:map attribute "javaType"
> Note: patch is backward-compatible, i.e., if javaClass attribute is absent,
> things work as before.
> 
> Sample
> -----------
> public interface PhoneNumber {
> ..
> }
> public interface Address {
> 	public void setPhoneNumber(PhoneNumber phoneNumber);
> 	public PhoneNumber getPhoneNumber();
> 	..
> }
> public class server.PhoneNumberImpl implements PhoneNumber {
> ..
> }
> public class server.AddressImpl implements Address {
> ..
> }
> public class client.PhoneNumberImpl implements PhoneNumber {
> ..
> }
> public class client.AddressImpl implements Address {
> ..
> }
> 
>   <isd:mappings>
>     <isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> 	xmlns:x="urn:xml-soap-address-demo" qname="x:address"
> 	javaType="samples.addressbook.Address"
> 	javaClass="samples.addressbook.AddressImpl"
> 	java2XMLClassName="org.apache.soap.encoding.soapenc.BeanSerializer"
> 	
> xml2JavaClassName="org.apache.soap.encoding.soapenc.BeanSerializer"/>
>     <isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> 	xmlns:x="urn:xml-soap-address-demo" qname="x:phone"
> 	javaType="samples.addressbook.PhoneNumber"
> 	javaClass="samples.addressbook.PhoneNumberImpl"
> 	java2XMLClassName="org.apache.soap.encoding.soapenc.BeanSerializer"
> 	
> xml2JavaClassName="org.apache.soap.encoding.soapenc.BeanSerializer"/>
>   </isd:mappings>
> 
>