axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian Dick <adrian.d...@uk.ibm.com>
Subject Re: Question about Axis xsd__ types
Date Mon, 17 Oct 2005 10:08:41 GMT
Hi,

I think you have mis-understood the API for Arrays here.

Because we need to handle nil (or NULL) elements within arrays, we can't
simply use a NULL terminated array.  Therefore we have a small class to
hold the array, of the following structure (using xsd__string example):
  class xsd__string_Array
  {
    public:
      xsd__string * m_Array;
      int m_Size; // Size of array (inc. NULL or empty elements)
  };

Which you would use something like:
  xsd__string_Array arrayInput;
  arrayInput.m_Array = new xsd__string[2];
  arrayInput.m_Size = 2;
  webServiceStub->methodWithArrayInput(arrayInput);

I hope this is of help.


Regards,
Adrian
_______________________________________
Adrian Dick (adrian.dick@uk.ibm.com)

Kevin Rogers <krogers@pdi.com> wrote on 14/10/2005 19:31:35:

>
> Hello,
>
> I'm having some difficulties dealing with the Axis defined xsd__ types
> used for De/Serialization from SOAP. Basically, I had a service
> constructed which only used strings (well, actually char* as that's what
> Axis uses) for the parameters to the service calls, and everything
> worked great. I built an API around the Axis-generated that accepted
> char* as parameters and then passed those to the corresponding Axis call
> that accepted xsd__string's as it's parameters.
>
> I know that xsd__string is typedef'd to 'char', so this was not a
> problem and worked great.
>
> Originally, when I was only passing single strings my WSDL definition
> looked like this:
>
> <xsd:element name="getLevels">
>          <xsd:complexType>
>             <xsd:sequence>
>                 <xsd:element name="ProdCode" type="xsd:string"/>
>                 <xsd:element name="Type" type="xsd:string"/>
>                 ...
>
> ...the function generated from this WSDL has for it's parameters
> xsd__string, which I was successfully calling by doing something like
this:
>
> public myWrapper(char* aProdCode, char* aType)
> {
>     <.... code to get the ServicePortType...>
>
>     theService->getLevels(aProdCode, aType);
> }
>
>
> However, I now want to change the API to accept arrays of strings
> (char*) and boolean values. Here is what my WSDL now looks like:
>
> <xsd:element name="getLevels">
>         <xsd:complexType>
>           <xsd:sequence>
>             <xsd:element name="ProdCode" type="xsd:string" minOccurs="1"
> maxOccurs="1"/>
>             <xsd:element name="LevelNamePattern" type="xsd:string"
> minOccurs="0" maxOccurs="1"/>
>             <xsd:element name="LevelType" type="xsd:string"
> minOccurs="0" maxOccurs="1"/>
>             <xsd:element name="LevelIsIP" type="xsd:boolean"
> minOccurs="0" maxOccurs="1"/>
>             <xsd:element name="Artist" type="xsd:string" minOccurs="0"
> maxOccurs="unbounded"/>
>             ....
>
>
> ...the function generated from this WSDL now has for it's parameters
> xsd__string, xsd__boolean and xsd__string_Array values.
>
> I know that xsd__string_Array is typedef'd to an array of xsd__string,
> which would mean an array of 'char', correct? I also see from the code
> that xsd__boolean is typedef'd to an enum containing true and false
> values. My wrapper API call now looks like this, accepting boolean and
> char*[] values:
>
> public myWrapper(char* aProdCode, char* aLevelNamePattern", char*
> aLevelType, bool aLevelIsIP, char* aArtist[])
> {
>     <.... code to get the ServicePortType...>
>
>     theService->getLevels(aProdCode, aLevelName Pattern, aLevelType,
> aLevelIsIP, aArtist);
> }
>
>
> However, the compiler complains with the above code (I've eliminated
> quite a few parameters in the above code for clarity):
>
> LevelServiceAPI.cpp: In function `tLevel_Array
>    getLevels(char*, char*, char*, bool, char*, char*, char**, char**,
> char**,
>    char**, char**, char**, char*, char**, char**, char*, char**, bool,
> char**,
>    char*, char*)':
> LevelServiceAPI.cpp:106: no matching function for call to
>    `LevelsServicePortType::getLevels(char*&, char*&, char*&, bool,
char*&,
>    char*&, char**&, char**&, char**&, char**&, char**&, char**&,
char*&,
>    char**&, char**&, char*&, char**&, bool, char**&, char*&,
char*&)'
> LevelsServicePortType.hpp:28: candidates are: tLevel_Array
>    LevelsServicePortType::getLevels(char*, char*, char*,
> axiscpp::xsd__boolean,
>    char*, char*, axiscpp::xsd__string_Array, axiscpp::xsd__string_Array,
>    axiscpp::xsd__string_Array, axiscpp::xsd__string_Array,
>    axiscpp::xsd__string_Array, axiscpp::xsd__string_Array, char*,
>    axiscpp::xsd__string_Array, axiscpp::xsd__string_Array, char*,
>    axiscpp::xsd__string_Array, axiscpp::xsd__boolean,
>    axiscpp::xsd__string_Array, char*, char*)
>
>
> All of the parameters defined in the ServicePortType function with type
> of xsd__String_Array or xsd_boolean are mapped to char** and boolean
> values accordingly. One strange thing that I did notice was that the
> compiler changed the references of xsd__string to char* when outputting
> the above message, but did not do so for xsd__string_Array or
> xsd__boolean. (What I mean by that is that the definition of the
> function in the ServicePortType class has xsd__string, xsd__string_Array
> and xsd__boolean as it's parameters, but the compiler seems to only
> decode the references to xsd__string to it's corresponding char* value).
>
> Can anyone shed some light on this?
>
>
> thanks!
> ~kevin
>
> --
> Kevin Rogers
> PDI / Dreamworks
> ext.29163 | 650.562.9163
> krogers@pdi.com
>


Mime
View raw message