cancel
Showing results for 
Search instead for 
Did you mean: 

Access Portal Services within Web Dynpro

Former Member
0 Kudos

Hi,

I created a portal service and would like that some values of the same have to be set by a Web Dynpro application, but i have a problem to access this

service. Always that a i try to get a reference of this service the object isn't instantiated and i get a null instantiated.

What i`m trying to do is the broadcast message described in [/people/prakash.singh4/blog/2005/04/28/brodcast-messages-to-logged-on-users-in-portalpart1 |/people/prakash.singh4/blog/2005/04/28/brodcast-messages-to-logged-on-users-in-portalpart1]with a variation that need of some

more Attributes and that the same will be pass by the Web Dynpro, like the broadcast message i`ll just use the alert concept and don't the publication.

Follow below the describe of executed actions.

1 - I did all the process as the [Weblog|/people/prakash.singh4/blog/2005/04/28/brodcast-messages-to-logged-on-users-in-portalpart1].

2 - I generated the Jar and insert the same in a DC.

3 - I generated the Web Dynpro application, in the used DCs and added the DC with the Jar, and i inserted the reference in a Sharing References.

4 - Did the deploy and insert the Web Dynpro in a Portal Iview.

But always that i execute, i can't capture the reference of the service.

Note: The reference in Sharing References was executed for several diferents forms of test, like for exemple:

PORTAL:<vendor>/com.teste.broadcast

PORTAL:com.teste.broadcast

PORTAL:<vendor>/com.teste.broadcast.alertreceiver

PORTAL:com.teste.broadcast.alertreceiver

But always adding one at a time.

Until put the saller like sap.com i already try.

The creation of the service as described in the weblog can be accessed for a Web Dynpro? What the problem to access the Service??

The codes follow Bellow.

portalapp.xml

<?xml version="1.0" encoding="UTF-8"?>
<application>
  <application-config>
    <property name="PrivateSharingReference" value="com.sap.portal.htmlb,com.sap.portal.runtime.system.notification"/>
    <property name="ServicesReference" value="com.teste.broadcast"/>
  </application-config>

...

  <services>
    <service name="alertreceiver">
      <service-config>
        <property name="className" value="com.teste.broadcast.alertreceiver"/>
      </service-config>
    </service>
  </services>
</application>

BroadcastAppView.java

import com.sap.security.api.IUser;
import com.sap.tc.webdynpro.clientserver.portal.WDPortalUtils;
import com.sap.tc.webdynpro.clientserver.portal.sf.WDPortalServiceType;
import com.sap.tc.webdynpro.progmodel.api.IWDMessageManager;
import com.sap.tc.webdynpro.services.sal.um.api.IWDClientUser;
import com.sap.tc.webdynpro.services.sal.um.api.WDClientUser;
import com.sapportals.portal.prt.service.notification.INotificationService;
import com.sapportals.portal.prt.service.notification.NotificationStringBufferPool;
import com.sapportals.portal.prt.service.notification.StreamData;
import com.sapportals.portal.prt.service.notification.TopicData;
import com.sapportals.portal.prt.service.notification.TopicDataContainer;
import com.teste.broadcast.Ialertreceiver;

...

public void onActionSendMessage(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onActionSendMessage(ServerEvent)

        IWDMessageManager msgManager = wdComponentAPI.getMessageManager();
        INotificationService notService = null;
       
        try {
                notService =    (INotificationService)
                        WDPortalUtils.getServiceReference("com.teste.broadcast");
                //notService =  (INotificationService)
                //      WDPortalUtils.getServiceReference("com.teste.broadcast.alertreceiver");
                //notService =  (INotificationService)
                //      WDPortalUtils.getServiceReference(IAlertreceiver.KEY);
        } catch (Exception ex) {
                msgManager.reportWarning("2-" + ex.getMessage());
        }
               
       
        TopicDataContainer container = new TopicDataContainer(TOPIC_NAME);
       
        StreamData  messageStream = new StreamData(new ByteArrayInputStream(textMessage.getBytes()));

        TopicData durationdata =
                new TopicData(TopicDataContainer.STRING, "60");
        TopicData userdata =
                new TopicData(TopicDataContainer.STRING, user.getUniqueName());
        container.addTopicData("message", messageStream);
        container.addTopicData("duration", durationdata);
        container.addTopicData("user", userdata);
        container.addTopicData("group", "GROUP_ACCESS");
        //notService.publish(TOPIC_NAME, container);
        msgManager.reportWarning("-" + notService);
       
    //@@end
  }

...

  /*
   * The following code section can be used for any Java code that is
   * not to be visible to other controllers/views or that contains constructs
   * currently not supported directly by Web Dynpro (such as inner classes or
   * member variables etc.). </p>
   *
   * Note: The content of this section is in no way managed/controlled
   * by the Web Dynpro Designtime or the Web Dynpro Runtime.
   */
  //@@begin others
  private final static String SERVICE_NOTIFICATION = "com.sap.portal.runtime.system.notification.notification";
  private final static String TOPIC_NAME = "USTBroadCastAlerts";
  //@@end
}

Thank.

Luciano Feletti Aponte

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Luciano,

Take a look at for your answer:

/thread/833576

Regards,

Rogério