Calling portal service ?

Hi,
am trying to call a portal service from portal application.
2 scenarios:
SCENARIO 1:
componnent and the service in the same project.
  in the KEY filed of ImyService. when I provide the value as Parfilename|servicename, it works
when i change the KEY field to name of the classfile, i.e. com.mycomp.myService [ implemention class of that interface], it doesnt work. throwing exception "could not instatiate the implementation class".
SCENARIO 2:
  SERVICE and the usage component is in different projects and I provided the value of service to sharingreference in the portalapp.xml file
it doesnt work when the KEY is  "Parfilename|servicename" or when it is set to the class file name, i.e. "com.mycomp.myService".
BTW, the portal service is started.
any ideas are highly appreciated.

Hi Yogi,
The Steps below Describes how to call a Portal Service from a Portal Application.
<b>Add Sharing Reference Value in the Deployment Descriptor.</b>
<application-config>
        <property name=”SharingReference” value=”<ApplicationName or ApplicationAlias>”/>
        <property name=”SharingReference” value=”com.sap.portal.navigation.api_service”/>      
</application-config>
<b>Add Libraries of the Portal Service (xxxapi.jar)</b>
<b>Write code to access the Portal Service</b>
Import Package of the Portal Service
Get Instance of the Portal Service
Call Methos of the Portal Service.
<b>Here is an Example:</b>
<b>PORTAL SERVICE</b>
/********************** Service Interface : IServiceOne.java ************************/
package com.abc.def;
import com.sapportals.portal.prt.service.IService;
public interface IServiceOne extends IService
    public static final String KEY = "ServiceProject.ServiceOne";                         
                                      //PARFilename.Servicename
    public String display();
