That's right, changing %Lf to %f gives me more meaningful printfs, and
leads me to the real bug in my code:

num1 = adb_Arithmetic_get_Num1(arithmetic, env);
num1 = adb_Arithmetic_get_Num2(arithmetic, env);  // BUG: should be num2

I'm embarrassed of making such a silly mistake.

I now have both the client and server working.  Thanks a lot for your
help!

Wayne

 

>-----Original Message-----
>From: Dimuthu Gamage [mailto:[EMAIL PROTECTED] 
>Sent: Friday, February 01, 2008 1:53 PM
>To: Apache AXIS C User List
>Subject: Re: Questions/suggestions on WSDL2C
>
> I didn't see you have attached the request envelope in the 
>early mail.. Sorry for bothering you with the early mail.
>
>Anyway replace the "%Lf" to "%lf" and check again.
>
>"%Lf" should be the reason for the memory corruption as well.
>
>Thanks
>Dimuthu
>
>On Feb 1, 2008 11:42 PM, Zhang, Wayne (IT) 
><[EMAIL PROTECTED]> wrote:
>> Hi Dimuthu,
>>
>> I added the debug printf and here is the new output:
>>
>> Started Simple Axis2 HTTP Server ...
>> in axis2_svc_skel_CalculatorService_invoke(), content_node is:
>> <n:Arithmetic
>> 
>xmlns:n="http://xml.ms.com/ns/msjava/cxfutils/examples/calculator";><n:
>> Nu
>> m1>50.000000</n:Num1><n:Num2>20.000000</n:Num2></n:Arithmetic>
>
>
>
>>
>> in axis2_skel_CalculatorService_Arithmetic()!
>> num1=0.000000, num2=0.000000
>> exiting axis2_skel_CalculatorService_Arithmetic()...
>> Segmentation fault (core dumped)
>>
>> It's possible that "divide-by-zero" causes the memory 
>corruption, but 
>> if
>> num1 and num2 were deserialized correctly I won't run into 
>this problem.
>>
>> Thanks,
>>
>> Wayne Zhang
>> Morgan Stanley | Technology
>> 750 Seventh Avenue, 12th Floor | New York, NY  10019
>> Phone: +1 212 762-1943
>> [EMAIL PROTECTED]
>>
>>
>> >-----Original Message-----
>> >From: Dimuthu Gamage [mailto:[EMAIL PROTECTED]
>>
>> >Sent: Friday, February 01, 2008 12:56 PM
>> >To: Apache AXIS C User List
>> >Subject: Re: Questions/suggestions on WSDL2C
>> >
>> >Hi,
>> >
>> >Looking at your gdb.txt, i feel that there is a memory corruption 
>> >somewhere.. because parent_tag_closed is supposed to have value 1, 
>> >but it have some junk value. Although I m not sure one 
>reason can be 
>> >you are doing  0/0 kind of operation, That is just a guess.
>> >
>> >If that so, can you check whether the request message have come 
>> >correctly?. you can do that by installing tcpmon [1].  or adding 
>> >following code in the start of 
>> >axis2_svc_skel_CalculatorService_invoke
>> >function in the axis2_svc_skel_CalculatorService.c file.
>> >
>> >printf("%s\n", axiom_node_to_string(content_node, env));
>> >
>> >
>> >[1] http://xml.ms.com/ns/msjava/cxfutils/examples/calculator
>> >
>> >Thanks
>> >Dimuthu
>> >
>> >On Feb 1, 2008 10:31 PM, Zhang, Wayne (IT) 
>> ><[EMAIL PROTECTED]> wrote:
>> >> Hi Dimuthu,
>> >>
>> >> I followed your instructions and was able to build my
>> >client, so many
>> >> thanks on that.  However, my client is crashing the server now
>> >> (SIGSEGV) and as far as I can tell the request looks 
>valid.  I have 
>> >> attached the client request, the server log, my
>> >implementation of the
>> >> server handler
>> >> (axis2_skel_CalculatorService.c) and gdb back trace from the
>> >core file
>> >> to this mail.  Below are my server's debug statements before
>> >the crash:
>> >>
>> >>
>> >> Started Simple Axis2 HTTP Server ...
>> >> in axis2_skel_CalculatorService_Arithmetic()!
>> >> num1=0.000000, num2=0.000000
>> >> exiting axis2_skel_CalculatorService_Arithmetic()...
>> >> Segmentation fault (core dumped)
>> >>
>> >>
>> >> As you see, num1 and num2 are parsed wrong (I expected 50.000000 
>> >> and 20.000000), so it seems axis2 is having trouble deserializing 
>> >> the arguments from the request message.  Please advise on how I 
>> >> should debug the server.
>> >>
>> >> Thanks,
>> >>
>> >> Wayne
>> >>
>> >>
>> >> >-----Original Message-----
>> >> >From: Dimuthu Gamage [mailto:[EMAIL PROTECTED]
>> >>
>> >> >Sent: Thursday, January 31, 2008 5:44 PM
>> >> >To: Apache AXIS C User List
>> >> >Subject: Re: Questions/suggestions on WSDL2C
>> >> >
>> >> >Hi Zhang,
>> >> >Please see my inline comment to the code..
>> >> >
>> >> >On Feb 1, 2008 1:30 AM, Zhang, Wayne (IT) 
>> >> ><[EMAIL PROTECTED]> wrote:
>> >> >> Hi,
>> >> >>
>> >> >> Thanks to all for your quick responses.  I think a simple
>> >> >demo client
>> >> >> (with useful inlined comments explaining what a user 
>should do) 
>> >> >> will fit my need.  WRT makefile generation, I understand
>> >it's hard
>> >> >> to auto-generate one that works perfectly in  _all_ projects, 
>> >> >> but it might be helpful to create a makefile.template kind of 
>> >> >> thing
>> >> >to set up
>> >> >> all the basic stuff (required defines, libs, include paths,
>> >> >libpaths,
>> >> >> etc) and let the users add their stuff on top of it.
>> >> >>
>> >> >> Now back to the problems I encountered with the client.  (I
>> >> >apologize
>> >> >> for the following long copy-and-paste text, please tell me
>> >> >the proper
>> >> >> way if this is not recommended).  WSDL2C generates the 
>following 
>> >> >> header code but I'm not sure what to do with each
>> >function (see my
>> >> >> inlined
>> >> >> questions):
>> >> >>
>> >> >>
>> >> >>   /***************** function prototypes - for header file 
>> >> >> *************/
>> >> >>   /**
>> >> >>    * axis2_stub_create_CalculatorService
>> >> >>    * Create and return the stub with services populated
>> >> >>    * @param env Environment ( mandatory)
>> >> >>    * @param client_home Axis2/C home ( mandatory )
>> >> >>    * @param endpoint_uri Service endpoint uri( optional )
>> >- if NULL
>> >> >> default picked from WSDL used
>> >> >>    * @return Newly created stub object
>> >> >>    */
>> >> >>   axis2_stub_t*
>> >> >>   axis2_stub_create_CalculatorService(const axutil_env_t *env,
>> >> >>       axis2_char_t *client_home,
>> >> >>       axis2_char_t *endpoint_uri);
>> >> >>   // wz: I looked at the math example source and thought
>> >> >>   // this function should correspond to axis2_math_stub.c's 
>> >> >> axis2_math_stub_create_with_endpoint_uri_and_client_home()?
>> >> >
>> >> >Yea, It is exactly the same..
>> >> >>
>> >> >>   /**
>> >> >>    * axis2_stub_populate_services_for_CalculatorService
>> >> >>    * populate the svc in stub with the service and operations
>> >> >>    * @param stub The stub
>> >> >>    * @param env environment ( mandatory)
>> >> >>    */
>> >> >>   void axis2_stub_populate_services_for_CalculatorService(
>> >> >> axis2_stub_t *stub, const axutil_env_t *env);
>> >> >>   // wz: implement it a la axis2_math_stub.c's 
>> >> >> axis2_populate_axis_service()?
>> >> >
>> >> >Yea that also do the same functionality.
>> >> >>
>> >> >>
>> >> >>   /**
>> >> >>    * axis2_stub_get_endpoint_uri_of_CalculatorService
>> >> >>    * Return the endpoint URI picked from WSDL
>> >> >>    * @param env environment ( mandatory)
>> >> >>    * @return The endpoint picked from WSDL
>> >> >>    */
>> >> >>   axis2_char_t *
>> >> >>   axis2_stub_get_endpoint_uri_of_CalculatorService(const
>> >> >axutil_env_t
>> >> >> *env);
>> >> >>   // wz: no question here
>> >> >>
>> >> >>
>> >> >>   /**
>> >> >>    * Auto generated function declaration
>> >> >>    * for
>> >> >>
>> 
>>"Arithmetic|http://xml.ms.com/ns/msjava/cxfutils/examples/calculator";
>> >> >> operation.
>> >> >>    * @param stub The stub (axis2_stub_t)
>> >> >>    * @param env environment ( mandatory)
>> >> >>
>> >> >>    * @param _arithmetic
>> >> >>    * return
>> >> >>      adb_ArithmeticResponse_t*
>> >> >>    */
>> >> >>
>> >> >>   adb_ArithmeticResponse_t*
>> >> >>   axis2_stub_op_CalculatorService_Arithmetic( axis2_stub_t 
>> >> >> *stub, const axutil_env_t *env,
>> >> >>       adb_Arithmetic_t* _arithmetic);
>> >> >>   // wz: how should this function extract input 
>parameters from 
>> >> >> _arithmetic and send them to the server?
>> >> >
>> >> >HI I suppose you have adb_Arithemetic.h/.c is generated
>> >with you.. If
>> >> >not you may have missed the -u in code generation.
>> >> >i.e. retry with WSD2C.sh -uri your.wsdl -u.
>> >> >
>> >> >Then the adb_Arithetic.h will have create function and several 
>> >> >setters and getters. You can use these functions to feed data to 
>> >> >adb_Arithematic object. The same with adb_Arithematic_Response
>> >> >
>> >> > I.e. your code will  look something like
>> >> >
>> >> >adb_Arithematic_t * ar;
>> >> >adb_Arithematic_Response_t * ares;
>> >> >
>> >> >ar = adb_Arithematic_set_someVar(ar, env, 5); //here someVar 
>> >> >should be replaced with actual fields
>> >> >
>> >> >ares = axis2_stub_op_CalculatorService_Arithmetic(stuv, env, ar);
>> >> >
>> >> >int i = adb_Arithematic_Response_get_anotherVar(ares, env);
>> >> >
>> >> >
>> >> >You can have a good idea on how to manipulate these adb object 
>> >> >from the "samples/codegen/client/calculator/test_calculator.c"
>> >> >sample in the axis2/c pack.
>> >> >
>> >> >
>> >> >>
>> >> >>
>> >> >>   /**
>> >> >>    * Auto generated function declaration
>> >> >>    * for
>> >> >>
>> 
>>"Arithmetic|http://xml.ms.com/ns/msjava/cxfutils/examples/calculator";
>> >> >> operation.
>> >> >>    * @param stub The stub
>> >> >>    * @param env environment ( mandatory)
>> >> >>
>> >> >>    * @param _arithmetic
>> >> >>    * @param user_data user data to be accessed by the callbacks
>> >> >>    * @param on_complete callback to handle on complete
>> >> >>    * @param on_error callback to handle on error
>> >> >>    */
>> >> >>
>> >> >>
>> >> >>
>> >> >>   void axis2_stub_start_op_CalculatorService_Arithmetic(
>> >> >axis2_stub_t
>> >> >> *stub, const axutil_env_t *env,
>> >> >>       adb_Arithmetic_t* _arithmetic,
>> >> >>       void *user_data,
>> >> >>       axis2_status_t ( AXIS2_CALL *on_complete ) (const 
>> >> >> axutil_env_t *,
>> >> >> adb_ArithmeticResponse_t* _arithmeticResponse, void *data) ,
>> >> >>       axis2_status_t ( AXIS2_CALL *on_error ) (const 
>> >> >> axutil_env_t *, int exception, void *data) );
>> >> >>   // wz: is this the asynchronous version of 
>> >> >> axis2_stub_op_CalculatorService_Arithmetic()?  What do I do
>> >> >with data?
>> >> >
>> >> >Oops! we have missed to mention this is async in the doc comment.
>> >> >(anway it is mentioned in the corrosponding .c file). I
>> >will correct
>> >> >that in the template.
>> >> >
>> >> >Yea this is async. The data is optional user data that can to be 
>> >> >passed to the callback..  IN the callback function
>> >prototype we have
>> >> >the data as the argument. This will be really useful to the user 
>> >> >to just parse the context to the callback.
>> >> >
>> >> >Thanks
>> >> >Dimuthu
>> >> >
>> >> >>
>> >> >>
>> >> >> Thanks,
>> >> >>
>> >> >> Wayne Zhang
>> >> >> Morgan Stanley | Technology
>> >> >> [EMAIL PROTECTED]
>> >> >>
>> >> >>
>> >> >>
>> >> >> >-----Original Message-----
>> >> >> >From: Dimuthu Gamage [mailto:[EMAIL PROTECTED]
>> >> >> >Sent: Wednesday, January 30, 2008 10:29 PM
>> >> >> >To: Apache AXIS C User List
>> >> >> >Subject: Re: Questions/suggestions on WSDL2C
>> >> >> >
>> >> >> >Please see my inline comment.
>> >> >> >
>> >> >> >On Jan 31, 2008 8:07 AM, Samisa Abeysinghe
>> ><[EMAIL PROTECTED]> wrote:
>> >> >> >> Dimuthu Gamage wrote:
>> >> >> >> > Hi Zhang,
>> >> >> >> >
>> >> >> >> > Thanks for your suggestions.
>> >> >> >> >
>> >> >> >> > 1). In fact generating a demo client is a good idea. I
>> >> >> >will look in to that.
>> >> >> >> > For the time being, I'm using a ruby script to
>> >generate simple
>> >> >> >> > demonstrations for stub and skels (it automatically
>> >> >> >generates simple
>> >> >> >> > logic with adb), if you find useful you can check it from
>> >> >> >> >
>> >> 
>>http://people.apache.org/~dimuthu/leisure/23_oct/generate_demos.rb.
>> >> >> >> >
>> >> >> >>
>> >> >> >> When there are so many operations, with complex params,
>> >> >how are we
>> >> >> >> supposed to generate a demo client?
>> >> >> >
>> >> >> >I think what we can provide is empty functions (with empty
>> >> >> >logic) as in server side. The adb object manipulation 
>should be 
>> >> >> >anyway done by the user. so we don't need to worry about 
>> >> >> >complex types in the demo client.. That indeed should be done 
>> >> >> >by
>> >the user.
>> >> >> >
>> >> >> >BTW the ruby script I mentioned there, recursively fills the 
>> >> >> >object matching pattern in the generated code.. That 
>works only
>> >> >for "in-out"
>> >> >> >MEP. Anyway what we are planning to generate with WSDL2C
>> >> >tool is not
>> >> >> >much complicated as that.
>> >> >> >
>> >> >> >Thanks
>> >> >> >Dimuthu
>> >> >> >
>> >> >> >> >
>> >> >> >> > 2). If we are generating makefiles we may need to
>> >think about
>> >> >> >> > both linux and windows users. And we have to decide
>> >whether to
>> >> >> >> > use automake build system or just a simple Makefile which 
>> >> >> >> > sometime not OS independent. May be some build system
>> >> >expert can help on this.
>> >> >> >> > Sanjaya,, Any Ideas?
>> >> >> >> >
>> >> >> >>
>> >> >> >> IMHO, automake makes things too complicated here. We can
>> >> >> >just generate
>> >> >> >> a simple Makefile tat could be used directly.
>> >> >> >>
>> >> >> >> Thanks,
>> >> >> >> Samisa...
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> > Thanks
>> >> >> >> > Dimuthu
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > On Jan 31, 2008 12:18 AM, Zhang, Wayne (IT) 
>> >> >> >> > <[EMAIL PROTECTED]> wrote:
>> >> >> >> >
>> >> >> >> >>
>> >> >> >> >> Hi,
>> >> >> >> >>
>> >> >> >> >> I just started looking at Axis2/C two days ago and it
>> >> >> >looks pretty
>> >> >> >> >> promising.  However I hit a snag using WSDL2C, and I
>> >> >> >couldn't find
>> >> >> >> >> any solutions in the mail archive, so apologies if this
>> >> >> >has already
>> >> >> >> >> been answered before.
>> >> >> >> >>
>> >> >> >> >> I am using WSDL2C to generate a simple 
>"calculator" client 
>> >> >> >> >> and server.  I followed the directions in your 
>user manual
>> >> >> >> >>
>> >(http://ws.apache.org/axis2/c/docs/axis2c_manual.html#wsdl2c)
>> >> >> >> >> and was able to generate my client stubs and server
>> >skeletons
>> >> >> >successfully.
>> >> >> >> >>
>> >> >> >> >> Implementing the server skeleton is pretty straight
>> >> >forward -- I
>> >> >> >> >> just added my business logic in the /* TODO ... */ field.
>> >> >> > However
>> >> >> >> >> implementing the client isn't as easy.  The user manual 
>> >> >> >> >> simply states "To do this, go through the header files 
>> >> >> >> >> generated and understand the API in line with the WSDL 
>> >> >> >> >> file that you used to generate the code."  It will be
>> >great if you
>> >> >> >> >> can provide
>> >> >> >a step-by-step example showing which functions to 
>implement in 
>> >> >> >what files.
>> >> >> >> >>
>> >> >> >> >> My other suggestions are:
>> >> >> >> >>
>> >> >> >> >> * Can WSDL2C generate a main() for the client 
>that sets up 
>> >> >> >> >> the default env/options and make required axis
>> >calls such as
>> >> >> >> >> axis2_endpoint_ref_create(),
>> >> >> >axis2_svc_client_send_receive(), etc.
>> >> >> >> >> and put
>> >> >> >> >> /* TODO */ hints to prompt users to add his 
>business logic?
>> >> >> >> >>
>> >> >> >> >> * It will be great if WSDL2C can also generate makefiles
>> >> >> >to assist
>> >> >> >> >> compiling the server and client, as well as install the
>> >> >> >server in $AXIS_HOME/services.
>> >> >> >> >> This will ease a user's development effort quite a bit.
>> >> >> >> >>
>> >> >> >> >> Many thanks in advance,
>> >> >> >> >>
>> >> >> >> >> Wayne Zhang
>> >> >> >> >> Morgan Stanley | Technology 750 Seventh Avenue, 
>12th Floor 
>> >> >> >> >> | New York, NY  10019
>> >> >> >> >> Phone: +1 212 762-1943
>> >> >> >> >> [EMAIL PROTECTED]
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>  ________________________________
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> NOTICE: If received in error, please destroy and
>> >notify sender.
>> >> >> >> >> Sender does not intend to waive confidentiality or
>> >privilege.
>> >> >> >> >> Use of this email is prohibited when received in error.
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >
>> >> >> >> >
>> >> >>
>> >>------------------------------------------------------------------
>> >> >> >--
>> >> >> >> > - To unsubscribe, e-mail:
>> >> >> >> > [EMAIL PROTECTED]
>> >> >> >> > For additional commands, e-mail:
>> >> >> >> > [EMAIL PROTECTED]
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> 
>>------------------------------------------------------------------
>> >> >-
>> >> >> >> -- To unsubscribe, e-mail:
>> >[EMAIL PROTECTED]
>> >> >> >> For additional commands, e-mail: 
>> >> >> >> [EMAIL PROTECTED]
>> >> >> >>
>> >> >> >>
>> >> >> >
>> >> >>
>> >>
>> 
>>>>-------------------------------------------------------------------
>> >>>-
>> >> >>-
>> >> >> >To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> >> >For additional commands, e-mail: 
>[EMAIL PROTECTED]
>> >> >> >
>> >> >> >
>> >> >> --------------------------------------------------------
>> >> >>
>> >> >> NOTICE: If received in error, please destroy and notify
>> >> >sender. Sender does not intend to waive confidentiality or
>> >privilege.
>> >> >Use of this email is prohibited when received in error.
>> >> >>
>> >> >>
>> >-------------------------------------------------------------------
>> >> >> -- To unsubscribe, e-mail: 
>[EMAIL PROTECTED]
>> >> >> For additional commands, e-mail: [EMAIL PROTECTED]
>> >> >>
>> >> >>
>> >> >
>> >>
>> 
>>>--------------------------------------------------------------------
>> >>-
>> >> >To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> >For additional commands, e-mail: [EMAIL PROTECTED]
>> >> >
>> >> >
>> >> --------------------------------------------------------
>> >>
>> >> NOTICE: If received in error, please destroy and notify
>> >sender. Sender does not intend to waive confidentiality or 
>privilege. 
>> >Use of this email is prohibited when received in error.
>> >>
>> >> 
>-------------------------------------------------------------------
>> >> -- To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> For additional commands, e-mail: [EMAIL PROTECTED]
>> >>
>> >
>> 
>>---------------------------------------------------------------------
>> >To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>> >
>> --------------------------------------------------------
>>
>> NOTICE: If received in error, please destroy and notify 
>sender. Sender does not intend to waive confidentiality or 
>privilege. Use of this email is prohibited when received in error.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--------------------------------------------------------

NOTICE: If received in error, please destroy and notify sender. Sender does not 
intend to waive confidentiality or privilege. Use of this email is prohibited 
when received in error.

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

Reply via email to