cancel
Showing results for 
Search instead for 
Did you mean: 

Calling a Portal Service from within a Web Dynpro DC

Former Member
0 Kudos

Hello,

I am trying to call a Portal Service from within a Web Dynpro development component without sucess.

Can anyone give me some hints on the necessary steps in order to accomplish this task?

Thanks

Diz

Accepted Solutions (1)

Accepted Solutions (1)

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

<u>Steps.</u>:

1.)Add jar files (portal services API) in “Java Build Path”

You need to include the “prtapi.jar” file as well.

of your WebDynpro project.

2.) Add portal applicatoin names (= par file names)

as “Web Dynpro References”.

“Web Dynpro Reference” > “Sharing reference” tab

portal:sap.com/<Portal Application name>

3.) Call portal services with “WDPortalUtils” class API.

IMyPortalService portalservice=(IMyPortalService)WDPortalUtils.getServiceRefrence(parname.servicename);

portalservice.metnod();

Regards

Vijay

Former Member
0 Kudos

Hello,

Thanks for your anwsers.

Yes, those steps are the ones I used to do with Web Dynpro Projects. But I think that those steps are not enough anymore when we are working with DCs.

Something's missing because I am not able to do a DC build.

Regards,

Diz

former_member182372
Active Contributor
0 Kudos

Hi Diz,

In case you are using DC - add "default" public part from compartment - SAP_JTECHS, DC - epbc.prtapi._api to your DC`s "Used DCs".

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

OK,

I am going crazy with this one... here is what I have done:

1. Created a DC of type "Portal Application Standalone";

2. The wizard automatically creates the Public Parts;

3. Created a portal service;

4. Build & Deployed both OK;

Everything OK...

5. Created a DC of type Web Dynpro;

6. Added the Portal Application DC as a "Used DC";

7. Added SAP_JTECHS -> epbc.prtapi._api as a "Used DC";

8. Both were added with dependency type "Build Time";

9. IMySrv srv = (IMySrv)WDPortalUtils.getServiceReference(IMySrv.KEY);

10. Build & Deployed both OK;

When I run the Web Dynpro application I am not able to get a reference to the service. I get srv = null;

Any help would be much appreciated.

Thanks

Diz

Former Member
0 Kudos

OK... it's working.

Two things to add:

The dependency type for portal app dc must be build time and also run time;

We must manually add the portal service java class to the Public Part generated by the wizard on the portal app dc.

Kind Regards,

Diz

former_member182372
Active Contributor
0 Kudos

Hi Diz,

In case your problem is solved, please, mark thread as solved to keep experience and let others re-use it.

Best regards, Maksim Rashchynski.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Diz,

I tried doing the same thing by following the steps as mentioned by you. Just to re iterate,

1. Created a DC "Portal Application Standalone" project by the name myservice.

2. Created a portal service inside myservice by the ame AmitsService.

3. Exposed IAmitsService.class in the public part.

4 Build and deployed the DC on server and tested it through an abstract portal component and it worked FINE !!

Now..

5. Created anoter DC of type WebDynPro

6. Added SAP_JTECHS -> epbc.prtapi._api as a "Used DC" with dependency build time and runtime

7. Specified the sharing reference in the properties as PORTAL:sap.com/myservice

8. Tried to reference the service using the following code..

IAmitsService portalservice=(IAmitsService)WDPortalUtils.getServiceReference(IAmitsService.KEY);

9.Build and deployed the DC.

10. When I run the application I am getting the following error

Processing HTTP request to servlet [dispatcher] finished with error.

The error is: com.sap.engine.frame.core.load.SAPNoClassDefFoundError: com/sapportals/portal/prt/service/IService

Exception id: [000D6008418B005C0000002C00000D200004163CE6719E1D]

PLEASE ADVISE

Former Member
0 Kudos

Hi Amit,

I do the same and have the same error....

Can you help me?

former_member182372
Active Contributor
0 Kudos

Hi Diz,

Check <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/downloaditem?rid=/library/uuid/2fffe990-0201-0010-aab0-e61c3250bcf3">integrating Web Dynpro in Portal (19)</a>

Best regards, Maksim Rashchynski.