/**************** Service Source File : ServiceOne.java  ***************************/
// Implement the display() Method
public String display() {
     // TODO Auto-generated method stub
     return "Welocme To My Service Project. Thank you for accessing my service.";
/*******************portalapp.xml*********************/
<application>
  <application-config/>
  <components/>
  <services>
    <service name="ServiceOne">
      <service-config>
        <property name="className" value="com.abc.def.ServiceOne"/>
      </service-config>
    </service>
  </services>
</application>
<b>After Creating Your Service , Deploy it on the Server.</b>
<b>PORTAL APPLICATION</b>
package com.sample;
import com.abc.def.*;
import com.sapportals.portal.prt.component.*;
import com.sapportals.portal.prt.runtime.*;
public class AccessOne extends AbstractPortalComponent
    public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
          IServiceOne myService =(IServiceOne)PortalRuntime.getRuntimeResources().getService(IServiceOne.KEY);
         String s = myService.display();
         response.write(s);
/********************** Portalapp.xml ***********************/
<application>
  <application-config>
    <property name="SharingReference" value="ServiceProject"/>
  </application-config>
  <components>
    <component name="AccessOne">
      <component-config>
        <property name="ClassName" value="com.sample.AccessOne"/>
      </component-config>
      <component-profile/>
    </component>
  </components>
  <services/>
</application>
<b>Right Click on the Portal Application --->Properties -> Java Build Path-> click on Libraries Tab on the Top and Click Add External Jars Tab on the Right ---> Add Your Portal Service PAR File</b> .
Now Deploy the Application.<i></i><u></u><i></i>
Reward Points if u find this useful.
Regards,
Eben.

Similar Messages

  • Calling portal service from web service

    Hello,
    I'm trying to call portal service from web service. Is this possible? I'm getting an error.
    For example, code:
    IJCOClientService clientService = (IJCOClientService) PortalRuntime.getRuntimeResources().getService(IJCOClientService.KEY);
    .. is generating exception:
    java.lang.LinkageError: Class com/sapportals/portal/prt/runtime/IPortalRuntimeResources violates loader constraints
    Do anybody knows what's wrong?
    Best regards,
    Josef Motl

    Hi Josef,
    Is the IJCOClientService located on the producer side or on the consumer side?
    Amit

  • Can i call portal service from a j2ee application?

    Hi Experts,
    Can i call portal service from a j2ee application?
    If yes then how?
    If no then is there any other way to achieve the same?
    I m reffering this link:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/42/9ddd0cbb211d72e10000000a1553f6/content.htm
    but not getting any help
    Please help me out.

    Hi,
    Can you check this link?
    http://help.sap.com/saphelp_nw04s/helpdata/en/82/6a0e7bbe744276bf393654b9b576ed/content.htm
    Regards
    Srinivasan T

  • Calling Portal Service using result as Java Bean Model impossible?

    Hello folks,
    we try to achieve to call a portal service (working) which gives as a result a list of object of type com.foo.Report. We want to make use of this class as a model class, so we have the class as a model node in the context. The class itself is part of the service DC.
    Unfortunately at run time it gives us a NoClassDefFound Exception of com.foo.Report.
    As the com.foo.Report is part of the same DC as the service, it is no option to add the PAR public part to the used DCs of the WD DC because then there is this type conflict when we call the service (service look up). Or am I wrong and this is the way to do it? I mean I struggled quite a while to get the service look up right and needed to remove all the PAR/lib used DCs from the used DCs of the WD Project, when I got it working this Model error came up. I also tried to put the Model class in a separate DC but that caused the same error.
    how is it possible to call a Portal service from WD and using it's return vale as a Model class
    our system iis 7.0.17
    best
    Stefan

    Hi,
    Refers the following docs..
    EJBs in Web Dynpro Application Using Wrapper Class
    Here Java Bean Model used in web dynpro.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/00be903b-8551-2b10-c28a-8520400c6451
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1f5f3366-0401-0010-d6b0-e85a49e93a5c
    Accessing database table using EJB and web dynpro
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/70929198-0d36-2b10-04b8-84d90fa3df9c
    Oracle Connectivity with EJB using WebDynpro Application
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/wdjava/oracle%2bconnectivity%2bwith%2bejb%2busing%2bwebdynpro%2bapplication
    Hope it will help u.
    thanks
    Abhilasha

  • Call portal service from page or iview

    Hello All,
    I have an portal applction(PAR) which is returning a value suppose 'X'.
    Now my requirement is to call this portal service from page.
    How may i do this?
    Regards.
    Punit
    Edited by: Punit Singh on Feb 25, 2011 9:30 PM

    Hi
    You can call the IPortalService API as in this [thread|how to call a portal service;
    Regards
    johann

  • EJB call Portal Service

    Hi everyone,
    I created a portal service and deployed it to the J2EE server.
    I also created an EJB and deployed it on the same J2EE server.
    Is it possible that the EJB can use the Portal Service ?
    Thanks.

    David,
    Actually, I just found a document that might be helpful. Please check if <a href="http://help.sap.com/saphelp_nw04s/helpdata/en/42/9ddd0cbb211d72e10000000a1553f6/frameset.htm">this</a> fits into your scenario.
    Best regards,
    Vladimir

  • How to call a  portal service from a servlet

    Hello all.
    I have a functioning portal service that I would like to call from a servlet.
    When I try to do so, I get a ClassCastException when I do this (on line two):
    IPortalRuntimeResources runtimeResources = PortalRuntime.getRuntimeResources();
    IDocumentPersistence docPer = (IDocumentPersistence) runtimeResources.getService(IDocumentPersistence.KEY);
    However if I do the following I can get a generic IService and use reflection to invoke the method (in the IDocumentPersistence interface) that I want to invoke:
    IPortalRuntimeResources runtimeResources = PortalRuntime.getRuntimeResources();
    com.sapportals.portal.prt.service.IService aService = (com.sapportals.portal.prt.service.IService) runtimeResources.getService(IDocumentPersistence.KEY);
    There must be a better way to use portal services (hopefully like scenario one above) in servlets. In web dynpro you can use portal services and cast them to the correct type. What am I missing?

    Hi Kim,
    how did you integrate the references to your Portal Service Interface into your web application?
    You should do this using the references in your application-j2ee-engine.xml, did you do this? It might be a problem with the classloader otherwise.
    The way you are calling portal services does work normally, however it is not the recommended way as it is documented in the SAP documentation.
    Please check the SAP documentation on how to access a portal service from a j2ee app:
    http://help.sap.com/saphelp_nw70/helpdata/EN/42/9ddd0cbb211d72e10000000a1553f6/frameset.htm
    Best regards,
    Stefan Brauneis

  • RFC Call to Portal Service

    Hi
    I am trying to call a Portal Service from the SAP R/3 through RFC.
    I have done the following.
    1. Created RFC in the SAP R/3.
    2. Created RFC Destination in SAP R/3 and WAS 640
    3. Created a Portal Service and deployed in the Portal.
    The problem is when I execute the RFC in ABAP it is giving me this error.
    com.sap.engine.services.ejb.exceptions.BaseRemoteException: Exception in method processFunction
    As anyone faced similar problems, please let me know.
    Regards
    Senthil

    Hi Senthil,
    If you haven't already done so, I think you should try this question in the 'ABAP Programming' forum.
    Yoav.

  • Blank SOAP Action in Soap Request- Portal Service calling Web Service

    Hi
    I'm trying to access an Web Service through a client portal service which was generated by NWDS. I called this service from a basic component and tried to execute the WS function after populating all the needed fields. When I started the component I encountered the following error.
    java.lang.IllegalArgumentException: The SOAP Action "" include in the soap request not corresponding to the Portal service method..
    I initially thought it was because I was downloading the WSDL to my local and using that in the portal service generation. Maybe not all the information about the web service was being obtained. I tried it again after generating the portal service from the WSDL online but still obtained the same error.
    Any insight on what's causing the error would be appreciated. Thanks!

    Dear expert.
    i got the same problem with Reyes. anyone can solve this issue?
    thank in advance.

  • Can you call a SAP java Portal Service from the Dot Net code?

    Is there a link to a document or snippet of code to call a customized Portal Service in a Dot Net code?

    Hi Steve,
      yes.,u can call a java portal service in .net.,the only thing what u need to do is to establish that portal service as web service and use that web service in ur code..
    Regards,
    Vinoth

  • How to call a "iView" in Portal Service

    Hi,
    I want to call a "iView" from portal service.
    Can somebody suggest me how to call? I am not aware of the method for doing so.
    Any sample code will be helpful.
    Thanks in advance.
    Manish

    Hello Manish,
    as far as I know, it's not possible to call an iView from a portal service. The intention of a portal service is to provide general functionality that may be used by several iViews. So, you can call a service from an iView, but not the other way round.
    Have a look at the documentation, I hope this clarifies things a little bit: http://help.sap.com/saphelp_erp2005vp/helpdata/en/df/e6b74253ffda11e10000000a155106/frameset.htm
    Kind regards, Lars

  • Calling BAPI from Portal Service

    Hi all,
    I have created a KM custom property renderer, what includes a Portal Service.
    Now, I would like to call a BAPI from the renderer component using JCO.
    Does anybody how or whether that works?
    Or does anybody have a sample code how to call a BAPI using JCO from a portal service?
    Thanks
    ISmail

    Hi,
    This is possible.
    Please see the following documentation:
    [http://help.sap.com/saphelp_nwpi711/helpdata/en/48/634503d4e9501ae10000000a42189b/frameset.htm|http://help.sap.com/saphelp_nwpi711/helpdata/en/48/634503d4e9501ae10000000a42189b/frameset.htm]
    Regards,
    Zohar

  • Calling a Portal Service from within a Web Dynpro DC

    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

    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

  • Calling a abstract portal component from portal service

    Hi
    Can i access a abstract portal component from portal service?
    My requirement is i have a method called getsessionID in portal service. My portal service is enabled as a webservice. Who ever consumes my webservice they will call this method.
    This method in portal service should call a method in abstract portal component to return the session id of the user.
    is this possible.
    Thanks in advance
    Kishore

    Hi Kishore,
           This is impossible. The AbstractPortalComponent is a servlet and it can only be executed via URL. It is easy to execute the component via url but you have to pass the logon information. Also it will run under a user context that you have specified(while passing the logon information) when calling the url. I think you ought to consider a different approach.
            Prakash Singh

  • Calling Webdynpro from a Portal service

    Hi,
    I am new to EP. I have a task where i have to write a Portal service which has to call a prewritten Webdynpro. Can someone guide me as to how I can call WebDynpros from Portal services.
    Thanks,
    Sudhir

    Hi Sudhir,
    That makes no sense. Portal Services are "faceless components", i.e. they have no user interface. WD is just all about UI. How should that kind of integration work / make sense?!?!
    Hope it helps nevertheless
    Detlev

Maybe you are looking for