users@jax-rpc.java.net

[BUG?] weird handling of "fixed" token in wsdl

From: Alessio Cervellin <alessio.cervellin_at_sun-cs-italy.com>
Date: Wed, 2 Mar 2005 14:51:55 +0100 (CET)

According to the XMLSchema Reccomendation from W3C:

"The fixed attribute is used in both attribute and element declarations to ensure that the attributes and elements are set to particular values..." [1]

Well, I tried to specify the "fixed" attribute for an ELEMENT in a WSDL:

      <xsd:element name="AnElement" fixed="Test">
        <xsd:complexType>
          <xsd:simpleContent>
            <xsd:extension base="xsd:string">
              <xsd:attribute name="anAttribute" type="xsd:string" use="required"/>
            </xsd:extension>
          </xsd:simpleContent>
        </xsd:complexType>

but wscompile (-gen:client -f:wsi) raises a NullPointerException with the stacktrace in [2]

Also, I tried to specify the "fixed" attribute for an ATTRIBUTE:

      <xsd:element name="AnElement">
        <xsd:complexType>
          <xsd:simpleContent>
            <xsd:extension base="xsd:string">
              <xsd:attribute name="anAttribute" type="xsd:string" use="required" fixed="Foo"/>
            </xsd:extension>
          </xsd:simpleContent>
        </xsd:complexType>

