You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/02/18 18:06:18 UTC
[jira] [Commented] (CXF-6783) ReflectionServiceFactoryBean
generates invalid WSDL if anonymousWrapperTypes==true
[ https://issues.apache.org/jira/browse/CXF-6783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15152617#comment-15152617 ]
ASF GitHub Bot commented on CXF-6783:
-------------------------------------
GitHub user bbodnar opened a pull request:
https://github.com/apache/cxf/pull/109
[CXF-6783], WSDL-generation: don't create anonymous top-level types
This commit fixes https://issues.apache.org/jira/browse/CXF-6783.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/bbodnar/cxf 3.1.x-fixes
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/cxf/pull/109.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #109
----
commit a8a265f2ee437cc7e9f8bf222486f9563f19d785
Author: Barnabas Bodnar <ba...@ser.de>
Date: 2016-02-18T16:52:15Z
[CXF-6783], WSDL-generation: don't create anonymous top-level types
----
> ReflectionServiceFactoryBean generates invalid WSDL if anonymousWrapperTypes==true
> ----------------------------------------------------------------------------------
>
> Key: CXF-6783
> URL: https://issues.apache.org/jira/browse/CXF-6783
> Project: CXF
> Issue Type: Bug
> Components: Services
> Affects Versions: 3.1.5
> Reporter: Barnabas Bodnar
> Priority: Minor
>
> ReflectionServiceFactoryBean has the public property _anonymousWrapperTypes_ controlling whether the type (XSD) of a message is represented as standalone, named type in the WSDL, or an anonymous, inline type (the default is _false_ -> standalone, named). Setting it to _true_ effectuates producing the inline, anonymous type, but this is, however, present also on top-level, as standalone one, making the WSDL invalid (top-level types must have a name):
> {code:xml}
> <wsdl:definitions>
> <wsdl:types>
> <xsd:schema>
> <xsd:element name="m">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="x" type="xsd:int"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="x" type="xsd:int"/>
> </xsd:sequence>
> </xsd:complexType>
> ...
> </xsd:schema>
> ...
> </wsdl:types>
> ...
> <wsdl:definitions>
> {code}
> Correctly:
> {code:xml}
> <wsdl:definitions>
> <wsdl:types>
> <xsd:schema>
> <xsd:element name="m">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="x" type="xsd:int"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> ...
> </xsd:schema>
> ...
> </wsdl:types>
> ...
> <wsdl:definitions>
> {code}
> Fix-proposal: use *new XmlSchemaComplexType(schema, !isAnonymousWrapperTypes())* in the line 1300 instead of *new XmlSchemaComplexType(schema, true)*.
> {code:title=rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/ReflectionServiceFactoryBean.java|borderStyle=solid}
> 1289 private void createWrappedMessageSchema(ServiceInfo serviceInfo, AbstractMessageContainer wrappedMessage,
> 1290 AbstractMessageContainer unwrappedMessage, SchemaInfo info,
> 1291 QName wrapperName) {
> 1292
> 1293 XmlSchema schema = info.getSchema();
> 1294 info.setElement(null); // the cached schema will be no good
> 1295 XmlSchemaElement el = new XmlSchemaElement(schema, true);
> 1296 el.setName(wrapperName.getLocalPart());
> 1297
> 1298 wrappedMessage.getFirstMessagePart().setXmlSchema(el);
> 1299
> 1300 XmlSchemaComplexType ct = new XmlSchemaComplexType(schema, true);
> 1301
> 1302 if (!isAnonymousWrapperTypes()) {
> 1303 ct.setName(wrapperName.getLocalPart());
> 1304 el.setSchemaTypeName(wrapperName);
> 1305 }
> 1306 el.setSchemaType(ct);
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)