Solved

How to debug webservice method which use session?

Posted on 2014-02-22
10
376 Views
Last Modified: 2014-02-28
I've 100 webservice methods. I'm using Webservicestudio to test the methods. I would like to test method called UpdateEmployee which uses Session variable Session["EmpID"].

The session variable Session["EmpID"] is set in another method called Login. I would like to debug the method UpdateEmployee.

They are two different methods but need one session variable set in another method should be present.

How to achieve it? Kindly suggest.
0
Comment
Question by:Easwaran Paramasivam
  • 4
  • 2
  • 2
  • +1
10 Comments
 
LVL 16

Expert Comment

by:Kamal Khaleefa
ID: 39880289
hi

you can add a piece of code to insert the data into data base after each line of your code

for example

my functionWebServuce()
InsertToDB("Enter WebService")

code 1
code 2
code 3
InsertToDB("Execute Code 3")



end function
0
 
LVL 16

Author Comment

by:Easwaran Paramasivam
ID: 39880442
My problem is that the session variable set in one method how to retain in another method?
0
 
LVL 16

Expert Comment

by:Kamal Khaleefa
ID: 39880613
Try to pass it as a parameter to the other webservice
Or store it in the database and let the other webservice
Read it from data base
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 16

Author Comment

by:Easwaran Paramasivam
ID: 39880950
Both services are working fine. But wanted to test the second method alone independently.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 39882825
Pass EmpID as a parameter to the method?
0
 
LVL 16

Author Comment

by:Easwaran Paramasivam
ID: 39885337
No.. It is set in Session by another method.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 39885364
That was a suggestion actually.
0
 
LVL 25

Accepted Solution

by:
apeter earned 500 total points
ID: 39893260
split the method into two. Where one method just has session code and call another method by passing the data. In this way, you test the logic by testing the second method. Hope this helps.
0
 
LVL 16

Author Closing Comment

by:Easwaran Paramasivam
ID: 39895251
Thanks.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question