axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manjula Peiris <manj...@wso2.com>
Subject Re: rampart/c not working with stubs generated using wsdl2c
Date Tue, 24 Jul 2007 16:47:54 GMT
Hi Sharada,

We found the reason for rampart not working with generated stubs. It is
due to a bug in the wsdl2c tool. The generated code does not add
gloabally engaged phase info to the service. Until this is fixed in the
next release you can add the following code segement to the generated
code. I have successfully sent security headers through this fix in the
generated client stub code.

You need to modify the axis2_stub_PositionService_populate_services
method in the axis2_stub_PositionService.c file as follows. The manually
added code is in between /***New code****/ tags.

void axis2_stub_PositionService_populate_services( axis2_stub_t *stub,
const axutil_env_t *env)
      {
         axis2_svc_client_t *svc_client = NULL;
         axutil_qname_t *svc_qname =  NULL;
         axutil_qname_t *op_qname =  NULL;
         axis2_svc_t *svc = NULL;
         axis2_op_t *op = NULL;

	/********************** New Code*******************/

 	 axis2_phases_info_t *info = NULL;
         axis2_svc_ctx_t *svc_ctx = NULL;
         axis2_conf_ctx_t *conf_ctx = NULL;
         axis2_conf_t *conf = NULL;

	/*************************New Code***************/


         /* Modifying the Service */
         svc_client = axis2_stub_get_svc_client (stub, env );
         svc = (axis2_svc_t*)axis2_svc_client_get_svc( svc_client,
env );

	/***************** New code *************************/

        svc_ctx = axis2_svc_client_get_svc_ctx(svc_client, env);
         conf_ctx = axis2_svc_ctx_get_conf_ctx(svc_ctx, env);
         conf = axis2_conf_ctx_get_conf(conf_ctx, env);
         info =  axis2_conf_get_phases_info(conf, env);

	/****************New Code **************************/

         axutil_qname_create(env,"PositionService" ,NULL, NULL);
         axis2_svc_set_qname (svc, env, svc_qname);

         /* creating the operations*/



           op_qname = axutil_qname_create(env,
                                         "getPositionDetail" ,

"http://com.pfpc.ecommerce.services.position",
                                         NULL);
           op = axis2_op_create_with_qname(env, op_qname);

               axis2_op_set_msg_exchange_pattern(op, env,
AXIS2_MEP_URI_OUT_IN);

	/*********** New Code *******************/

	axis2_phases_info_set_op_phases(info, env, op);
		
	/**************New code************/

           axis2_svc_add_op(svc, env, op);


      }


Try this. This will work. I will raise a jira issue on this.

Thanks
-Manjula.




On Mon, 2007-07-23 at 18:17 +0530, Kaushalye Kapuruge wrote:
> No problem I'll have a look.
> It's better if we post this in the mailing list.:). Fwding...
> -Kaushalye
> 
> sharada.deshpande@pfpc.com wrote:
> > Hi Kaushalye,
> >
> >                 Thanks for looking into the issue for me. Here are the
> > client stub and my client program.
> >
> > (See attached file: BL_client.c)(See attached file:
> > axis2_stub_PositionService.c)
> >
> > Here is my client program that has the request created manually. This works
> > fine.             (See attached file: BL_client-manual.c)
> >
> > Thanks
> > Sharada
> >
> >
> >
> >
> >                                                                            
> >              Kaushalye                                                     
> >              Kapuruge                                                      
> >              <kaushalye@wso2.c                                          To 
> >              om>                       Apache AXIS C User List             
> >                                        <axis-c-user@ws.apache.org>       
 
