You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by "Datey, Ameya" <Am...@ca.com> on 2004/01/15 15:49:46 UTC

SimpleAxisServer

Hi All,

I'm trying to run the simple axis server (running without apache), and
the program starts but then blows up if I do an HTTP request.

I ran simpleaxisserver 8888 and then tried http://localhost:8888

The program crashed & threw open my debugger.

Any pointers?
Ameya

Ps: Windows 2000 with ALL service packs



Re: Arrays

Posted by su...@opensource.lk.
Hi Roland,

There are people using Axis C++ to host web services written in pure C.
Also the client applications in pure C. But the API and the method we have
provided in Axis release 1.0 is not that good because the web service or
client application developer anyway need a C++ compiler because the
wrappers generated by the WSDL2WS tool are in C++.

So we have done major modifications to the APIs and code generation and
wish to use that APIs in next release. The code in CVS HEAD is also
improved to support document/literal style web services.

You can write web services or client applications in pure C and you only
need a C++ compiler to compile Axis (If you download and install the Axis
binay you dont want a C++ compiler).

> Hi Susantha
>
> Your project is called "Axis C++ (Apache Axis SOAP Engine in C++)", not
> "Axis C". So I do not understand why you want to throw out the STL. It
> belongs to the C++ standard. And as long as you are using Xerces you
> always will need a C++ compiler. Therfore the compiler is not an
> argument.

In the current development we are using Expat for XML parsing because we
found that Expat performs better and it fits the Axis C++ architecture.

We can support Xerces and libXML. If you are willing to support Xerces
and/or libXML I am willing to help :) .

Also we expect to start writing a XML pull parser to be used in Axis and
the expectation is to do that in pure C for performance reasons.

Thanks,

Susantha.

>
> I think it would be better to support unicode than "C".
>
> Roland
>
>
> Susantha Kumara wrote:
>
>>Hi Roland,
>>
>>The language binding we have for Axis is common for both C and C++. so
>> mapping of xsd types to language types is base on C types now. Also we
>> expect not to use stl::string for xsd:string from next release. The
>> code in CVS HEAD which goes to next release use xsd__string for
>> xsd:string (typedef to char*).
>>
>>We soon publish our draft language bindings. Following is the cut and
>> paste of the type mapping.
>>
>>Simple Type			C  Type
>>-----------			-------
>>xsd:string			typedef char * xsd__string;
>>xsd:integer			typedef int xsd__integer;
>>xsd:int			typedef int xsd__int;
>>xsd:long			typedef long xsd__long;
>>xsd:short			typedef short xsd__short;
>>xsd:decimal			typedef double xsd__decimal;
>>xsd:float			typedef float xsd__float;
>>xsd:double			typedef double xsd__double;
>>xsd:boolean			typedef enum { false_, true_ } xsd__boolean;
>>xsd:byte			typedef unsigned char xsd__byte;
>>xsd:QName			typedef char * xsd__QName;
>>xsd:dateTime		typedef time_t xsd__dateTime;
>>xsd::unsignedByte		typedef unsigned char xsd__unsignedByte;
>>xsd::unsignedInt		typedef unsigned int xsd__unsignedInt;
>>xsd::unsignedLong		typedef unsigned long xsd__unsignedLong;
>>xsd::unsignedShort	typedef unsigned short xsd__unsignedShort;
>>xsd::base64Binary		typedef struct { xsd__unsignedByte * __ptr; xsd__int
>> __size;} xsd__base64Binary;
>>xsd::hexBinary		typedef struct{ xsd__unsignedByte * __ptr; xsd__int
>> __size;} xsd__hexBinary;
>>xsd::anyURI			typedef char * xsd__anyURI;
>>
>>However we need to discuss about supporting stl.
>>
>>Thanks,
>>
>>Susantha.
>>




Re: Arrays

Posted by Roland Kosovsky <ro...@abacus.ch>.
Hi Susantha

Your project is called "Axis C++ (Apache Axis SOAP Engine in C++)", not 
"Axis C". So I do not understand why you want to throw out the STL. It 
belongs to the C++ standard. And as long as you are using Xerces you 
always will need a C++ compiler. Therfore the compiler is not an argument.

I think it would be better to support unicode than "C".

Roland


Susantha Kumara wrote:

