cancel
Showing results for 
Search instead for 
Did you mean: 

Google Service Example

Former Member
0 Kudos

I have coded this, got my license key, ammended the code and deployed the par to the portal. I can run it and get the first screen up, but when I enter a search term and click on the button - I get an error. Looking at the logs the following few lines seem to say that it is looking for a service.

Caused by: java.lang.reflect.InvocationTargetException: com.sapportals.portal.prt.service.ServiceException: Service not found: Alias

com.sapportals.portal.prt.component.PortalComponentException: Error in service call of Portal Component

Looking at the code the URL is called ALias (or is it alias1).

If I have to define a service - what type should I used?

Has anyone else got the google example service to work?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Chuck,

The problem is that your java class is calling the alias name for your service which is not the word "Alias".

In the MyGooglePage.java example file they list the line to get the service.

I believe it is:

IMyGoogleService googleService = (IMyGoogleService) PortalRuntime.getRuntimeResources().getService("Alias");

This is defaulted to the word alias. You should change this to the Alias name listed in your portalapp.xml file for the Service wherever the getService("Alias") is called.

Please let me know if the Google WebService example works for you after this change. I have run into a problem further on where i am getting a Class Cast Exception when it actually calls the doSearch method and wondered if anyone else is having this problem.

-Erin

Former Member
0 Kudos

Sorry this didn't work - but I did change the portalapp.xml to Alias instead of Alias1.

I am getting the following error - any suggestions

Caused by: java.lang.reflect.InvocationTargetException: java.lang.IllegalStateException: Not able to initialize Web Service configuration for service Alias

Former Member
0 Kudos

Can you post your portalapp.xml file?

Former Member
0 Kudos

Sure here it is

<?xml version="1.0" encoding="utf-8"?>

<application>

<application-config>

<property name="SharingReference" value="com.sap.portal.runtime.application.soap,htmlb">

</property>

<property name="PrivateSharingReference" value="com.sap.portal.htmlb"/>

</application-config>

<components>

<component name="MyGooglePage">

<component-config>

<property name="ClassName" value="com.ocl.tutorial.wsd2service.MyGooglePage"/>

<property name="SecurityZone" value="com.ocl.tutorial.wsd2service/low_safety"/>

</component-config>

<component-profile/>

</component>

<component name="MyGooglePage">

<component-config/>

<component-profile/>

</component>

</components>

<services>

<service alias="Alias" name="MyGoogleService">

<service-config>

<property name="className" value="com.ocl.tutorial.wsd2service.MyGoogleService">

</property>

<property name="startup" value="false">

</property>

<property name="WebEnable" value="false">

</property>

<property name="WebProxy" value="true">

</property>

<property name="SecurityZone" value="com.ocl.tutorial.wsd2service.MyGoogleService/DefaultSecurity">

</property>

</service-config>

<service-profile>

<property name="SystemAlias" value="Default_System_Alias">

</property>

</service-profile>

</service>

</services>

</application>

Former Member
0 Kudos

If you look down at the line that creates the Service object it states that the Alias is "MyGoogleService"

<service alias="Alias" name="<b>MyGoogleService</b>">

<service-config>

<property name="className" value="com.ocl.tutorial.wsd2service.MyGoogleService">

In your java class when it makes the call

...getService("<b>Alias</b>");

change this to ...getService("<b>MyGoogleService</b>");

This should fix the error.

Message was edited by: E. Knight

Former Member
0 Kudos

The message has changed to

Caused by: java.lang.reflect.InvocationTargetException: com.sapportals.portal.prt.service.ServiceException: Service not found: MyGoogleService

Would you like to move this to email - instead?

Former Member
0 Kudos

email sounds best.