It may be the strings. Are they copied inside
the lib or the passed references are used?
If so, assign them all to separate nouns and
keep them around until the "call".

--- Yuvaraj Athur Raghuvir <[EMAIL PROTECTED]> wrote:

> Hello Oleg,
> 
> 1) I use the axis2c 1.0 libraries and sample as available at this
> place<http://ws.apache.org/axis2/c/download.cgi>
> .[1]
> 
> 2) The sample I am trying out is the yahoo_client.c. The code is here [2]
> 
> 3) I wrote the same in J. The code is here [3]
> 
> I have isolated the offending line in a call method. When I invoke this
> method, J.exe crashes.  When debugged from VC, this leads to a function call
> invocation that is prepared by the various libraries before the call is
> made. So, an access is made into the J.exe process space that results in a
> violation.
> 
> The way I went about the code is like follows:
> a) Get the yahoo_client.c to work. (It cashes later on some free calls but
> that I have not yet investigated)
> b) Write the j version as a translation of dll calls using the declarations
> as I found fit. For this I looked into the lib files to identify the
> exported function name and used the header files to deduce the declarations.
> 
> c) There are no cd errors so far - only a big crash!!
> 
> (Note: I could have attached files but I am not sure if this mail server
> accepts attachments. So I have pasted the whole code).
> 
> Do let me know if you have some ideas that I can try out.
> 
> Regards,
> Yuva
> 
> 
> 
> 
> [1] http://ws.apache.org/axis2/c/download.cgi
> [2]
> int main (int argc, char *argv[])
> {
>     const axutil_env_t *env = NULL;
>     const axis2_char_t *address = NULL;
>     axis2_endpoint_ref_t* endpoint_ref = NULL;
>     axis2_options_t *options = NULL;
>     const axis2_char_t *client_home = NULL;
>     axis2_svc_client_t* svc_client = NULL;
>     axiom_node_t *payload = NULL;
>     axiom_node_t *ret_node = NULL;
>     axis2_char_t *search_string = NULL;
> 
>     if (argc > 1)
>     {
> 
>         if (!strcmp (argv[1], "-h") || !strcmp (argv[1], "--help"))
>         {
>             print_help ();
>         }
>         else
>             search_string = argv[1];
>     }
> 
> 
>     env = axutil_env_create_all("yahoo_rest_search.log",
> AXIS2_LOG_LEVEL_TRACE);
>     address = "http://search.yahooapis.com/WebSearchService/V1/webSearch";;
> 
>     printf ("using endpoint %s \n", address);
> 
>     endpoint_ref = axis2_endpoint_ref_create(env, address);
> 
>     options = axis2_options_create(env);
>     axis2_options_set_to(options, env, endpoint_ref);
> 
>     axis2_options_set_enable_rest(options, env, AXIS2_TRUE);
>     axis2_options_set_http_method(options, env, AXIS2_HTTP_GET);
> 
>     client_home = AXIS2_GETENV("AXIS2C_HOME");
>     if (!client_home || !strcmp (client_home, ""))
>         client_home = "../..";
> 
>     /* Create service client */
>     svc_client = axis2_svc_client_create(env, client_home);
>     if (!svc_client)
>     {
>         printf("Error creating service client, Please check AXIS2C_HOME
> again\n");
>         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Stub invoke FAILED: Error
> code:"
>                 " %d :: %s", env->error->error_number,
>                 AXIS2_ERROR_GET_MESSAGE(env->error));
>           return -1;
>     }
> 
>     /* Set service client options */
>     axis2_svc_client_set_options(svc_client, env, options);
> 
>     /* adding proxy support */
>     axis2_svc_client_set_proxy(svc_client,env, "proxy","8080");
> 
>     /* Build the SOAP request message payload using OM API.*/
>     payload = build_yahoo_rest_payload (env, search_string);
> 
>     /* Send request */
>     ret_node = axis2_svc_client_send_receive(svc_client, env, payload);
> 
>     if (ret_node)
>     {
>         format_output (env, ret_node);
>         printf("\necho client invoke SUCCESSFUL!\n");
>     }
>     else
>     {
>         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Stub invoke FAILED: Error
> code:"
>                 " %d :: %s", env->error->error_number,
>                 AXIS2_ERROR_GET_MESSAGE(env->error));
>         printf("Yahoo REST client invoke FAILED!\n");
>     }
> 
>     if (svc_client)
>     {
>         axis2_svc_client_free(svc_client, env);
>         svc_client = NULL;
>     }
>     return 0;
> }
> 
> [3]
> ROOTDIR =: jpath '~user\projects\websvc\'
> NB. v1 : echo application
> d=. (<jhostpath ROOTDIR,'lib/') ,&.> cut 'axiom.dll 
> axutil.dllaxis2_engine.dll'
> 'AXIOM UTILITY ENGINE' =:    ('"'&,@],&'" ') L:0 d
> NB.DEBUG
> ENGINE =: 'C:\08.Utils\axis2\axis2c-
> bin-1.0.0-win32\samples\WebServiceSamples\debug\Engine.dll  '
> NB. AXIOM =:  'C:\08.Utils\axis2\axis2c-
> bin-1.0.0-win32\samples\WebServiceSamples\debug\Axiom.dll  '
> 
> cdu =: 1 : '(UTILITY,m)&cd'
> cde =: 1 : '(ENGINE,m)&cd'
> cda =: 1 : '(AXIOM,m)&cd'
> 
> NB. win32
> setenv           =:            'kernel32 SetEnvironmentVariableA  > i *c
> *c'&cd
> 
> NB. methods
> strcmp           =:            '[EMAIL PROTECTED]  > i *c *c' cdu
> env_create_all =:             '[EMAIL PROTECTED]  > i *c i' cdu
> 
> endpoint_ref   =:            '[EMAIL PROTECTED] >  i i *c' cde
> options_create =:            '[EMAIL PROTECTED] > i i' cde
> options_set_to =:             '[EMAIL PROTECTED] > i i i i' cde
> options_set_enable_rest=:    '[EMAIL PROTECTED] > i i i i'
> cde
> options_set_http_method =:    '[EMAIL PROTECTED] > i i i *c'
> cde
> svc_client_create =:        '[EMAIL PROTECTED] > i i *c' cde
> svc_client_set_options=:    '[EMAIL PROTECTED] > i i i i' cde
> svc_client_set_proxy=:        '[EMAIL PROTECTED] > i i i *c *c'
> cde
> svc_client_send_receive =:     '[EMAIL PROTECTED] > i i i i'
> cde
> node_create =:                 '[EMAIL PROTECTED] > i i' cda
> element_create =:             '[EMAIL PROTECTED] > i i i *c i i' cda
> element_set_text =:            '[EMAIL PROTECTED] > i i i *c i' cda
> 
> NB. enumerations
> 'L_CRITICAL L_ERROR L_WARNING L_INFO L_DEBUG L_TRACE' =: 0 1 2 3 4 5
> 'TRUE FALSE' =: 1 0
> HTTP_GET =: 'GET'
> 
> NB. Test
> evp =: ROOTDIR
> evv =: 'AXIS_HOME'
> setenv evv;evp
> l =: ROOTDIR,'/logs/test_yahoo.log'
> a =: 'http://search.yahooapis.com/WebSearchService/V1/webSearch'
> e =: env_create_all l;L_TRACE
> ep =: endpoint_ref e;a
> op =: options_create <e
> options_set_to op;e;ep
> options_set_enable_rest op;e;TRUE
> options_set_http_method op;e;HTTP_GET
> c =: svc_client_create e;ROOTDIR NB. axis2.xml + modules/ + services/
> svc_client_set_options c;e;op
> svc_client_set_proxy c;e;'proxy';'8080'
> 
> NB. build payload
> rn =: node_create <e
> an =: node_create <e
> qn =: node_create <e
> re =: element_create e;0;'yahoo_rest_search';0;rn
> ae =: element_create e;rn;'appid';0;an
> element_set_text ae;e;'Yahoo Demo';an
> qe =: element_create e;rn;'query';0;qn
> element_set_text qe;e;'finance';qn
> 
> NB. make the call
> NB. retn =: svc_client_send_receive c;e;rn
> call =: 3 : 0
>     try.
>         retn =: svc_client_send_receive c;e;rn
>     catch.
>         smoutput 'error occurred'
>     end.
> )
> 
> 
> 
> On 8/8/07, Oleg Kobchenko <[EMAIL PROTECTED]> wrote:
> >
> > You need to be either more specific, or the
> > general advice is use the debuggers (J and C++)
> > and trace up to the offending line and observe all
> > the parameters carefully. This will involve a lot
> > of crashes and restarts, which is normal. As you
> > gain more handle over it, you will be constructing the
> > definitions and preparing parameters that will work
> > without crashing the first time around.
> >
> > Can you privide a few representative code samples
> > what you are doing?
> >
> >
> > --- Yuvaraj Athur Raghuvir <[EMAIL PROTECTED]> wrote:
> >
> > > Hello,
> > >
> > > I started the implementation of my own wrapper. Now, almost all the
> > calls
> > > are going fine. At the critical point when I have to establish the
> > > connection and send the message, there is an  Access Violation that
> > brings
> > > down J environment. I am able to execute the same sequence of calls from
> > a
> > > simple client application.
> > >
> > > Now, how to debug this access violation?
> > >
> > > 1) I have done a simple mapping of pointers to structures as integers.
> > This
> > > seems to work because all I do is manage the various pointers - get it
> > from
> > > one call and pass it to the other. But is this the right way?
> > >
> > > 2) I built the engine in the VC++ Express edition. However, all I get to
> > > understand if that a certain call causes a access violation in j.exe and
> > the
> > > second time J crashes. This is related to invoking a function pointer
> > buried
> > > deep in the various pointers I manage from J.
> > >
> > > Any clues?
> > >
> > > Regards,
> > > Yuva
> > >
> > > p.s: If you need more info on the code I have written, just let me know
> > and
> > > I shall paste the code into the mail (the C/C++ working version & my J
> > > translation)
> > >
> > > On 7/18/07, Yuvaraj Athur Raghuvir <[EMAIL PROTECTED]> wrote:
> > > >
> > > > Hello,
> > > >
> > > > I recently came across Axis2C - a C implementation for Web Service
> > > > Consumption - developed by Apache (http://ws.apache.org/axis2/c/)
> > > >
> > > > Looking at the example clients that comes with the installation, I
> > think
> > > > it would be quite straight forward to provide a web service client
> > facility
> > > > in J via an addon.
> > > >
> > > > Being a novice at DLL integration into J, I was wondering if someone
> > else
> > > > is looking into this.
> > > >
> > > > I think adding this as another package under JAL would be quite
> > useful.
> > > >
> > > > Let me know.
> > > >
> > > > Thanks,
> > > > Yuva
> > > >
> > > >
> > > ----------------------------------------------------------------------
> > > For information about J forums see http://www.jsoftware.com/forums.htm
> > >
> >
> >
> >
> >
> >       
> > ____________________________________________________________________________________
> > Park yourself in front of a world of choices in alternative vehicles.
> > Visit the Yahoo! Auto Green Center.
> > http://autos.yahoo.com/green_center/
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> 



      
____________________________________________________________________________________
Fussy? Opinionated? Impossible to please? Perfect.  Join Yahoo!'s user panel 
and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to