I've done some more testing. It seems like restrictions on strings that use
enumerations are preserved but that's really the only kind of "strict"
typing that seems to be preserved when querying the WSDL in runtime. Also,
the documentation is lost.
Using this type definition
<simpleType name="PositionType">
<annotation>
<documentation>
L = Long (Innehavd/inlånad)
S = Short (Utfärdad/utlånad)
</documentation>
</annotation>
<restriction base="string">
<enumeration value="L" />
<enumeration value="S" />
</restriction>
</simpleType>
The enumeration is preserved but the documentation is lost. The below will
simply be transformed to a "xs:string" in the runtime wsdl - no length
information is preserved:
<simpleType name="SecurityId">
<restriction base="string">
<minLength value="0"></minLength>
<maxLength value="12"></maxLength>
</restriction>
</simpleType>
The below will be transformed to a "xs:decimal" without information about no
of digits and decimals:
<simpleType name="SecurityCount">
<restriction base="decimal">
<totalDigits value="19" />
<fractionDigits value="6" />
</restriction>
</simpleType>
The following will be transformed into a "xs:int" without information about
maximum no of digits:
<simpleType name="AccountId">
<restriction base="nonNegativeInteger">
<maxInclusive value="99999999" />
</restriction>
</simpleType>
I think this is serious. Ideally CXF should return the wsdl I started out
with but containing the correct runtime bindings regarding e g address and
port. It seems to me that CXF extracts the information that it needs for
itself and excludes the rest. But the wsdl query's purpose is not for the
CXF server but for the clients. Clients could be implemented using any
technique which is why all available metadata should be provided. Also, wsdl
is a perfect place for documentation but it's all removed. I don't really
understand why CXF doesn't answer with the original wsdl when "wsdl first"
is used.
/Bengt
2011/10/3 Bengt Rodehav <[email protected]>
> I don't promise anything since we're pretty much under pressure here (as
> always I guess). But I'll try,
>
> /Bengt
>
>
> 2011/10/3 Daniel Kulp <[email protected]>
>
>>
>> Any chance you could file a test case? We do have some tests to make
>> sure
>> the annotations and stuff are preserved. However, they may be for
>> external
>> xsd's, not schemas embedded in the wsdl. I'd have to dig in more to
>> check
>> that, but a test case would be great.
>>
>> Dan
>>
>>
>> On Saturday, October 01, 2011 10:08:42 AM Bengt Rodehav wrote:
>> > Hello,
>> >
>> > We're using CXF 2.4.2 to provide a web service API to a legacy
>> application.
>> > We are in the process of increasing the quality of the API in a number
>> of
>> > ways.
>> >
>> > First, we are typing the interface more strictly. E g instead of
>> specifying
>> > that a value is a string, we say that it's exactly one character long
>> and
>> > also enumerate it's valid values. We also try to add documentation to
>> the
>> > WSDL. The following is a typical case:
>> >
>> > <xs:simpleType name="MyType">
>> > <xs:annotation>
>> > <xs:documentation>
>> > A = ...
>> > B = ...
>> > C = ...
>> > </xs:documentation>
>> > </xs:annotation>
>> > <xs:restriction base="xs:string">
>> > <xs:pattern value="A|B|C" />
>> > </xs:restriction>
>> > </xs:simpleType>
>> >
>> > However, even if we feed the above WSDL to CXF (we use WSDL first), in
>> > runtime when asking for the WSDL (using ...?wsdl), the above information
>> is
>> > gone. The type is simply a string and the documentation is gone.
>> >
>> > Why is this? Is it a bug? What is best practice regarding strict
>> interfaces
>> > and documentation using CXF?
>> >
>> > /Bengt
>> --
>> Daniel Kulp
>> [email protected]
>> http://dankulp.com/blog
>> Talend - http://www.talend.com
>>
>
>