>Hi Roland,
>
>The language binding we have for Axis is common for both C and C++. so
>mapping of xsd types to language types is base on C types now. Also we
>expect not to use stl::string for xsd:string from next release. The code in
>CVS HEAD which goes to next release use xsd__string for xsd:string (typedef
>to char*).
>
>We soon publish our draft language bindings. Following is the cut and paste
>of the type mapping.
>
>Simple Type			C  Type
>-----------			-------
>xsd:string			typedef char * xsd__string;
>xsd:integer			typedef int xsd__integer;
>xsd:int			typedef int xsd__int;
>xsd:long			typedef long xsd__long;
>xsd:short			typedef short xsd__short;
>xsd:decimal			typedef double xsd__decimal;
>xsd:float			typedef float xsd__float;
>xsd:double			typedef double xsd__double;
>xsd:boolean			typedef enum { false_, true_ } xsd__boolean;
>xsd:byte			typedef unsigned char xsd__byte;
>xsd:QName			typedef char * xsd__QName;
>xsd:dateTime		typedef time_t xsd__dateTime;
>xsd::unsignedByte		typedef unsigned char xsd__unsignedByte;
>xsd::unsignedInt		typedef unsigned int xsd__unsignedInt;
>xsd::unsignedLong		typedef unsigned long xsd__unsignedLong;
>xsd::unsignedShort	typedef unsigned short xsd__unsignedShort;
>xsd::base64Binary		typedef struct { xsd__unsignedByte * __ptr; xsd__int
>__size;} xsd__base64Binary;
>xsd::hexBinary		typedef struct{ xsd__unsignedByte * __ptr; xsd__int
>__size;} xsd__hexBinary;
>xsd::anyURI			typedef char * xsd__anyURI;
>
>However we need to discuss about supporting stl.
>
>Thanks,
>
>Susantha.
>  
>

RE: Arrays

Posted by Susantha Kumara <su...@opensource.lk>.
Hi Roland,

The language binding we have for Axis is common for both C and C++. so
mapping of xsd types to language types is base on C types now. Also we
expect not to use stl::string for xsd:string from next release. The code in
CVS HEAD which goes to next release use xsd__string for xsd:string (typedef
to char*).

We soon publish our draft language bindings. Following is the cut and paste
of the type mapping.

Simple Type			C  Type
-----------			-------
xsd:string			typedef char * xsd__string;
xsd:integer			typedef int xsd__integer;
xsd:int			typedef int xsd__int;
xsd:long			typedef long xsd__long;
xsd:short			typedef short xsd__short;
xsd:decimal			typedef double xsd__decimal;
xsd:float			typedef float xsd__float;
xsd:double			typedef double xsd__double;
xsd:boolean			typedef enum { false_, true_ } xsd__boolean;
xsd:byte			typedef unsigned char xsd__byte;
xsd:QName			typedef char * xsd__QName;
xsd:dateTime		typedef time_t xsd__dateTime;
xsd::unsignedByte		typedef unsigned char xsd__unsignedByte;
xsd::unsignedInt		typedef unsigned int xsd__unsignedInt;
xsd::unsignedLong		typedef unsigned long xsd__unsignedLong;
xsd::unsignedShort	typedef unsigned short xsd__unsignedShort;
xsd::base64Binary		typedef struct { xsd__unsignedByte * __ptr; xsd__int
__size;} xsd__base64Binary;
xsd::hexBinary		typedef struct{ xsd__unsignedByte * __ptr; xsd__int
__size;} xsd__hexBinary;
xsd::anyURI			typedef char * xsd__anyURI;

However we need to discuss about supporting stl.

Thanks,

Susantha.

> -----Original Message-----
> From: Roland Kosovsky [mailto:nospam_kosovsky@abacus.ch]
> Sent: Thursday, January 15, 2004 9:47 PM
> To: Apache AXIS C User List
> Subject: Arrays
>
>
> Does anyone know why WSDL2Ws generates a string* instead of a
> vector<string>? Is there any reason for that?
>
> My WSDL:
>     <xsd:complexType name="StrArray">
>       <xsd:complexContent>
>         <xsd:restriction base="soapenc:Array">
>           <xsd:attribute ref="soapenc:arrayType"
> arrayType="xsd:string[]"/>
>         </xsd:restriction>
>       </xsd:complexContent>
>     </xsd:complexType>
>
> WSDL2Ws will generate the following:
>     typedef struct StrArrayTag
>     {
>         string* m_Array;
>         int m_Size;
>     } StrArray;
>
> I would prefere this form:
>     struct StrArray
>     {
>         vector<string> values;
>     };
>
>
> Sanjiva Weerawarana wrote:
>
> >Can you please submit a bug report with a patch for this? That'll
> >make sure it gets fixed for everyone ..
> >
> >
> Ok, I will do that.
>
> Roland
>
>


