[WSDL2C] Bug in C - ServerStubs - Unexpected Subelement

2007-08-07 Thread Dr. Florian Steinborn

Hi folks,

I can hardly believe that we are the only ones to find out that the  
serverstubs generated by the latest nightly builds are not usable any  
more. But this is our conclusion after spending several hours on the  
problem and comparing newly generated code with older versions. I would be  
willing to raise a JIRA but first I would like to get your opinion on this.


The problem seems to be that the responses sent by the webserver in some  
cases are not formatted correctly. The result is an "unexpected element"  
fault caught by the client. I am sure you can easily regenerate the  
problem. Here is what we tried:


Consider a webservice that returns a structure of different (simple) data  
types (returning single simple types makes no problem). In our case it was  
something called "Dat" that can be understood by the follwing wsdl:







type="x






We have a webservice that returns such an element.

When you create server stubs and execute the service you will run into a  
ADBException:


Caused by: org.apache.axis2.databinding.ADBException: Unexpected  
subelement dl
	at  
org.apache.ws.axis2.GetDatResponse$Factory.parse(GetDatResponse.java:440)

... 30 more


Running the tcpmon shows what happens:



HTTP/1.1 200 OK^M
Content-Type: application/soap+xml;charset=UTF-8^M
Transfer-Encoding: chunked^M
90^M
http://www.w3.org/2003/05/soap-envelope";>



http://ws.apache.org/axis2";  
xmlns:ns3="http://ws.apache.org/axis2/xsd";>

1.10
2.20
3
KETTE
4
5


^M



The tokens "" and "" seem to be missing.

Earlier versions produced:

xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>




http://ws.apache.org/axis2/xsd";>

1.10
2.20
3
KETTE
4
5



^M


As we found out, the problem lies in the generation of the methods inside
axis2_getResponse.c file.

Earlier versions of AXIS2 generated code like this in the "serialze"  
method:


[...]

if(has_parent)
{
 data_source = axiom_node_get_data_element(parent, env);
 if (!data_source)
return NULL;
stream = axiom_data_source_get_stream(data_source, env); /*assume  
parent is of type data source */

if (!stream)
return NULL;
current_node = parent;
}
else
{
   data_source = axiom_data_source_create(env, parent, ¤t_node);
   stream = axiom_data_source_get_stream(data_source, env);
}

/**
* parsing return element
*/

start_input_str = "";
start_input_str_len = axutil_strlen(start_input_str);
end_input_str = "";
end_input_str_len = axutil_strlen(end_input_str);

axutil_stream_write(stream, env, start_input_str, start_input_str_len);
axis2_Dat_serialize( getDatResponse->attrib_return, env, current_node,  
AXIS2_TRUE);

axutil_stream_write(stream, env, end_input_str, end_input_str_len);

[...]

As we can see the wanted element  is written unconditionally.

Not so the latest nightly build. It generates:

[...]
/**
 * parsing return element
 */
start_input_str = "xmlns:ns3=\"http://ws.apache.org/axis2/xsd\";>";

start_input_str_len = axutil_strlen(start_input_str);
end_input_str = "";
end_input_str_len = axutil_strlen(end_input_str);
if(has_parent)
  axutil_stream_write(stream, env, start_input_str, start_input_str_len);
adb_Dat_serialize( _getDatResponse->attrib_return, env, current_node,  
AXIS2_TRUE);

if(has_parent)
axutil_stream_write(stream, env, end_input_str, end_input_str_len);


[...]

This seems to be wrong as the serialize-functions is always called with  
the parameter "has_parent" = FALSE. The result is the above mentioned  
error. It seems the blocks accidentially moved to another position during  
generation.


As far as we can see this renders the generated Axis-Services completely  
useless and again we wonder how others are working...


Please tell us if we have to raise a JIRA for this or if there is a way to  
bypass the problem (except editing all the generated sources).


Thanks a lot and good night from Berlin,

Flori

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [WSDL2C] Bug in C - ServerStubs - Unexpected Subelement

2007-08-09 Thread Dr. Florian Steinborn

Hi,

just to let you know what we did to temporarily bypass the problem:

We added just one exclamation mark and it works:

[...]


if(has_parent)
   axutil_stream_write(stream, env, start_input_str,  
   start_input_str_len);


changed to

if(!has_parent)
   axutil_stream_write(stream, env, start_input_str,
   start_input_str_len);

[...]

Needless to say this is editing the generated source - the way we did not  
want to go.


Thanks and greetings from Berlin,

Flori

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [WSDL2C] Bug in C - ServerStubs - Unexpected Subelement

2007-08-09 Thread Samisa Abeysinghe
Looks like a logic error in the generated code. I could change the style 
sheet logic to include this.

However, I would like to have a test case to ensure the change works.

Samisa...

Dr. Florian Steinborn wrote:

Hi,

just to let you know what we did to temporarily bypass the problem:

We added just one exclamation mark and it works:

[...]


if(has_parent)
   axutil_stream_write(stream, env, start_input_str,
start_input_str_len);


changed to

if(!has_parent)
   axutil_stream_write(stream, env, start_input_str,
   start_input_str_len);

[...]

Needless to say this is editing the generated source - the way we did 
not want to go.


Thanks and greetings from Berlin,

Flori

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Samisa Abeysinghe : http://wso2.org/projects/wsf/c";>WSO2 Web Services 
Framework/C - Open source C library for providing and consuming Web services


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [WSDL2C] Bug in C - ServerStubs - Unexpected Subelement

2007-08-09 Thread Dr. Florian Steinborn

Hi Samisa

Looks like a logic error in the generated code. I could change the style  
sheet logic to include this.

However, I would like to have a test case to ensure the change works.



attached you find a WSDL and the generated C code with the error. This  
could make it easier to see your change works.


Thanks,
Flori

adb_getSysinfoResponse.c
Description: Binary data


WSProsit.wsdl
Description: Binary data
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]