[jira] Commented: (WSCOMMONS-78) Including a schema without namespace into a schema with namespace is not possible
[ http://issues.apache.org/jira/browse/WSCOMMONS-78?page=comments#action_12432602 ] Davanum Srinivas commented on WSCOMMONS-78: --- Jochen, I can run more tests to check but i'd prefer that we stick to the game plan and get the changes for 78 in (which may break more things) and then i can clean up afterwards in time for Axis2 1.1 release. thanks, -- dims > Including a schema without namespace into a schema with namespace is not > possible > - > > Key: WSCOMMONS-78 > URL: http://issues.apache.org/jira/browse/WSCOMMONS-78 > Project: WS-Commons > Issue Type: Bug > Components: XmlSchema >Reporter: Jochen Wiedmann > Attachments: XmlSchema-include-handling.patch, > XmlSchema-Include-Without-Namespace.patch > > > The XML Schema specification states in "4.2.1 Assembling a schema for a > single target namespace from multiple schema definition documents": > 2 One of the following must be true: > ... > 2.3 SII has no targetNamespace [attribute] (but SII' does). > 3 The appropriate case among the following must be true: > ... > 3.2 If clause 2.3 above is satisfied, then the schema corresponding to the > d item's parent must include not only definitions > or declarations corresponding to the appropriate members of its own > [children], but also components identical to all the - schema components- of > I, > except that anywhere the - absent- target namespace name would have > appeared, the - actual value- of the targetNamespace [attribute] of SII' is > used. > In particular, it replaces - absent- in the following places: > 3.2.1 The {target namespace} of named schema components, both at the top > level and (in the case of nested type definitions and nested attribute and > element declarations whose code was qualified) nested within definitions; > 3.2.2 The {namespace constraint} of a wildcard, whether negated or not; > In other words, it is possible to include a schema without namespace, as if > it had the namespace of the including schema. > Unfortunately this fails with XmlSchema, as the attached patch demonstrates. > The patch includes a simple test case and could be applied, if this bug is > fixed. > Suggested resolution, as realized in JaxMeXS: If such a schema is being > parsed, then mutable instances of QName should be created, which would always > return the target namespace of the schema. -- 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 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[jira] Updated: (WSCOMMONS-78) Including a schema without namespace into a schema with namespace is not possible
[ http://issues.apache.org/jira/browse/WSCOMMONS-78?page=all ] Jochen Wiedmann updated WSCOMMONS-78: - Attachment: XmlSchema-include-handling2.patch Ok, Dims, as requested, here's the updated patch. > Including a schema without namespace into a schema with namespace is not > possible > - > > Key: WSCOMMONS-78 > URL: http://issues.apache.org/jira/browse/WSCOMMONS-78 > Project: WS-Commons > Issue Type: Bug > Components: XmlSchema >Reporter: Jochen Wiedmann > Attachments: XmlSchema-include-handling.patch, > XmlSchema-include-handling2.patch, XmlSchema-Include-Without-Namespace.patch > > > The XML Schema specification states in "4.2.1 Assembling a schema for a > single target namespace from multiple schema definition documents": > 2 One of the following must be true: > ... > 2.3 SII has no targetNamespace [attribute] (but SII' does). > 3 The appropriate case among the following must be true: > ... > 3.2 If clause 2.3 above is satisfied, then the schema corresponding to the > d item's parent must include not only definitions > or declarations corresponding to the appropriate members of its own > [children], but also components identical to all the - schema components- of > I, > except that anywhere the - absent- target namespace name would have > appeared, the - actual value- of the targetNamespace [attribute] of SII' is > used. > In particular, it replaces - absent- in the following places: > 3.2.1 The {target namespace} of named schema components, both at the top > level and (in the case of nested type definitions and nested attribute and > element declarations whose code was qualified) nested within definitions; > 3.2.2 The {namespace constraint} of a wildcard, whether negated or not; > In other words, it is possible to include a schema without namespace, as if > it had the namespace of the including schema. > Unfortunately this fails with XmlSchema, as the attached patch demonstrates. > The patch includes a simple test case and could be applied, if this bug is > fixed. > Suggested resolution, as realized in JaxMeXS: If such a schema is being > parsed, then mutable instances of QName should be created, which would always > return the target namespace of the schema. -- 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 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Board Report for Sept 2006
Dear ws committers, Remainder: *PLEASE* update wiki with status of your projects thanks, dims On 9/1/06, Davanum Srinivas <[EMAIL PROTECTED]> wrote: Team, It's time for updating the board about what we have been upto. Please take a few minutes to update the wiki as usual. Yes, All committers are welcome to add content. All PMC members, please make an effort as it is part of your duty as PMC members. http://wiki.apache.org/ws/ReportForSep2006 Thanks, dims -- Davanum Srinivas : http://www.wso2.net (Oxygen for Web Service Developers) -- Davanum Srinivas : http://www.wso2.net (Oxygen for Web Service Developers) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r440386 - in /webservices/commons/trunk/modules/XmlSchema/src: main/java/org/apache/ws/commons/schema/ test/java/tests/
Author: dims Date: Tue Sep 5 09:25:37 2006 New Revision: 440386 URL: http://svn.apache.org/viewvc?view=rev&rev=440386 Log: Fix for WSCOMMONS-78 - Including a schema without namespace into a schema with namespace is not possible Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchema.java webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaException.java webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaType.java webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/CircularSchemaTest.java webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/IncludeTest.java Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java?view=diff&rev=440386&r1=440385&r2=440386 == --- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java (original) +++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java Tue Sep 5 09:25:37 2006 @@ -22,12 +22,15 @@ import java.util.StringTokenizer; import java.util.Vector; +import javax.xml.XMLConstants; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilderFactory; +import org.apache.ws.commons.schema.XmlSchemaCollection.SchemaKey; import org.apache.ws.commons.schema.constants.Constants; import org.apache.ws.commons.schema.utils.NodeNamespaceContext; +import org.apache.ws.commons.schema.utils.TargetNamespaceValidator; import org.apache.ws.commons.schema.utils.XDOMUtil; import org.w3c.dom.Attr; import org.w3c.dom.Document; @@ -41,16 +44,16 @@ Document doc; XmlSchema schema; XmlSchemaCollection collection; - +private final TargetNamespaceValidator validator; DocumentBuilderFactory docFac; -public static final String XMLNS_PREFIX = "xmlns"; /** * Schema builder constructor * @param collection */ -SchemaBuilder(XmlSchemaCollection collection) { +SchemaBuilder(XmlSchemaCollection collection, TargetNamespaceValidator validator) { this.collection = collection; +this.validator = validator; schema = new XmlSchema(collection); } @@ -75,14 +78,9 @@ schema.setNamespaceContext(new NodeNamespaceContext(schemaEl)); setNamespaceAttributes(schema, schemaEl); -if (uri != null) -collection.systemId2Schemas.put(uri, schema); - -collection.schemas.add(schema); - -// only populate it if it isn't already in there -if(!collection.namespaces.containsKey(schema.targetNamespace)){ -collection.namespaces.put(schema.targetNamespace, schema); +XmlSchemaCollection.SchemaKey schemaKey = new XmlSchemaCollection.SchemaKey(schema.logicalTargetNamespace, uri); +if (!collection.containsSchema(schemaKey)) { +collection.addSchema(schemaKey, schema); } schema.setElementFormDefault(this.getFormDefault(schemaEl, @@ -230,9 +228,9 @@ XmlSchemaRedefine redefine = new XmlSchemaRedefine(); redefine.schemaLocation = redefineEl.getAttribute("schemaLocation"); -//redefine has no such thing called a namespace! +final TargetNamespaceValidator validator = newIncludeValidator(schema); redefine.schema = -resolveXmlSchema(null,redefine.schemaLocation); +resolveXmlSchema(schema.logicalTargetNamespace, redefine.schemaLocation, validator); for (Element el = XDOMUtil.getFirstChildElementNS(redefineEl, XmlSchema.SCHEMA_NS) @@ -278,12 +276,13 @@ //no targetnamespace found ! if (schemaEl.getAttributeNode("targetNamespace") != null) { String contain = schemaEl.getAttribute("targetNamespace"); - -if (!contain.equals("")) -schema.targetNamespace = contain; +schema.setTargetNamespace(contain); } else { //do nothing here } +if (validator != null) { +validator.validate(schema); +} } /** @@ -504,7 +503,7 @@ if (offset == -1) { uri = pContext.getNamespaceURI(Constants.DEFAULT_NS_PREFIX)
[jira] Resolved: (WSCOMMONS-78) Including a schema without namespace into a schema with namespace is not possible
[ http://issues.apache.org/jira/browse/WSCOMMONS-78?page=all ] Davanum Srinivas resolved WSCOMMONS-78. --- Resolution: Fixed Applied as-is. looks good. thanks, dims > Including a schema without namespace into a schema with namespace is not > possible > - > > Key: WSCOMMONS-78 > URL: http://issues.apache.org/jira/browse/WSCOMMONS-78 > Project: WS-Commons > Issue Type: Bug > Components: XmlSchema >Reporter: Jochen Wiedmann > Attachments: XmlSchema-include-handling.patch, > XmlSchema-include-handling2.patch, XmlSchema-Include-Without-Namespace.patch > > > The XML Schema specification states in "4.2.1 Assembling a schema for a > single target namespace from multiple schema definition documents": > 2 One of the following must be true: > ... > 2.3 SII has no targetNamespace [attribute] (but SII' does). > 3 The appropriate case among the following must be true: > ... > 3.2 If clause 2.3 above is satisfied, then the schema corresponding to the > d item's parent must include not only definitions > or declarations corresponding to the appropriate members of its own > [children], but also components identical to all the - schema components- of > I, > except that anywhere the - absent- target namespace name would have > appeared, the - actual value- of the targetNamespace [attribute] of SII' is > used. > In particular, it replaces - absent- in the following places: > 3.2.1 The {target namespace} of named schema components, both at the top > level and (in the case of nested type definitions and nested attribute and > element declarations whose code was qualified) nested within definitions; > 3.2.2 The {namespace constraint} of a wildcard, whether negated or not; > In other words, it is possible to include a schema without namespace, as if > it had the namespace of the including schema. > Unfortunately this fails with XmlSchema, as the attached patch demonstrates. > The patch includes a simple test case and could be applied, if this bug is > fixed. > Suggested resolution, as realized in JaxMeXS: If such a schema is being > parsed, then mutable instances of QName should be created, which would always > return the target namespace of the schema. -- 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 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[jira] Created: (WSCOMMONS-84) Cannot serialize SOAP message (java.lang.RuntimeException: Can not serialize OM Element Envelope)
Cannot serialize SOAP message (java.lang.RuntimeException: Can not serialize OM Element Envelope) - Key: WSCOMMONS-84 URL: http://issues.apache.org/jira/browse/WSCOMMONS-84 Project: WS-Commons Issue Type: Bug Environment: Here is my environment == stax.api.version=1.0.1 stax.impl.artifactid=wstx stax.impl.groupid=woodstox stax.impl.version=asl-3.0.0 stax_utils.version=20060501 XmlSchema.version=SNAPSHOT JDK 1.5 (sun) , fc 5 (fedora) === Reporter: Rajith Attapattu Attachments: source.tar.gz I get the following exception when I try to print my SOAP message. I am wondering what is triggering this. I have attached my code sample as well, in case u wanna have a look at it. Exception in thread "main" java.lang.RuntimeException: Can not serialize OM Element Envelope [java] at org.apache.axiom.om.impl.llom.OMElementImpl.toString(OMElementImpl.java:893) [java] at java.lang.String.valueOf(String.java:2615) [java] at java.io.PrintStream.print(PrintStream.java:616) [java] at java.io.PrintStream.println(PrintStream.java:753) [java] at sample.enterprise.client.TravelAgenClient.main(TravelAgenClient.java:47) [java] Caused by: javax.xml.stream.XMLStreamException: Can not output XML declaration, after other output has already been done. [java] at com.ctc.wstx.sw.BaseStreamWriter.throwOutputError(BaseStreamWriter.java:1691) [java] at com.ctc.wstx.sw.BaseStreamWriter.reportNwfStructure(BaseStreamWriter.java:1720) [java] at com.ctc.wstx.sw.BaseStreamWriter.doWriteStartDocument(BaseStreamWriter.java:720) [java] at com.ctc.wstx.sw.BaseStreamWriter.writeStartDocument(BaseStreamWriter.java:708) [java] at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:173) [java] at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:748) [java] at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:763) [java] at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:748) [java] at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:763) [java] at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:748) [java] at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:763) [java] at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:748) [java] at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:763) [java] at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:177) [java] at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:748) [java] at org.apache.axiom.om.impl.llom.OMNodeImpl.serialize(OMNodeImpl.java:324) [java] at org.apache.axiom.om.impl.llom.OMNodeImpl.serialize(OMNodeImpl.java:362) [java] at org.apache.axiom.om.impl.llom.OMElementImpl.toString(OMElementImpl.java:891) -- 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 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r440405 - in /webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema: SchemaBuilder.java XmlSchemaCollection.java
Author: dims Date: Tue Sep 5 10:07:48 2006 New Revision: 440405 URL: http://svn.apache.org/viewvc?view=rev&rev=440405 Log: oops! XMLConstants again Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java?view=diff&rev=440405&r1=440404&r2=440405 == --- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java (original) +++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java Tue Sep 5 10:07:48 2006 @@ -22,7 +22,6 @@ import java.util.StringTokenizer; import java.util.Vector; -import javax.xml.XMLConstants; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilderFactory; @@ -1204,7 +1203,7 @@ private QName newLocalQName(String pLocalName) { String uri = schema.logicalTargetNamespace; if (uri == null) { -uri = XMLConstants.NULL_NS_URI; +uri = Constants.NULL_NS_URI; } return new QName(uri, pLocalName); } @@ -1370,7 +1369,7 @@ if (element.name != null) { final String name = element.name; -element.qualifiedName = (isQualified || isGlobal) ? newLocalQName(name) : new QName(XMLConstants.NULL_NS_URI, name); +element.qualifiedName = (isQualified || isGlobal) ? newLocalQName(name) : new QName(Constants.NULL_NS_URI, name); } Element annotationEl = @@ -1577,7 +1576,7 @@ TargetNamespaceValidator validator = new TargetNamespaceValidator(){ private boolean isEmpty(String pValue) { -return pValue == null || XMLConstants.NULL_NS_URI.equals(pValue); +return pValue == null || Constants.NULL_NS_URI.equals(pValue); } public void validate(XmlSchema pSchema) { final boolean valid; @@ -1663,7 +1662,7 @@ private TargetNamespaceValidator newIncludeValidator(final XmlSchema schema) { return new TargetNamespaceValidator(){ private boolean isEmpty(String pValue) { -return pValue == null || XMLConstants.NULL_NS_URI.equals(pValue); +return pValue == null || Constants.NULL_NS_URI.equals(pValue); } public void validate(XmlSchema pSchema) { if (isEmpty(pSchema.syntacticalTargetNamespace)) { @@ -1895,7 +1894,7 @@ if (namespaceURI!= null && !"".equals(namespaceURI) && //ignore unqualified attributes -!name.startsWith(XMLConstants.XMLNS_ATTRIBUTE) && //ignore namespaces +!name.startsWith(Constants.XMLNS_ATTRIBUTE) && //ignore namespaces !Constants.URI_2001_SCHEMA_XSD.equals(namespaceURI)){ attribMap.put(new QName(namespaceURI,name), attribute.getValue()); Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java?view=diff&rev=440405&r1=440404&r2=440405 == --- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java (original) +++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java Tue Sep 5 10:07:48 2006 @@ -25,7 +25,6 @@ import java.util.List; import java.util.Map; -import javax.xml.XMLConstants; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; @@ -53,7 +52,7 @@ private final String namespace; private final String systemId; SchemaKey(String pNamespace, String pSystemId) { -namespace = pNamespace == null ? XMLConstants.NULL_NS_URI : pNamespace; +namespace = pNamespace == null ? Constants.NULL_NS_URI : pNamespace; systemId = pSystemId == null ? "" : pSystemId; } String getNamespace() { return namespace; } @@ -73,7 +72,7 @@ return namespace.equals(other.namespace) && systemId.equals(other.systemId); } public String toString() { -return XMLConstants.NULL_NS_URI.equal
[XmlSchema] Error in building using maven2
Hi all, I'm getting the following error when trying to run mvn clean install in XmlSchema project. Any ideas? The plugin 'org.apache.maven.plugins:maven-antrun-plugin' does not exist or no valid version could be found -- Chinthaka signature.asc Description: OpenPGP digital signature
Re: [XmlSchema] Error in building using maven2
Hmm problem seems to be due to not mentioning the plugin version in the pom (http://www.mail-archive.com/users@maven.apache.org/msg50120.html). Fixing it. -- Chinthaka Eran Chinthaka wrote: > Hi all, > > I'm getting the following error when trying to run mvn clean install in > XmlSchema project. Any ideas? > > The plugin 'org.apache.maven.plugins:maven-antrun-plugin' does not exist > or no valid version could be found > > -- Chinthaka > signature.asc Description: OpenPGP digital signature
svn commit: r440619 - /webservices/commons/trunk/modules/XmlSchema/pom.xml
Author: chinthaka Date: Tue Sep 5 22:42:44 2006 New Revision: 440619 URL: http://svn.apache.org/viewvc?view=rev&rev=440619 Log: Fixing a problem in building XmlSchema Modified: webservices/commons/trunk/modules/XmlSchema/pom.xml Modified: webservices/commons/trunk/modules/XmlSchema/pom.xml URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/pom.xml?view=diff&rev=440619&r1=440618&r2=440619 == --- webservices/commons/trunk/modules/XmlSchema/pom.xml (original) +++ webservices/commons/trunk/modules/XmlSchema/pom.xml Tue Sep 5 22:42:44 2006 @@ -178,6 +178,7 @@ maven-antrun-plugin +1.1 prepareNistTest - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r440632 - in /webservices/commons/trunk/modules/axiom/modules: axiom-api/src/main/java/org/apache/axiom/om/ axiom-api/src/main/java/org/apache/axiom/om/impl/ axiom-tests/src/test/java/org/
Author: thilina Date: Tue Sep 5 23:38:54 2006 New Revision: 440632 URL: http://svn.apache.org/viewvc?view=rev&rev=440632 Log: preliminary support for SOAP With Attachments Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MIMEOutputUtils.java webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/MIMEOutputUtilsTest.java Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java?view=diff&rev=440632&r1=440631&r2=440632 == --- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java (original) +++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java Tue Sep 5 23:38:54 2006 @@ -64,10 +64,10 @@ } // MTOM is given priority if (isOptimized()) { -return this.getContentTypeForMime(SOAPContentType, MTOMConstants.MTOM_TYPE); +return this.getContentTypeForMTOM(SOAPContentType); } else if (isDoingSWA()) { - return this.getContentTypeForMime(SOAPContentType, MTOMConstants.SWA_TYPE); + return this.getContentTypeForSwA(SOAPContentType); } else { return SOAPContentType; @@ -152,18 +152,31 @@ this.doingSWA = doingSWA; } - public String getContentTypeForMime(String SOAPContentType, String type) { + public String getContentTypeForMTOM(String SOAPContentType) { StringBuffer sb = new StringBuffer(); sb.append("multipart/related"); sb.append("; "); sb.append("boundary="); sb.append(getMimeBoundary()); sb.append("; "); - sb.append("type=\""+type+"\""); + sb.append("type=\""+MTOMConstants.MTOM_TYPE+"\""); sb.append("; "); sb.append("start=\"<" + getRootContentId() + ">\""); sb.append("; "); sb.append("start-info=\""+SOAPContentType+"\""); + return sb.toString(); + } + + public String getContentTypeForSwA(String SOAPContentType) { + StringBuffer sb = new StringBuffer(); + sb.append("multipart/related"); + sb.append("; "); + sb.append("boundary="); + sb.append(getMimeBoundary()); + sb.append("; "); + sb.append("type=\""+MTOMConstants.SWA_TYPE+"\""); + sb.append("; "); + sb.append("start=\"<" + getRootContentId() + ">\""); return sb.toString(); } } Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MIMEOutputUtils.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MIMEOutputUtils.java?view=diff&rev=440632&r1=440631&r2=440632 == --- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MIMEOutputUtils.java (original) +++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MIMEOutputUtils.java Tue Sep 5 23:38:54 2006 @@ -16,25 +16,24 @@ package org.apache.axiom.om.impl; -import org.apache.axiom.om.OMElement; -import org.apache.axiom.om.OMException; -import org.apache.axiom.om.OMOutputFormat; -import org.apache.axiom.om.OMText; -import org.apache.axiom.soap.SOAP11Constants; -import org.apache.axiom.soap.SOAP12Constants; - -import javax.activation.DataHandler; -import javax.mail.MessagingException; -import javax.mail.internet.MimeBodyPart; -import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.StringWriter; -import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.Map; +import javax.activation.DataHandler; +import javax.mail.MessagingException; +import javax.mail.internet.MimeBodyPart; + +import org.apache.axiom.om.OMConstants; +import org.apache.axiom.om.OMException; +import org.apache.axiom.om.OMOutputFormat; +import org.apache.axiom.om.OMText; +import org.apache.axiom.soap.SOAP11Constants; +import org.apache.axiom.soap.SOAP12Constants; + public class MIMEOutputUtils { private static byte[] CRLF = { 13, 10 }; @@ -60,24 +59,24 @@ Iterator binaryNodeIterator = binaryNodeList.iterator(); while (binaryNodeIte
[jira] Resolved: (WSCOMMONS-74) Incorrect namespace serialization
[ http://issues.apache.org/jira/browse/WSCOMMONS-74?page=all ] Eran Chinthaka resolved WSCOMMONS-74. - Resolution: Fixed Assignee: Eran Chinthaka (was: Rich Scheuerle) Fixed in current in svn. Added Ruchith's initial tests and they are successful as well. > Incorrect namespace serialization > - > > Key: WSCOMMONS-74 > URL: http://issues.apache.org/jira/browse/WSCOMMONS-74 > Project: WS-Commons > Issue Type: Bug > Components: AXIOM >Reporter: Ruchith Udayanga Fernando > Assigned To: Eran Chinthaka >Priority: Blocker > Attachments: axiom_api_patch.txt, axiom_impl_patch.txt, > axiom_test_patch.txt, jaxsw_test_patch.txt, SerializationTest.java > > > Hi All, > I noticed that axiom doesn't serialize namespaces correctly. > 1.) Namespaces in qualified elements > For example we should be able to produce the following xml with the code that > follows: > http://ws.apache.org/axis2/apacheconasia/06";> > John > John12 > 34 > > OMFactory fac = OMAbstractFactory.getOMFactory(); > > OMNamespace ns = > fac.createOMNamespace("http://ws.apache.org/axis2/apacheconasia/06";, ""); > OMElement personElem = fac.createOMElement("person", ns); > OMElement nameElem = fac.createOMElement("name", ns); > nameElem.setText("John"); > > OMElement ageElem = fac.createOMElement("age", ns); > ageElem.setText("34"); > > OMElement weightElem = fac.createOMElement("weight", ns); > weightElem.setText("50"); > > > //Add children to the person element > personElem.addChild(nameElem); > personElem.addChild(ageElem); > personElem.addChild(weightElem); > > String xml = personElem.toString(); > But right now this produces the following : > http://ws.apache.org/axis2/apacheconasia/06";> xmlns="http://ws.apache.org/axis2/apacheconasia/06";>John xmlns="http://ws.apache.org/axis2/apacheconasia/06";>34 xmlns="http://ws.apache.org/axis2/apacheconasia/06";>50 > The repetition of the default namespace should be avoided. > This is the same even if we used a prefixed namespace. > 2.) Unqualified elements among qualified elements > > OMFactory fac = OMAbstractFactory.getOMFactory(); > OMNamespace ns = > fac.createOMNamespace("http://ws.apache.org/axis2/apacheconasia/06";, ""); > OMElement personElem = fac.createOMElement("person", ns); > //Create and add an unqualified element > OMElement nameElem = fac.createOMElement("name", null); > nameElem.setText("John"); > personElem.addChild(nameElem); > OMElement ageElem = fac.createOMElement("age", ns); > ageElem.setText("34"); > > OMElement weightElem = fac.createOMElement("weight", ns); > weightElem.setText("50"); > personElem.addChild(ageElem); > personElem.addChild(weightElem); > System.out.println(personElem); > The above should produce the following : > http://ws.apache.org/axis2/apacheconasia/06";> xmlns="">John3450 > But AXIOM right now produces : > xmlns="http://ws.apache.org/axis2/apacheconasia/06";>John xmlns="http://ws.apache.org/axis2/apacheconasia/06";>34 xmlns="http://ws.apache.org/axis2/apacheconasia/06";>50 > What do u folks think? > Thanks, > Ruchith > p.s. Added a test case -- 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 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]