You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Jongjin Choi (JIRA)" <ax...@ws.apache.org> on 2005/07/14 07:43:15 UTC

[jira] Commented: (AXIS-2098) xsi:type added to derived simple types

    [ http://issues.apache.org/jira/browse/AXIS-2098?page=comments#action_12315816 ] 

Jongjin Choi commented on AXIS-2098:
------------------------------------

I think that  xsi:type is generated in the SOAP message 
because the xml type from type mapping (xsd:boolean in the case)  is different from the original restricted xml type (LogicType in this case) during serialization.

But when you see the result from Axis, the response message dose not contain xsi:type="xsd:boolean" for LogicType.
For example, this is the response from current CVS:

<?xml version="1.0" encoding="UTF-8"?>
   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Body>
         <MyResponse xmlns="http://helloworld.ch/schema/types">
            <Helloworld>
               <Logic>true</Logic>
               <String>Hello World --------------------------!</String>
               <Restriction>
                  <LastName>World</LastName>
                  <firstName xsi:nil="true"/>
               </Restriction>
            </Helloworld>
         </MyResponse>
      </soapenv:Body>
   </soapenv:Envelope>

Here is the scenario for current CVS:
1. The typemapping entry registered in client side (by stub) is (boolean, {http://{http://helloworld.ch/schema/types}LogicType).
2. The typemapping entry registered in server side (by WSDDTypeMappingImpl) is (java.lang.Boolean, {http://{http://helloworld.ch/schema/types}LogicType).
    In server-config.wsdd, the registered mapping is boolean and LogicType but In WSDDTypeMapping#getLanguageSpecificType() the primtive type is converted to primitive wrapper.
  
3. In serialization, the boolean value is treated as Object and its class is java.lang.Booean instead of boolean. 
In the client side, the correct type mapping can not be found because the (java.lang.Boolean, LogicType) is not registered,
and the default type mapping for boolean primitive is used, so  'xsi:type' is serialized in the soap message.

In the server side, the type mapping can be found so 'xsi:type' is not serialized  in the soap message.

I think that two solution possible, 
 1. add some code in TypeMappingImpl to find the type mapping by the xml type. (LogicType in this case) .
 2. add java type parameter in the signature of serialize() and actualSerialize() in SerializationContext,
     so we can find type mapping for the value from its original java type (boolean) not relected type (java.lang.Boolean) 

I think option 2 is better solution but it would break the existing signature of SerializationContext. 
I worked on it and currently am doing all-tests and fixing errors caused from other  test-cases.

This issue is related to AXIS-2103.

> xsi:type added to derived simple types
> --------------------------------------
>
>          Key: AXIS-2098
>          URL: http://issues.apache.org/jira/browse/AXIS-2098
>      Project: Apache Axis
>         Type: Bug
>   Components: Basic Architecture
>     Versions: 1.2.1
>     Reporter: David Kocher
>     Priority: Blocker
>  Attachments: helloworld.tar.gz
>
> Given a simple type such as
>     <xs:simpleType name="LogicType">
>         <xs:restriction base="xs:boolean">
>             <xs:pattern value="true"/>
>             <xs:pattern value="false"/>
>         </xs:restriction>
>     </xs:simpleType>
> Axis will serialize this as 
>                <Logic xsi:type="xsd:boolean">true</Logic>
> which won't validate because
> Type 'xsd:boolean' is not validly derived from the type definition, 'LogicType', of element 'Logic'.
> This is only the case in the request message; the response message of the same type is sent correctly.
> See the attached sample project.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira