axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dimuthu Gamage" <dimut...@gmail.com>
Subject Re: Questions/suggestions on WSDL2C
Date Thu, 31 Jan 2008 22:44:12 GMT
Hi Zhang,
Please see my inline comment to the code..

On Feb 1, 2008 1:30 AM, Zhang, Wayne (IT) <Wayne.Zhang@morganstanley.com> 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
> Wayne.Zhang@morganstanley.com
>
>
>
> >-----Original Message-----
> >From: Dimuthu Gamage [mailto:dimuthuc@gmail.com]
> >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 <samisa@wso2.com> 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)
> >> > <Wayne.Zhang@morganstanley.com> 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
> >> >> Wayne.Zhang@morganstanley.com
> >> >>
> >> >>
> >> >>  ________________________________
> >> >>
> >> >>
> >> >> 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: axis-c-user-unsubscribe@ws.apache.org
> >> > For additional commands, e-mail: axis-c-user-help@ws.apache.org
> >> >
> >> >
> >> >
> >> >
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
> >> For additional commands, e-mail: axis-c-user-help@ws.apache.org
> >>
> >>
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
> >For additional commands, e-mail: axis-c-user-help@ws.apache.org
> >
> >
> --------------------------------------------------------
>
> 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: axis-c-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-c-user-help@ws.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-user-help@ws.apache.org


Mime
View raw message