> >              07/23/2007 08:06                                           cc 
> >              AM                                                            
> >                                                                    Subject 
> >                                        Re: rampart/c not working with      
> >              Please respond to         stubs generated using wsdl2c        
> >               "Apache AXIS C                                               
> >                 User List"                                                 
> >              <axis-c-user@ws.a                                             
> >                 pache.org>                                                 
> >                                                                            
> >                                                                            
> >
> >
> >
> >
> > Hi Sharada,
> > Could you pls send us the generated client code?
> > Then we can see what's wrong with it. Reading the log it's clear that
> > Rampart is not in the outgoing path for the generated client. So there
> > is no way of adding security headers.
> > Also we believe that you have specified AXIS2C_HOME correctly.
> > Cheers,
> > Kaushalye
> >
> > sharada.deshpande@pfpc.com wrote:
> >   
> >> Hi Manjula,
> >>
> >> Here is the axis2.xml I am using.(See attached file: axis2.xml)
> >>
> >>            I am using the same axis2.xml file in both manual and through
> >> stub. After seeing your reply I thought may be my stub program is not
> >> invoking the correct axis2.xml and added the following line in my stub.
> >>       axis2_svc_client_engage_module(svc_client, env,"rampart");
> >>
> >> But now I see the error that rampart is already engaged. That means it is
> >> reading from both axis2.xml and my stub, right?
> >>
> >> [Mon Jul 23 07:24:49 2007] [debug]
> >> ..\..\src\core\phaseresolver\phase_holder.c(129) Add handler
> >> RampartOutHandler to phase MessageOut
> >> [Mon Jul 23 07:24:49 2007] [info]  [rampart][mod_rampart] mod_rampart
> >> initialized
> >> [Mon Jul 23 07:24:49 2007] [debug]
> >> ..\..\src\core\phaseresolver\phase_resolver.c(117) Service name is :
> >> __ANONYMOUS_SERVICE__
> >> [Mon Jul 23 07:24:49 2007] [debug]
> >> ..\..\src\core\phaseresolver\phase_resolver.c(231) module name is:rampart
> >> [Mon Jul 23 07:24:49 2007] [debug]
> >> ..\..\src\core\phaseresolver\phase_resolver.c(231) module name is:rampart
> >> [Mon Jul 23 07:24:49 2007] [debug]
> >> ..\..\src\core\phaseresolver\phase_holder.c(129) Add handler
> >> RampartOutHandler to phase MessageOut
> >> [Mon Jul 23 07:24:49 2007] [debug]
> >> ..\..\src\core\phaseresolver\phase_resolver.c(231) module name is:rampart
> >> [Mon Jul 23 07:24:49 2007] [debug]
> >> ..\..\src\core\phaseresolver\phase_resolver.c(231) module name is:rampart
> >> [Mon Jul 23 07:24:49 2007] [debug]
> >> ..\..\src\core\phaseresolver\phase_resolver.c(231) module name is:rampart
> >> [Mon Jul 23 07:24:49 2007] [debug]
> >> ..\..\src\core\phaseresolver\phase_resolver.c(231) module name is:rampart
> >> [Mon Jul 23 07:24:49 2007] [debug]
> >> ..\..\src\core\phaseresolver\phase_holder.c(129) Add handler
> >> RampartOutHandler to phase MessageOut
> >> [Mon Jul 23 07:24:49 2007] [debug]
> >> ..\..\src\core\phaseresolver\phase_resolver.c(231) module name is:rampart
> >> [Mon Jul 23 07:24:49 2007] [debug]
> >> ..\..\src\core\phaseresolver\phase_resolver.c(231) module name is:rampart
> >> [Mon Jul 23 07:24:49 2007] [debug]
> >> ..\..\src\core\phaseresolver\phase_resolver.c(231) module name is:rampart
> >> [Mon Jul 23 07:24:49 2007] [debug]
> >> ..\..\src\core\phaseresolver\phase_resolver.c(231) module name is:rampart
> >> [Mon Jul 23 07:24:49 2007] [debug]
> >> ..\..\src\core\phaseresolver\phase_holder.c(129) Add handler
> >> RampartOutHandler to phase MessageOut
> >> [Mon Jul 23 07:24:49 2007] [debug]
> >> ..\..\src\core\phaseresolver\phase_resolver.c(231) module name is:rampart
> >> [Mon Jul 23 07:24:49 2007] [debug]
> >> ..\..\src\core\phaseresolver\phase_resolver.c(231) module name is:rampart
> >> [Mon Jul 23 07:24:49 2007] [debug]
> >> ..\..\src\core\phaseresolver\phase_resolver.c(117) Service name is :
> >> __ANONYMOUS_SERVICE__
> >> [Mon Jul 23 07:24:49 2007] [debug]
> >> ..\..\src\core\phaseresolver\phase_resolver.c(1298) Module rampart
> >>     
> > already
> >   
> >> engaged.
> >> [Mon Jul 23 07:24:49 2007] [debug]
> >> ..\..\src\core\phaseresolver\phase_resolver.c(1298) Module rampart
> >>     
> > already
> >   
> >> engaged.
> >> [Mon Jul 23 07:24:49 2007] [debug]
> >> ..\..\src\core\phaseresolver\phase_resolver.c(1502) Handler inclusion
> >> failed for MessageOut phase
> >> [Mon Jul 23 07:24:51 2007] [debug]
> >> ..\..\src\core\transport\http\sender\http_transport_sender.c(566) OP name
> >> axutil_qname_get_localpart = http://www.w3.org/2004/08/wsdl/out-in
> >> [Mon Jul 23 07:24:51 2007] [debug]
> >>     
> > ..\..\axiom\src\soap\soap_builder.c(737)
> >   
> >> Identified soap version is soap11
> >> [Mon Jul 23 07:24:51 2007] [debug] ..\..\src\core\engine\engine.c(179)
> >> Axis2 engine send successful
> >>
> >> Thank you
> >> Sharada
> >>
> >>
> >>
> >>
> >>     
> >
> >   
> >>              Manjula Peiris
> >>     
> >
> >   
> >>              <manjula@wso2.com
> >>     
> >
> >   
> >>              >
> >>     
> > To
> >   
> >>                                        Apache AXIS C User List
> >>     
> >
> >   
> >>              07/23/2007 05:01          <axis-c-user@ws.apache.org>
> >>     
> >
> >   
> >>              AM
> >>     
> > cc
> >   
> >
> >   
> > Subject
> >   
> >>              Please respond to         Re: rampart/c not working with
> >>     
> >
> >   
> >>               "Apache AXIS C           stubs generated using wsdl2c
> >>     
> >
> >   
> >>                 User List"
> >>     
> >
> >   
> >>              <axis-c-user@ws.a
> >>     
> >
> >   
> >>                 pache.org>
> >>     
> >
> >   
> >
> >   
> >
> >   
> >
> >   
> >>
> >>
> >> Hi Sharda,
> >>
> >> To add wsse:headers you have to engage rampart. Seems to me rampart
> >> module is not engaged in the generated code. How did you engage rampart
> >> in the working code where you have created the soap body manually?
> >>
> >> You have two options to engage rampart.
> >>
> >> 1. Adding a module ref entry in axis2.xml.
> >>
> >> <module ref="rampart"/>
> >>
> >> 2. Engaging programmatically from your client code.
> >>
> >> axis2_svc_client_engage_module(svc_client, env,"rampart");
> >>
> >> If you can, please send the axis2.xml you are using.
> >>
> >> Thanks
> >> -Manjula.
> >>
> >> On Sun, 2007-07-22 at 09:47 -0400, sharada.deshpande@pfpc.com wrote:
> >>
> >>     
> >>> Hi,
> >>>
> >>>      My webservice client program with rampart/c configured to add wsse
> >>> headers works when I create the soap body manually and call the method
> >>> axiom_node_t* ret_node = axis2_svc_client_send_receive(svc_client, env,
> >>> payload);
> >>>
> >>> (See attached file: BL_client.log)
> >>>
> >>>
> >>> But with the same rampart/c and axis2.xml configuration, if I try to use
> >>> the stubs generated by wsdl2c tool, I do not see the wsse:headers added
> >>>
> >>>       
> >> to
> >>
> >>     
> >>> the request. Any ideas why?
> >>>
> >>> (See attached file: BL_client_stub.log)
> >>>
> >>> I have both working and not-working logs attached.
> >>>
> >>>
> >>> Thank a lot
> >>> Sharada
> >>>
> >>> The contents of this email are the property of the sender. If it was not
> >>>
> >>>       
> >> addressed to you, you have no legal right to read it. If you think you
> >> received it in error, please notify the sender. Do not forward or copy
> >> without permission of the sender.
> >>
> >>     
> >>> --------------------------------------------------------------------- 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
> >>
> >>
> >>
> >> The contents of this email are the property of the sender. If it was not
> >>     
> > addressed to you, you have no legal right to read it. If you think you
> > received it in error, please notify the sender. Do not forward or copy
> > without permission of the sender.
> >   
> >> ------------------------------------------------------------------------
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
> >> For additional commands, e-mail: axis-c-user-help@ws.apache.org
> >>     
> >
> >
> > --
> > http://kaushalye.blogspot.com/
> > http://wso2.org/
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-c-user-help@ws.apache.org
> >
> >
> >
> > The contents of this email are the property of the sender. If it was not addressed
to you, you have no legal right to read it. If you think you received it in error, please
notify the sender. Do not forward or copy without permission of the sender.
> 
> 


---------------------------------------------------------------------
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