axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "SPSS (JIRA)" <axis-...@ws.apache.org>
Subject [jira] Created: (AXIS-2135) CastorSerializer 1.2/1.2.1 does not handle arrays correctly
Date Thu, 21 Jul 2005 17:13:10 GMT
CastorSerializer 1.2/1.2.1 does not handle arrays correctly
-----------------------------------------------------------

         Key: AXIS-2135
         URL: http://issues.apache.org/jira/browse/AXIS-2135
     Project: Apache Axis
        Type: Bug
  Components: Serialization/Deserialization  
    Versions: 1.2, 1.2.1    
    Reporter: SPSS


It seems that new Castor Serializer for Axis 1.2/1.2.1 does not handle arrays correctly (it
works fine in 1.1).

Here is the SOAP envelope produced by the serializer:

<?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>
             <getSubscribersResponse xmlns="http://xml.spss.com/notification/remote">
                    <ns1:subscriber[0,unbounded] enabled="true" principalID="\SPSS\dvasilen"
xmlns:ns1=" http://xml.spss.com/notification">
                           <ns1:identifier>0a0a483801584807000001053a13f207800e</ns1:identifier>
                    </ns1:subscriber[0,unbounded]> 
             </getSubscribersResponse>
       </soapenv:Body>
</soapenv:Envelope>

Note that array boundaries are included in the XML as [0,unbounded]. 
The XML parser throws the following exception when tries to parse this invalid XML

org.xml.sax.SAXParseException: Element type "ns1:subscriber" must be followed by either attribute
specifications, ">" or "/>".
AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode: 
 faultString: org.xml.sax.SAXParseException: Element type &quot;ns1:subscriber&quot;
must be followed by either attribute specifications, &quot;&gt;&quot; or &quot;/&gt;&quot;.
 faultActor: 
 faultNode: 
 faultDetail: 
	{http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXParseException: Element type &quot;ns1:subscriber&quot;
must be followed by either attribute specifications, &quot;&gt;&quot; or &quot;/&gt;&quot;.
	at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
	at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
	at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
	at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
	at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
	at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
	at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
	at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
	at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
	at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
	at org.apache.axis.client.Call.invoke(Call.java:2748)
	at org.apache.axis.client.Call.invoke(Call.java:2424)
	at org.apache.axis.client.Call.invoke(Call.java:2347)
	at org.apache.axis.client.Call.invoke(Call.java:1804)
	at com.spss.notification.ws.axis.SubscriptionRepositoryServiceStub.getSubscribers(SubscriptionRepositoryServiceStub.java:2120)

The correct envelope should look like this

<?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>
             <getSubscribersResponse xmlns="http://xml.spss.com/notification/remote">
                    <ns1:subscriber enabled="true" principalID="\SPSS\dvasilen" xmlns:ns1="
http://xml.spss.com/notification">
                           <ns1:identifier>0a0a483801584807000001053a13f207800e</ns1:identifier>
                    </ns1:subscriber> 
             </getSubscribersResponse>
       </soapenv:Body>
</soapenv:Envelope>

The quick fix is the change 

            marshaller.setRootElement(name.getLocalPart());

to 

            String localPart = name.getLocalPart();
            int arrayDims = localPart.indexOf('[');
            if (arrayDims != -1) {
                localPart = localPart.substring(0, arrayDims);
            }
            marshaller.setRootElement(localPart);

in the org.apache.axis.encoding.ser.castor.CastorSerializer






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


Mime
View raw message