You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chemistry.apache.org by Dalibor Jacko2 <Da...@sk.ibm.com> on 2017/04/05 12:58:32 UTC

ref element not allowed

Hi,

I think I have found a bug. I'm using apache-cxf and cannot use query
operation from generated class DiscoveryServicePort
( chemistry-opencmis-commons-impl-0.10.0.jar ). I have found workaround.

It is necessary to edit file directly in library distribution
chemistry-opencmis-commons-impl-0.10.0.jar\wsdl\cmis11\CMIS-Messaging.xsd
under xml node
<xs:element name="query">
remove <xs:attributeGroup ref="cmis:cmisUndefinedAttribute" /> line 1756


Let me explain how this workaround works.
DiscoveryServicePort contain query method with 9 parameters. This mean that
it is expected WRAPPED style. According to JAX-WS specification it is not
allowed to use "ref" attribute when you want to use Wrapper soap style.
Since 'ref' attribute is presented apache-cxf believe that query method
will have only one parameter (NON-WRAPPED style) and failed to map values
to parameters.


According to DiscoveryServicePort interface included in library
distribution you are expected Wrapped style.
chemistry-opencmis-commons-impl-0.10.0.jar
\org.apache.chemistry.opencmis.commons.impl.jaxb.DiscoveryServicePort query
method have nine 'in' parameters

