cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-6783) ReflectionServiceFactoryBean generates invalid WSDL if anonymousWrapperTypes==true
Date Thu, 18 Feb 2016 17:09:18 GMT

    [ https://issues.apache.org/jira/browse/CXF-6783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15152621#comment-15152621
] 

ASF GitHub Bot commented on CXF-6783:
-------------------------------------

GitHub user bbodnar opened a pull request:

    https://github.com/apache/cxf/pull/110

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

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cxf/pull/110.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 #110
    
----

----


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

Mime
View raw message