You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by Susantha Kumara <su...@opensource.lk> on 2004/02/27 07:00:25 UTC

type support

Hi all,

I am doing the design on how to support <any> type. I have got some problems
and need your ideas to solve following problem.
Ex:

schema section

 	<xsd:complexType name="ExtensibilityType">
        <xsd:sequence>
          <xsd:any namespace="##any"/>
        </xsd:sequence>
      </xsd:complexType>

      <xsd:element name="query">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="queryExpression"
type="tns:ExtensibilityType"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>

      <xsd:element name="queryResponse">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="queryResult" type="tns:ExtensibilityType"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>

messages section

  <message name="queryIn">
    <part element="tns:query" name="parameters" />
  </message>

  <message name="queryOut">
    <part element="tns:queryResponse" name="parameters" />
  </message>

port types section

  <portType name="ExtensibilityQueryPortType">
    <operation name="query">
      <input message="tns:queryIn" />
      <output message="tns:queryOut" />
    </operation>
  </portType>


WSDL2Ws tool already generates functions to manipulate the complexType
objects.

Provided a type registry and DLLs that contain the types, its possible for
the
AxisEngine to find the type in the SOAP message and deserialize/serialize
accordingly.

But one problem that I have is how do we (code generator) create the stubs
and skeletons ?
According to the above WSDL, the C method in the skeleton can be,

void* query(void* object);

But if we do like this how does the method recognizes (inside the method)
what the type is in the "object" ?

/////////////////////////////
I ran WSDL2Java and found what Axis Java does, the method it generates is,

    public ExtensibilityQuery_pkg.ExtensibilityType
query(ExtensibilityQuery_pkg.ExtensibilityType queryExpression);

where the types are like,

public class ExtensibilityType  implements java.io.Serializable {
    private org.apache.axis.message.MessageElement [] _any;

    public ExtensibilityType() {
    }

    public org.apache.axis.message.MessageElement [] get_any() {
        return _any;
    }

    public void set_any(org.apache.axis.message.MessageElement [] _any) {
        this._any = _any;
    }
     ..............
}
//////////////////////////////

Instead of void* I suggest passing some struct like following,

struct AnyType{
  void* _object;
  char* _typename;
  char* _namespace;
  void* _functions; /* this will contain deserializer/serializer function
etc that are used basically by the Axis engine to manipulate this kind of
type (functions that are already generated by WSDL2Ws tool). May be this is
not needed to provide to the skeletons and stubs*/
}

This way the skeleton implementator can check the _typename and _namespace
and then cast _object into its known type and use it. Ex:

AnyType* query(AnyType* object)
{
	if (strcmp(object->_typename, "myType")==0)
	{
		MyType* mytype = (MyType*)object->_object;
		................
	}
}

Thanks,

Susantha.




Re: type support

Posted by Sam Lang <sl...@mcs.anl.gov>.
> Instead of void* I suggest passing some struct like following,
> 
> struct AnyType{
>   void* _object;
>   char* _typename;
>   char* _namespace;
>   void* _functions; /* this will contain deserializer/serializer function
> etc that are used basically by the Axis engine to manipulate this kind of
> type (functions that are already generated by WSDL2Ws tool). May be this is
> not needed to provide to the skeletons and stubs*/
> }
> 
> This way the skeleton implementator can check the _typename and _namespace
> and then cast _object into its known type and use it. Ex:
> 
> AnyType* query(AnyType* object)
> {
> 	if (strcmp(object->_typename, "myType")==0)
> 	{
> 		MyType* mytype = (MyType*)object->_object;
> 		................
> 	}
> }
> 

This looks good.  How do the _functions get set in the engine/wrappers
before the deserialization happens though?  

> Thanks,
> 
> Susantha.
> 
> 
>