axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deepal Jayasinghe <dee...@opensource.lk>
Subject Re: Session Not Working For Cleint App
Date Mon, 08 Oct 2007 16:11:58 GMT
Hi Golam
Seems like your code is bit error prone.
See my fixed inline
>
>  
>
> My client is not working: Problem not keeping the session.
>
>  
>
> If I try with browser the session works but it does not work if I use
> the java client application. Please give me some pointer on what do I
> have to do in order to make the client work.
>
>  
>
> Thanks for all your help with you all I could have come this far.
>
> Golam
>
>  
>
>  
>
> * *
>
> *Client code:*
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> package com.fw.ws;
>
>  
>
> import java.rmi.RemoteException;
>
>  
>
> import org.apache.axis2.AxisFault;
>
> import org.apache.axis2.client.Options;
>
> import org.apache.axis2.client.ServiceClient;
>
>  
>
> import com.fw.ws.FieldTrackerWSStub.Customer;
>
> import com.fw.ws.FieldTrackerWSStub.Fleet;
>
> import com.fw.ws.FieldTrackerWSStub.Vehicle;
>
> import com.fw.ws.FieldTrackerWSStub.Data;
>
>  
>
> import com.fw.ws.FieldTrackerWSStub.GetHistoryData;
>
> import com.fw.ws.FieldTrackerWSStub.GetHistoryDataResponse;
>
>  
>
> import com.fw.ws.FieldTrackerWSStub.GetVehicleIds;
>
> import com.fw.ws.FieldTrackerWSStub.GetVehicleIdsResponse;
>
>  
>
>  
>
> import com.fw.ws.FieldTrackerWSStub.CustomerHasAccess;
>
> import com.fw.ws.FieldTrackerWSStub.CustomerHasAccessResponse;
>
>  
>
> import com.fw.ws.FieldTrackerWSStub.IsValid;
>
> import com.fw.ws.FieldTrackerWSStub.IsValidResponse;
>
>  
>
>  
>
>  
>
> public class WebServiceClient {
>
>  
>
>         public static void main(String[] args) {
>
>                 try {
>
>                         String vehicleId = "3";
>
>                         String fleetId = "1";
>
>                         String startTime = "2006-07-28";
>
>                         String endTime = "2006-07-28";
>
>                        
>
>                        //Options options = new Options();
>
>                         
>
>                        // options.setManageSession(true);
>
>                        // ServiceClient sender = new ServiceClient();
>
>                        // sender.setOptions(options);
>
>                        
>
>                         ServiceClient client = new ServiceClient();
>
>                         client.getOptions().setManageSession(true);
>
>                        
>
>                        
>
>                        
>
>                         FieldTrackerWSStub stub = new
> FieldTrackerWSStub("http://localhost:8081/FWWS/services/FieldTrackerWS");
>
stub._getServiceClinet().getOptions().setManageSession(true);
>
>                        
>
>                       
>
>                        
>
>                         //first login
>
>                         IsValid login = new IsValid();
>
>                         login.setUsername("aa");
>
>                         login.setPassword("aaaaa");
>
>                        
>
>                         //get the response for the login
>
>                         IsValidResponse loginResp =  stub.isValid(login);
>
>                         System.out.println("Login:
> "+loginResp.getLogin());
>
>                        
>
>                     
>
>                       
>
>                         //once login is valid then get data
>
>                            if(loginResp.getLogin()){
>
>                                                
>
>                                    
>
>                                    
>
>                                     GetVehicleIds vehicleIds = new
> GetVehicleIds();
>
>                                     vehicleIds.setFleetId(fleetId);
>
>                                     //sender.
>
>                                     GetVehicleIdsResponse
> vehicleIdsResponse = stub.getVehicleIds(vehicleIds);
>
>                                    
>
>                                     String [] ids =
> vehicleIdsResponse.getVehicleId();
>
>                                     System.out.println("vehicle
> id:"+ids[0]);
>
>                                    
>
>                                    
>
>                                    
>
>                         }
>
>                         else{
>
>                                     System.out.println("Login in
> Invalid");
>
>                         }
>
>                         
>
>                        
>
>                
>
>                 } catch (AxisFault e) {
>
>                         e.printStackTrace();
>
>                 } catch (RemoteException e) {
>
>                         e.printStackTrace();
>
>                 }
>
>                          catch(SQLExceptionException0 e) {
>
>                                                 e.printStackTrace();
>
>                         }
>
>  
>
>         }
>
> }
>
>  
>
>  
>
*Thanks
Deepal
*



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


Mime
View raw message