Arrays

Posted by Roland Kosovsky <no...@abacus.ch>.
Does anyone know why WSDL2Ws generates a string* instead of a 
vector<string>? Is there any reason for that?

My WSDL:
    <xsd:complexType name="StrArray">
      <xsd:complexContent>
        <xsd:restriction base="soapenc:Array">
          <xsd:attribute ref="soapenc:arrayType" arrayType="xsd:string[]"/>
        </xsd:restriction>
      </xsd:complexContent>
    </xsd:complexType>

WSDL2Ws will generate the following:
    typedef struct StrArrayTag
    {
        string* m_Array;
        int m_Size;
    } StrArray;

I would prefere this form:
    struct StrArray
    {
        vector<string> values;
    };


Sanjiva Weerawarana wrote:

>Can you please submit a bug report with a patch for this? That'll
>make sure it gets fixed for everyone ..
>  
>
Ok, I will do that.

Roland


Re: SimpleAxisServer

Posted by Sanjiva Weerawarana <sa...@opensource.lk>.
Can you please submit a bug report with a patch for this? That'll
make sure it gets fixed for everyone ..

Thanks!

Sanjiva.

----- Original Message ----- 
From: "Roland Kosovsky" <no...@abacus.ch>
To: "Apache AXIS C User List" <ax...@ws.apache.org>
Sent: Thursday, January 15, 2004 9:04 PM
Subject: Re: SimpleAxisServer


> In my case the crash was caused by "sstr->so.http.op_headercount" that 
> was not set to 0.
> 
> mod_axis2.c, Ln 138:
> static int mod_axis_method_handler (request_rec *req_rec)
> ...
>     sstr = malloc(sizeof(Ax_soapstream));
>     memset(sstr, 0, sizeof(Ax_soapstream)); // <<<<< insert this line
> 
> This code has some more bugs, look at this:
> ...
> if(0 != process_request(sstr))
>     {
>         /*ap_rputs("SOAP Engine failed to response",req_rec);*/
>         return OK;  // #### sstr will never be freed!!!!!
>     }
>     if (sstr->so.http.op_headers)
>         free(sstr->so.http.op_headers);
>     free(sstr);
> 
> Why is the Ax_soapstream not on stack? It would be deleted for free.
> Roland
> 
> 
> 
> Datey, Ameya wrote:
> 
> >Hi All,
> >
> >I'm trying to run the simple axis server (running without apache), and
> >the program starts but then blows up if I do an HTTP request.
> >
> >I ran simpleaxisserver 8888 and then tried http://localhost:8888
> >
> >The program crashed & threw open my debugger.
> >
> >Any pointers?
> >Ameya
> >
> >Ps: Windows 2000 with ALL service packs
> >
> >
> >
> >  
> >
> 


Re: SimpleAxisServer

Posted by Roland Kosovsky <no...@abacus.ch>.
In my case the crash was caused by "sstr->so.http.op_headercount" that 
was not set to 0.

mod_axis2.c, Ln 138:
static int mod_axis_method_handler (request_rec *req_rec)
...
    sstr = malloc(sizeof(Ax_soapstream));
    memset(sstr, 0, sizeof(Ax_soapstream)); // <<<<< insert this line

This code has some more bugs, look at this:
...
if(0 != process_request(sstr))
    {
        /*ap_rputs("SOAP Engine failed to response",req_rec);*/
        return OK;  // #### sstr will never be freed!!!!!
    }
    if (sstr->so.http.op_headers)
        free(sstr->so.http.op_headers);
    free(sstr);

Why is the Ax_soapstream not on stack? It would be deleted for free.
Roland



Datey, Ameya wrote:

>Hi All,
>
>I'm trying to run the simple axis server (running without apache), and
>the program starts but then blows up if I do an HTTP request.
>
>I ran simpleaxisserver 8888 and then tried http://localhost:8888
>
>The program crashed & threw open my debugger.
>
>Any pointers?
>Ameya
>
>Ps: Windows 2000 with ALL service packs
>
>
>
>  
>