Hi,
 
I am implementing support for exception types in the wsdltocorba tool.
In this example one of the fault message names begins with _exception - 
 
<message name="_exception.TestException.BadRecord">
    <part name="exception" element="xsd1:TestException.BadRecord"/>
  </message>
 
We remove the _exception as to start a token with _ in idl is illegal.
 

Corba Spec states : Section 3.2.3 Identifiers

An identifier is an arbitrarily long sequence of ASCII alphabetic,
digit, and underscore

("_") characters. The first character must be an ASCII alphabetic
character. All

characters are significant.

 
This will mean we have a complexType and element name which is fine in
wsdl but when generating the idltypes - some of the idltypes will then
be the same which again is illegal. So I have decided in this case to
add a number to the exception name. 
 
So we will get our struct BadRecord and our exception BadRecord1 in the
correct generated idl as idl will not let you have two tokens with the
same name in the same scope. 
 
Does this seem reasonable to most people ? 
 
 
thanks, Edell.
 
<types>
    <schema
targetNamespace="http://schemas.apache.org/idltypes/exceptions.idl";
     xmlns="http://www.w3.org/2001/XMLSchema";
     xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";>
      <xsd:complexType name="TestException.BadRecord">
        <xsd:sequence>
          <xsd:element name="reason" type="xsd:string"/>
          <xsd:element name="code" type="xsd:short"/>
        </xsd:sequence>
      </xsd:complexType>
      <xsd:element name="TestException.ExceptionTest.review_data.data"
type="xsd:string"/>
      <xsd:element name="TestException.BadRecord"
type="xsd1:TestException.BadRecord"/>
        <xsd:element name="ExceptionEl" type="xsd2:MyExceptionType"/>
    </schema>
      <schema targetNamespace="urn:mytypes"
          xmlns="http://www.w3.org/2001/XMLSchema";
          xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";>
          <xsd:complexType name="MyExceptionType">
              <xsd:sequence>
                  <xsd:element name="message" type="xsd:string"/>
                  <xsd:element name="code" type="xsd:short"/>
                  <xsd:element name="company" type="xsd:string"/>
              </xsd:sequence>
          </xsd:complexType>
      </schema>
  </types>
 
this now generates the following in the CorbaTypeMapping
 
 
 <corba:struct
xmlns:xsd1="http://schemas.apache.org/idltypes/exceptions.idl
<http://schemas.apache.org/idltypes/exceptions.idl> " 
  repositoryID="IDL:TestException/BadRecord:1.0"
type="xsd1:TestException.BadRecord" 
  name="TestException.BadRecord">
  <corba:member name="reason" idltype="corba:string" />
  <corba:member name="code" idltype="corba:short" />
</corba:struct>
 
<corba:struct xmlns:xsd2="urn:mytypes"
repositoryID="IDL:MyExceptionType:1.0" 
  type="xsd2:MyExceptionType" name="MyExceptionType">
  <corba:member name="message" idltype="corba:string" />
  <corba:member name="code" idltype="corba:short" />
  <corba:member name="company" idltype="corba:string" />
</corba:struct>
 
<corba:exception
xmlns:xsd1="http://schemas.apache.org/idltypes/exceptions.idl
<http://schemas.apache.org/idltypes/exceptions.idl> " 
  repositoryID="IDL:TestException/BadRecord:1.0"
type="xsd1:TestException.BadRecord" 
  name="TestException.BadRecord1">
  <corba:member name="reason" idltype="corba:string" />
  <corba:member name="code" idltype="corba:short" />
</corba:exception>
 
<corba:exception
xmlns:xsd1="http://schemas.apache.org/idltypes/exceptions.idl
<http://schemas.apache.org/idltypes/exceptions.idl> " 
  repositoryID="IDL:MyExceptionMessage:1.0" type="xsd1: MyExceptionType
" name="MyExceptionMessage">
  <corba:member name="message" idltype="corba:string" />
  <corba:member name="code" idltype="corba:short" />
  <corba:member name="company" idltype="corba:string" />
</corba:exception>
 
</corba:typeMapping>   
 
This is the resulting idl
 
 
module TestException {
    struct BadRecord {
        string reason;
        short code;
    };
    exception BadRecord1 {
        string reason;
        short code;
    };
    interface ExceptionTest {
        void
        review_data(
            in string data
        ) raises(
            ::TestException::BadRecord1,
            ::MyExceptionMessage
        );
    };
};
struct MyExceptionType {
    string message;
    short code;
    string company;
};
exception MyExceptionMessage {
    string message;
    short code;
    string company;
};
 

Reply via email to