and the wscompile (-gen:client -f:wsi) works fine, but the generated artifcats seem to ignore the restriction for the fixed value, I mean that from the generated client I can set ANY value for "anAttribute" (I's expect I could set onl the value "Foo" for this attribute).

Are these bugs or am I using the wrong approach to solve my problem?
(what I need is to set, from WSDL, a fixed value both for an element and an attribute)

I can't post the full WSDL...

[1] http://www.w3.org/TR/xmlschema-0/#po.xsd
[2] java.lang.NullPointerException
        at com.sun.xml.rpc.processor.schema.InternalSchemaBuilderBase.internalBu
ildElementDeclaration(InternalSchemaBuilderBase.java:461)
        at com.sun.xml.rpc.processor.schema.InternalSchemaBuilderBase.buildTopLe
velElementDeclaration(InternalSchemaBuilderBase.java:176)
        at com.sun.xml.rpc.processor.schema.InternalSchemaBuilderBase.buildEleme
ntDeclaration(InternalSchemaBuilderBase.java:125)
        at com.sun.xml.rpc.processor.schema.InternalSchema.findElementDeclaratio
n(InternalSchema.java:92)
        at com.sun.xml.rpc.processor.schema.InternalSchemaBuilderBase.processEle
mentParticle(InternalSchemaBuilderBase.java:345)
        at com.sun.xml.rpc.processor.schema.InternalSchemaBuilderBase.buildParti
cle(InternalSchemaBuilderBase.java:1469)
        at com.sun.xml.rpc.processor.schema.InternalSchemaBuilderBase.buildModel
Group(InternalSchemaBuilderBase.java:1509)
        at com.sun.xml.rpc.processor.schema.InternalSchemaBuilderBase.buildParti
cle(InternalSchemaBuilderBase.java:1475)
        at com.sun.xml.rpc.processor.schema.InternalSchemaBuilderBase.processRes
trictionComplexTypeDefinition(InternalSchemaBuilderBase.java:1218)
        at com.sun.xml.rpc.processor.schema.InternalSchemaBuilderBase.buildImpli
citComplexContentComplexTypeDefinition(InternalSchemaBuilderBase.java:1159)
        at com.sun.xml.rpc.processor.schema.InternalSchemaBuilderBase.buildCompl
exTypeDefinition(InternalSchemaBuilderBase.java:832)
        at com.sun.xml.rpc.processor.schema.InternalSchemaBuilderBase.internalBu
ildElementDeclaration(InternalSchemaBuilderBase.java:401)
        at com.sun.xml.rpc.processor.schema.InternalSchemaBuilderBase.buildTopLe
velElementDeclaration(InternalSchemaBuilderBase.java:176)
        at com.sun.xml.rpc.processor.schema.InternalSchemaBuilderBase.buildEleme
ntDeclaration(InternalSchemaBuilderBase.java:125)
        at com.sun.xml.rpc.processor.schema.InternalSchema.findElementDeclaratio
n(InternalSchema.java:92)
        at com.sun.xml.rpc.processor.schema.InternalSchemaBuilderBase.processEle
mentParticle(InternalSchemaBuilderBase.java:345)
        at com.sun.xml.rpc.processor.schema.InternalSchemaBuilderBase.buildParti
cle(InternalSchemaBuilderBase.java:1469)
        at com.sun.xml.rpc.processor.schema.InternalSchemaBuilderBase.buildModel
Group(InternalSchemaBuilderBase.java:1509)
        at com.sun.xml.rpc.processor.schema.InternalSchemaBuilderBase.buildParti
cle(InternalSchemaBuilderBase.java:1475)
        at com.sun.xml.rpc.processor.schema.InternalSchemaBuilderBase.processRes
trictionComplexTypeDefinition(InternalSchemaBuilderBase.java:1218)
        at com.sun.xml.rpc.processor.schema.InternalSchemaBuilderBase.buildImpli
citComplexContentComplexTypeDefinition(InternalSchemaBuilderBase.java:1159)
        at com.sun.xml.rpc.processor.schema.InternalSchemaBuilderBase.buildCompl
exTypeDefinition(InternalSchemaBuilderBase.java:832)
        at com.sun.xml.rpc.processor.schema.InternalSchemaBuilderBase.internalBu
ildElementDeclaration(InternalSchemaBuilderBase.java:401)
        at com.sun.xml.rpc.processor.schema.InternalSchemaBuilderBase.buildTopLe
velElementDeclaration(InternalSchemaBuilderBase.java:176)
        at com.sun.xml.rpc.processor.schema.InternalSchemaBuilderBase.buildEleme
ntDeclaration(InternalSchemaBuilderBase.java:125)
        at com.sun.xml.rpc.processor.schema.InternalSchema.findElementDeclaratio
n(InternalSchema.java:92)
        at com.sun.xml.rpc.processor.modeler.wsdl.SchemaAnalyzerBase.schemaEleme
ntTypeToLiteralType(SchemaAnalyzerBase.java:206)
        at com.sun.xml.rpc.processor.modeler.wsdl.WSDLModelerBase.getElementType
ToLiteralType(WSDLModelerBase.java:5465)
        at com.sun.xml.rpc.processor.modeler.wsdl.WSDLModelerBase.handleLiteralS
OAPFault(WSDLModelerBase.java:2900)
        at com.sun.xml.rpc.processor.modeler.wsdl.WSDLModelerBase.processSOAPOpe
rationDocumentLiteralStyle(WSDLModelerBase.java:4058)
        at com.sun.xml.rpc.processor.modeler.wsdl.WSDLModelerBase.processSOAPOpe
ration(WSDLModelerBase.java:909)
        at com.sun.xml.rpc.processor.modeler.wsdl.WSDLModelerBase.processPort(WS
DLModelerBase.java:763)
        at com.sun.xml.rpc.processor.modeler.wsdl.WSDLModelerBase.processService
(WSDLModelerBase.java:519)
        at com.sun.xml.rpc.processor.modeler.wsdl.WSDLModelerBase.internalBuildM
odel(WSDLModelerBase.java:354)
        at com.sun.xml.rpc.processor.modeler.wsdl.WSDLModelerBase.buildModel(WSD
LModelerBase.java:238)
        at com.sun.xml.rpc.processor.config.ModelInfo.buildModel(ModelInfo.java:
88)
        at com.sun.xml.rpc.processor.Processor.runModeler(Processor.java:63)
        at com.sun.xml.rpc.tools.wscompile.CompileTool.run(CompileTool.java:714)

        at com.sun.xml.rpc.util.ToolBase.run(ToolBase.java:43)
        at com.sun.xml.rpc.tools.wscompile.Main.main(Main.java:22)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.apache.commons.launcher.ChildMain.run(ChildMain.java:269)
error: java.lang.NullPointerException