public interface DiscoveryServicePort {
@WebMethod(action = "query")
@WebResult(name = "objects", targetNamespace = "
http://docs.oasis-open.org/ns/cmis/messaging/200908/")
@RequestWrapper(localName = "query", targetNamespace = "
http://docs.oasis-open.org/ns/cmis/messaging/200908/", className =
"org.apache.chemistry.opencmis.commons.impl.jaxb.Query")
@ResponseWrapper(localName = "queryResponse", targetNamespace = "
http://docs.oasis-open.org/ns/cmis/messaging/200908/", className =
"org.apache.chemistry.opencmis.commons.impl.jaxb.QueryResponse")
public CmisObjectListType query(
    @WebParam(name = "repositoryId", targetNamespace = "
http://docs.oasis-open.org/ns/cmis/messaging/200908/")
    String repositoryId,
    @WebParam(name = "statement", targetNamespace = "
http://docs.oasis-open.org/ns/cmis/messaging/200908/")
    String statement,
    @WebParam(name = "searchAllVersions", targetNamespace = "
http://docs.oasis-open.org/ns/cmis/messaging/200908/")
    Boolean searchAllVersions,
    @WebParam(name = "includeAllowableActions", targetNamespace = "
http://docs.oasis-open.org/ns/cmis/messaging/200908/")
    Boolean includeAllowableActions,
    @WebParam(name = "includeRelationships", targetNamespace = "
http://docs.oasis-open.org/ns/cmis/messaging/200908/")
    EnumIncludeRelationships includeRelationships,
    @WebParam(name = "renditionFilter", targetNamespace = "
http://docs.oasis-open.org/ns/cmis/messaging/200908/")
    String renditionFilter,
    @WebParam(name = "maxItems", targetNamespace = "
http://docs.oasis-open.org/ns/cmis/messaging/200908/")
    BigInteger maxItems,
    @WebParam(name = "skipCount", targetNamespace = "
http://docs.oasis-open.org/ns/cmis/messaging/200908/")
    BigInteger skipCount,
    @WebParam(name = "extension", targetNamespace = "
http://docs.oasis-open.org/ns/cmis/messaging/200908/")
    CmisExtensionType extension)
    throws CmisException
;

Since there is not allowed 'ref' attribute Apache-cxf will try to handle
'soap message marshaling' with non-wrapped style (BARE style) only one 'in'
parameter

public interface DiscoveryServicePort {
@WebMethod(action = "query")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
@WebResult(name = "queryResponse", targetNamespace = "
http://docs.oasis-open.org/ns/cmis/messaging/200908/", partName =
"parameters")
public org.oasis_open.docs.ns.cmis.messaging._200908.QueryResponse query(
    @WebParam(partName = "parameters", name = "query", targetNamespace = "
http://docs.oasis-open.org/ns/cmis/messaging/200908/")
    org.oasis_open.docs.ns.cmis.messaging._200908.Query parameters
) throws CmisException;




---------------------------------------------------------------------------------------------

I'm attaching few more information directly from JAX-WS specification :
http://download.oracle.com/otn-pub/jcp/jaxws-2.2-mrel3-evalu-oth-JSpec/jaxws-2_2-mrel3-spec.pdf?AuthParam=1491387529_7c735ef7094195c9f9bd00699bd49534


page 14
2.3.1.2 Wrapper Style
A WSDL operation qualifies for wrapper style mapping only if the following
criteria are met:
(i) The operation’s input and output messages (if present) each contain
only a single part
(ii) The input message part refers to a global element declaration whose
localname is equal to the operation
name
(iii) The output message (if present) part refers to a global element
declaration
(iv) The elements referred to by the input and output message (if present)
parts (henceforth referred to as
wrapper elements) are both complex types defined using the xsd:sequence
compositor
(v) The wrapper elements only contain child elements, they MUST not contain
other structures such
as wildcards (element or attribute), xsd:choice, substitution groups (

ELEMENT REFERENCES ARE NOT PERMITTED

 )
 or attributes; furthermore, they MUST not be nillable.
♦ Conformance (Default mapping mode): Operations that do not meet the
criteria above MUST be mapped
using non-wrapper style.

---------------------------------------------------------------------------------------------

chemistry-opencmis-commons-impl-0.10.0.jar\wsdl\CMIS-Messaging.xsd

<xs:element name="query">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="repositoryId" type="xs:string"
                    minOccurs="1" maxOccurs="1" />
                <xs:element name="statement" type="xs:string" minOccurs="1"
                    maxOccurs="1" />
                <xs:element name="searchAllVersions" type="xs:boolean"
                    minOccurs="0" maxOccurs="1" nillable="true" />
                <xs:element name="includeAllowableActions"
type="xs:boolean"
                    minOccurs="0" maxOccurs="1" nillable="true" />
                <xs:element name="includeRelationships"
type="cmis:enumIncludeRelationships"
                    minOccurs="0" maxOccurs="1" nillable="true" />
                <xs:element name="renditionFilter" type="xs:string"
                    minOccurs="0" maxOccurs="1" nillable="true" />
                <xs:element name="maxItems" type="xs:integer" minOccurs="0"
                    maxOccurs="1" nillable="true" />
                <xs:element name="skipCount" type="xs:integer"
minOccurs="0"
                    maxOccurs="1" nillable="true" />
                <xs:element name="extension" type="cmism:cmisExtensionType"
                    minOccurs="0" maxOccurs="1" nillable="true">
                    <xs:annotation>
                        <xs:documentation>
                            This is an extension element to hold any
                            repository or
                            vendor-specific extensions
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
            </xs:sequence>
       <!--     <xs:attributeGroup ref="cmis:cmisUndefinedAttribute" />
----------------------   not allowed with WRAPPING style-->
        </xs:complexType>
    </xs:element>

Regards

Dalibor Jacko 	 Slovakia
IBM Slovakia
e-mail: 	dalibor.jacko2@sk.ibm.com


Re: ref element not allowed

Posted by Florian Müller <fm...@apache.org>.
Hi Dalibor,

OpenCMIS 0.10.0 is way out of date (-> 2013). We are just releasing 
OpenCMIS 1.1.0.
OpenCMIS uses CXF internally since the 0.14.0 release.

Please update and try again.


- Florian



> Hi,
> 
> I think I have found a bug. I'm using apache-cxf and cannot use query
> operation from generated class DiscoveryServicePort
> ( chemistry-opencmis-commons-impl-0.10.0.jar ). I have found 
> workaround.
> 
> It is necessary to edit file directly in library distribution
> chemistry-opencmis-commons-impl-0.10.0.jar\wsdl\cmis11\CMIS-Messaging.xsd
> under xml node
> <xs:element name="query">
> remove <xs:attributeGroup ref="cmis:cmisUndefinedAttribute" /> line 
> 1756
> 
> 
> Let me explain how this workaround works.
> DiscoveryServicePort contain query method with 9 parameters. This mean 
> that
> it is expected WRAPPED style. According to JAX-WS specification it is 
> not
> allowed to use "ref" attribute when you want to use Wrapper soap style.
> Since 'ref' attribute is presented apache-cxf believe that query method
> will have only one parameter (NON-WRAPPED style) and failed to map 
> values
> to parameters.
> 
> 
> According to DiscoveryServicePort interface included in library
> distribution you are expected Wrapped style.
> chemistry-opencmis-commons-impl-0.10.0.jar
> \org.apache.chemistry.opencmis.commons.impl.jaxb.DiscoveryServicePort 
> query
> method have nine 'in' parameters
> 
> public interface DiscoveryServicePort {
> @WebMethod(action = "query")
> @WebResult(name = "objects", targetNamespace = "
> http://docs.oasis-open.org/ns/cmis/messaging/200908/")
> @RequestWrapper(localName = "query", targetNamespace = "
> http://docs.oasis-open.org/ns/cmis/messaging/200908/", className =
> "org.apache.chemistry.opencmis.commons.impl.jaxb.Query")
> @ResponseWrapper(localName = "queryResponse", targetNamespace = "
> http://docs.oasis-open.org/ns/cmis/messaging/200908/", className =
> "org.apache.chemistry.opencmis.commons.impl.jaxb.QueryResponse")
> public CmisObjectListType query(
>     @WebParam(name = "repositoryId", targetNamespace = "
> http://docs.oasis-open.org/ns/cmis/messaging/200908/")
>     String repositoryId,
>     @WebParam(name = "statement", targetNamespace = "
> http://docs.oasis-open.org/ns/cmis/messaging/200908/")
>     String statement,
>     @WebParam(name = "searchAllVersions", targetNamespace = "
> http://docs.oasis-open.org/ns/cmis/messaging/200908/")
>     Boolean searchAllVersions,
>     @WebParam(name = "includeAllowableActions", targetNamespace = "
> http://docs.oasis-open.org/ns/cmis/messaging/200908/")
>     Boolean includeAllowableActions,
>     @WebParam(name = "includeRelationships", targetNamespace = "
> http://docs.oasis-open.org/ns/cmis/messaging/200908/")
>     EnumIncludeRelationships includeRelationships,
>     @WebParam(name = "renditionFilter", targetNamespace = "
> http://docs.oasis-open.org/ns/cmis/messaging/200908/")
>     String renditionFilter,
>     @WebParam(name = "maxItems", targetNamespace = "
> http://docs.oasis-open.org/ns/cmis/messaging/200908/")
>     BigInteger maxItems,
>     @WebParam(name = "skipCount", targetNamespace = "
> http://docs.oasis-open.org/ns/cmis/messaging/200908/")
>     BigInteger skipCount,
>     @WebParam(name = "extension", targetNamespace = "
> http://docs.oasis-open.org/ns/cmis/messaging/200908/")
>     CmisExtensionType extension)
>     throws CmisException
> ;
> 
> Since there is not allowed 'ref' attribute Apache-cxf will try to 
> handle
> 'soap message marshaling' with non-wrapped style (BARE style) only one 
> 'in'
> parameter
> 
> public interface DiscoveryServicePort {
> @WebMethod(action = "query")
> @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
> @WebResult(name = "queryResponse", targetNamespace = "
> http://docs.oasis-open.org/ns/cmis/messaging/200908/", partName =
> "parameters")
> public org.oasis_open.docs.ns.cmis.messaging._200908.QueryResponse 
> query(
>     @WebParam(partName = "parameters", name = "query", targetNamespace 
> = "
> http://docs.oasis-open.org/ns/cmis/messaging/200908/")
>     org.oasis_open.docs.ns.cmis.messaging._200908.Query parameters
> ) throws CmisException;
> 
> 
> 
> 
> ---------------------------------------------------------------------------------------------
> 
> I'm attaching few more information directly from JAX-WS specification :
> http://download.oracle.com/otn-pub/jcp/jaxws-2.2-mrel3-evalu-oth-JSpec/jaxws-2_2-mrel3-spec.pdf?AuthParam=1491387529_7c735ef7094195c9f9bd00699bd49534
> 
> 
> page 14
> 2.3.1.2 Wrapper Style
> A WSDL operation qualifies for wrapper style mapping only if the 
> following
> criteria are met:
> (i) The operation\u2019s input and output messages (if present) each contain
> only a single part
> (ii) The input message part refers to a global element declaration 
> whose
> localname is equal to the operation
> name
> (iii) The output message (if present) part refers to a global element
> declaration
> (iv) The elements referred to by the input and output message (if 
> present)
> parts (henceforth referred to as
> wrapper elements) are both complex types defined using the xsd:sequence
> compositor
> (v) The wrapper elements only contain child elements, they MUST not 
> contain
> other structures such
> as wildcards (element or attribute), xsd:choice, substitution groups (
> 
> ELEMENT REFERENCES ARE NOT PERMITTED
> 
>  )
>  or attributes; furthermore, they MUST not be nillable.
> \u2666 Conformance (Default mapping mode): Operations that do not meet the
> criteria above MUST be mapped
> using non-wrapper style.
> 
> ---------------------------------------------------------------------------------------------
> 
> chemistry-opencmis-commons-impl-0.10.0.jar\wsdl\CMIS-Messaging.xsd
> 
> <xs:element name="query">
>         <xs:complexType>
>             <xs:sequence>
>                 <xs:element name="repositoryId" type="xs:string"
>                     minOccurs="1" maxOccurs="1" />
>                 <xs:element name="statement" type="xs:string" 
> minOccurs="1"
>                     maxOccurs="1" />
>                 <xs:element name="searchAllVersions" type="xs:boolean"
>                     minOccurs="0" maxOccurs="1" nillable="true" />
>                 <xs:element name="includeAllowableActions"
> type="xs:boolean"
>                     minOccurs="0" maxOccurs="1" nillable="true" />
>                 <xs:element name="includeRelationships"
> type="cmis:enumIncludeRelationships"
>                     minOccurs="0" maxOccurs="1" nillable="true" />
>                 <xs:element name="renditionFilter" type="xs:string"
>                     minOccurs="0" maxOccurs="1" nillable="true" />
>                 <xs:element name="maxItems" type="xs:integer" 
> minOccurs="0"
>                     maxOccurs="1" nillable="true" />
>                 <xs:element name="skipCount" type="xs:integer"
> minOccurs="0"
>                     maxOccurs="1" nillable="true" />
>                 <xs:element name="extension" 
> type="cmism:cmisExtensionType"
>                     minOccurs="0" maxOccurs="1" nillable="true">
>                     <xs:annotation>
>                         <xs:documentation>
>                             This is an extension element to hold any
>                             repository or
>                             vendor-specific extensions
>                         </xs:documentation>
>                     </xs:annotation>
>                 </xs:element>
>             </xs:sequence>
>        <!--     <xs:attributeGroup ref="cmis:cmisUndefinedAttribute" />
> ----------------------   not allowed with WRAPPING style-->
>         </xs:complexType>
>     </xs:element>
> 
> Regards
> 
> Dalibor Jacko 	 Slovakia
> IBM Slovakia
> e-mail: 	dalibor.jacko2@sk.ibm.com