Forum Discussion

lneves's avatar
lneves
New Contributor
17 years ago

Unable to use WADL file with parameter with style="template"

Hello all.
It does not seem to be possible to use the request editor with operations generated from a WADL file that have a parameter with style="template".
The following wadl sample illustrates the problem.
It fails when trying to use the request editor for the operation "/event/{event-id}.
Using versions v.2.5.1 and v3.0beta1(nightly-08-06)

Regards.

--
Luis Neves


<?xml version="1.0"?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xsi:schemaLocation="http://research.sun.com/wadl/2006/10 wadl.xsd"
xmlns="http://research.sun.com/wadl/2006/10"
xmlns:sa="urn:sapoalerts:api">

<grammars>
<include href="events.xsd" />
<include href="fault.xsd" />
</grammars>

  <resources base="http://10.134.132.6:8089/alerts/v1">
    <resource path="/events">
      <method href="#get_event_list"/>
    </resource>

    <resource path="/event/{event-id}">
      <method href="#get_event"/>
    </resource>
   
   
  </resources>

  <method name="GET" id="get_event_list">
    <request/>
    <response>
      <representation mediaType="application/xml" element="sa:Events"/>
      <fault mediaType="application/xml" element="sa:Fault"/>
    </response>
  </method>

  <method name="GET" id="get_event">
    <request>
      <param name="event-id" type="xsd:string" required="true" style="template" />
    </request>
    <response>
      <representation mediaType="application/xml" element="sa:Event"/>
      <fault mediaType="application/xml" element="sa:Fault"/>
    </response>
  </method>

</application>

3 Replies

  • Hi!

    hmm.. can you attach the xsds so I can test this with all included files?

    Thanks in advance!

    regards,

    /Ole
    eviware.com
  • lneves's avatar
    lneves
    New Contributor
    Sure... the files are below.
    It seems the the culprit is using style="template" with required="true"...  if using only style="template" there are no errors.

    fault.xsd:

    <?xml version="1.0" encoding="utf-8"?>
    <xsd:schema attributeFormDefault="qualified" elementFormDefault="qualified" version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:sapoalerts:api">
      <xsd:element name="Fault" type="FaultType" />
      <xsd:complexType name="FaultType">
        <xsd:sequence>
          <xsd:element name="Code" type="xsd:int" />
          <xsd:element name="Reason" type="xsd:string" />
          <xsd:element name="Detail" type="xsd:string" />
        </xsd:sequence>
      </xsd:complexType>
    </xsd:schema>


    events.xsd:

    <?xml version="1.0" encoding="utf-16"?>
    <xsd:schema attributeFormDefault="qualified" elementFormDefault="qualified" version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:sapoalerts:api">

    <xsd:element name="Events" type="EventsType" />

    <xsd:element name="Event" type="EventType" />

    <xsd:complexType name="EventsType">
    <xsd:sequence>
    <xsd:element name="Event" type="EventType" maxOccurs="unbounded" />
    </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="EventType">
    <xsd:sequence>
    <xsd:element name="Source" type="SourceType" minOccurs="1" maxOccurs="1" />
    <xsd:element name="Properties" type="PropertiesType" minOccurs="0" nillable="true" />
    <xsd:element name="Namespaces" type="NamespacesType" minOccurs="0" nillable="true" />
    </xsd:sequence>
    <xsd:attribute name="id" type="xsd:string" minOccurs="1" maxOccurs="1" />
    <xsd:attribute name="name" type="xsd:string" minOccurs="1" maxOccurs="1" />
    </xsd:complexType>

    <xsd:complexType name="NamespacesType">
    <xsd:sequence>
    <xsd:element name="Namespace" type="NamespaceType" maxOccurs="unbounded" nillable="false" />
    </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="NamespaceType">
    <xsd:attribute name="prefix" type="xsd:string" minOccurs="1" maxOccurs="1" nillable="false" />
    <xsd:attribute name="uri" type="xsd:string" minOccurs="1" maxOccurs="1" nillable="false" />
    </xsd:complexType>

    <xsd:complexType name="PropertiesType">
    <xsd:sequence>
    <xsd:element name="Property" type="PropertyType" maxOccurs="unbounded" nillable="false" />
    </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="PropertyType">
    <xsd:attribute name="name" type="xsd:string" minOccurs="1" maxOccurs="1" nillable="false" />
    <xsd:attribute name="type" type="xsd:string" minOccurs="1" maxOccurs="1" nillable="false" />
    <xsd:attribute name="xpath" type="xsd:string" minOccurs="1" maxOccurs="1" nillable="false" />
    </xsd:complexType>

    <xsd:complexType name="SourceType">
    <xsd:sequence>
    <xsd:element name="InputChannel" type="InputChannelType" minOccurs="1" maxOccurs="1" nillable="false" />
    </xsd:sequence>
    <xsd:attribute name="endpoint" type="xsd:string" minOccurs="1" maxOccurs="1" nillable="false" />
    </xsd:complexType>

    <xsd:complexType name="InputChannelType">
    <xsd:attribute name="id" type="xsd:string" minOccurs="1" maxOccurs="1" nillable="false" />
    </xsd:complexType>

    </xsd:schema>
  • Hi!

    Thanks again, this should be fixed in the upcoming nightly build of 3.0 beta

    regards!

    /Ole
    eviware.com