Skip to Content

Question regarding implementation of Portal Service

Hello,

I want to create a portal service that calls our R/3 system and comes back with customer master data. For that I have to hand over the userid to the portal service.

The Interface looks like that:

import com.sapportals.portal.prt.service.IService;
import com.lgs.model.CustomerDataBean;

public interface IR3CustDataService extends IService
{
    public static final String KEY = "R3CustDataService";
    
    // returns an object with all customer master data from R/3
	public CustomerDataBean getCustomerData(String userid); 
}

The implementation of the method in the corresponding class is:

CustomerDataBean cdb = new CustomerDataBean();

public CustomerDataBean getCustomerData(String userid) {
		return cdb;
}

Now I would implement the program logic (accessing R/3 and fill the CustomerDataBean) in the init method of the portal service class.

public void init(IServiceContext serviceContext) {
                mm_serviceContext = serviceContext;

                implementation of program logic, usage of userid necessary

}

My question is now how I can use the String userid in the init method? How can I hand over the userid to the init method so that I can use it?

Any hint is really appreciated!

Thanks a lot.

Arno

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 15, 2009 at 08:37 AM

    Hi Arno,

    declare the userId as class variable so that you can use it in any method of the class.

    Regards

    Narendra

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 15, 2009 at 08:40 AM

    You cannot pass any additional parameters in the init method. This is a method that gets automatically called by the portal itself and not by you. The init method is not thought for performing any complex logic, it's just there to set up the service itself and maybe also some of your own members.

    You have to provide an own init method to which you can pass the userid (and maybe also other attributes that may be needed) that can afterwards be saved as class members. You can define an own boolean flag for assuring that your own init method gets called only once (if this is needed... but for your scenario this may not be needed, because I think you want to have the possibility to pass severeal different userids?).

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 15, 2009 at 09:45 AM

    Hi Arno,

    You can create a method where you can get the userid and then call this method in the init().

    Make the userid as Global Variable by declaring it in others.

    Regards.

    Rajat

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 15, 2009 at 10:17 AM

    hi

    MY level of understandind u r problem is

    by application u r sending the username and password to the portal and getting the required data by beans

    if so

    check this it may be usefull foru

    Integrating External Application Services without Web service

    bvr

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.