on 01-23-2005 9:04 AM
Hi everyone,
I used the SAP Enterprise Connector plugin for NW04 to develop a connection to a BAPI.
On my client side, I created a Portal Service from wsdl file.
Here is the code where I get an exception.
IMyBAPI4Service client =(IMyBAPI4Service) PortalRuntime
.getRuntimeResources().getService(IMyBAPI4Service.KEY);
Bapi_Companycode_Getdetail_Input importParams =
new Bapi_Companycode_Getdetail_Input();
importParams.setCompanycodeid("0500");
Bapi_Companycode_Getdetail_Output exportParams = null;
try {
exportParams = client.execute_BAPI_COMPANYCODE_GETDETAIL(importParams);
} catch (Exception e) {
myForm.addComponent(new TextView(">> Problem at execution : " + e));
}
Here is the Exception :
>> Problem at execution : SOAP Fault Error (java.lang.NoClassDefFoundError) : java.lang.NoClassDefFoundError
Can someone help ?
/!\ I do not use (for meanwhile) the se37 ABAP transaction from WEB AS 6.40.
Thanks a lot.
Where are you getting the Exception. Is it in the Service or have you created an iView that tries to connect to your service. If this is the case, then make sure that you have a SharingReference to your service so that the iView can access your service class
I hope this helps
D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Darrel,
I created an iView and in facte I didn't add a SharingReference.
Here is the alias of my service:
<service alias="com.sap.portal.prt.soap.MyBAPI4Service" name="MyBAPI4Service">
I added in the application client portalapp.xml file the com.sap.portal.prt.soap.MyBAPI4Service in the SharingRefence.
I did it and got an exception :
Could not find portal application com.sap.portal.prt.soap.MyBAPI4Service.
Did I forgot something to do on the service configuration side ?
Thanks
Hi Darell,
Here is the portallapp.xml of the service provider :
<?xml version="1.0" encoding="iso-8859-1"?>
<application>
<application-config>
<property name="SharingReference" value="com.sap.portal.runtime.application.soap">
</property>
</application-config>
<components>
</components>
<services>
<service alias="com.sap.portal.prt.soap.MyBAPI4Service" name="MyBAPI4Service">
<service-config>
<property name="className" value="com.tutorial.ws.bapi4.MyBAPI4Service">
</property>
<property name="WebEnable" value="true">
</property>
<property name="WSDL_RPC_ENC" value="MyBAPI4Service_RPC_ENC.wsdl">
</property>
<property name="WSDL_RPC_LIT" value="MyBAPI4Service_RPC_LIT.wsdl">
</property>
<property name="WSDL_DOC_LIT" value="MyBAPI4Service_DOC_LIT.wsdl">
</property>
</service-config>
<service-profile>
<property name="SystemAlias" value="Default_System_Alias">
</property>
</service-profile>
</service>
</services>
</application>
I tried to replace the line with the application name...but without success.
Here is the portalapp.xml of the service consumer:
<?xml version="1.0" encoding="utf-8"?>
<application>
<application-config>
<property name="SharingReference" value="com.sap.portal.runtime.application.soap, com.sap.portal.prt.soap.MyBAPI4Service">
</property>
<property name="PrivateSharingReference" value="com.sap.portal.htmlb"/>
</application-config>
<components>
<component name="SampleComponent4">
<component-config>
<property name="ClassName" value="SampleComponent4"/>
<property name="SecurityZone" value="prtws/high_safety"/>
</component-config>
<component-profile/>
</component>
</components>
<services>
<service alias="com.sap.portal.prt.soap.BAPI4Alias" name="MyBAPI4Service">
<service-config>
<property name="className" value="com.tutorial.wsdl2service.MyBAPI4Service">
</property>
<property name="startup" value="false">
</property>
<property name="WebEnable" value="false">
</property>
<property name="WebProxy" value="true">
</property>
</service-config>
<service-profile>
<property name="SystemAlias" value="Default_System_Alias">
</property>
</service-profile>
</service>
</services>
</application>
Can you help me doing the changes....?
Thanks!
Hi
Try having the following for the service provider
<?xml version="1.0" encoding="iso-8859-1"?>
<b><application name="com.sap.portal.prt.soap.MyBAPI4Service" alias="MyBAPI4Service"></b>
<application-config>
<property name="SharingReference" value="com.sap.portal.runtime.application.soap">
</property>
</application-config>
<components>
</components>
<services>
<b><service></b>
<service-config>
<property name="className" value="com.tutorial.ws.bapi4.MyBAPI4Service">
</property>
<property name="WebEnable" value="true">
</property>
<property name="WSDL_RPC_ENC" value="MyBAPI4Service_RPC_ENC.wsdl">
</property>
<property name="WSDL_RPC_LIT" value="MyBAPI4Service_RPC_LIT.wsdl">
</property>
<property name="WSDL_DOC_LIT" value="MyBAPI4Service_DOC_LIT.wsdl">
</property>
</service-config>
<service-profile>
<property name="SystemAlias" value="Default_System_Alias">
</property>
</service-profile>
</service>
</services>
</application>
And have this as the service consumer
<?xml version="1.0" encoding="utf-8"?>
<application>
<application-config>
<b><property name="SharingReference" value="com.sap.portal.runtime.application.soap, MyBAPI4Service"></b>
</property>
<property name="PrivateSharingReference" value="com.sap.portal.htmlb"/>
</application-config>
<components>
<component name="SampleComponent4">
<component-config>
<property name="ClassName" value="SampleComponent4"/>
<property name="SecurityZone" value="prtws/high_safety"/>
</component-config>
<component-profile/>
</component>
</components>
<services>
<service alias="com.sap.portal.prt.soap.BAPI4Alias" name="MyBAPI4Service">
<service-config>
<property name="className" value="com.tutorial.wsdl2service.MyBAPI4Service">
</property>
<property name="startup" value="false">
</property>
<property name="WebEnable" value="false">
</property>
<property name="WebProxy" value="true">
</property>
</service-config>
<service-profile>
<property name="SystemAlias" value="Default_System_Alias">
</property>
</service-profile>
</service>
</services>
</application>
I hope this helps
D
Hi Darell,
First thanks for your help.
For the portalapp.xml of the service provider: when change the
<service alias="com.sap.portal.prt.soap.MyBAPI4Service" name="MyBAPI4Service"> to <service>, I get an error from my eclipse saying that attribut name is mandatory for service node.
So I leaved it as it is and tried to execute it...but got exceptions.
Do you have an idea ?
Thanks!
you are right, my aplogies. The name attribute is mandatory on the <service>.
Try removing the name attribute from the <application> and putting the name and alias attribute back into the <service>. Leave the alias attribute in the <application> though
If you still get exceptions, then post the exception that you are getting
D
Hi
I have coded a quick example for a portal service provider and a portal service consumer and it works fine. The portalapp.xml for the service is the following
<?xml version="1.0" encoding="utf-8"?>
<application>
<application-config>
<property name="startup" value="true"/>
</application-config>
<components/>
<services>
<service name="PortalServiceProvider" alias="PortalServiceProvider">
<service-config>
<property name="className" value="com.sap.sdn.test.PortalServiceProvider"/>
</service-config>
</service>
</services>
</application>
and the portalapp.xml for the service consumer is
<?xml version="1.0" encoding="utf-8"?>
<application>
<application-config>
<property name="SharingReference" value="PortalServiceProvider"/>
</application-config>
<components>
<component name="PortalServiceConsumer">
<component-config>
<property name="ClassName" value="com.sap.sdn.test.PortalServiceConsumer"/>
</component-config>
<component-profile/>
</component>
</components>
<services/>
</application>
To make sure that you can access the service, you need to set the key in the interface of the portal service, like this
public static final String KEY =
"PortalServiceProvider";
To access the service, then you would use the following code in the service consumer
IPortalServiceProvider sp =
(<IPortalServiceProvider)request.getService
(IPortalServiceProvider.KEY);
Then you should be able to access the methods from the service using
sp.myMethod()
I hope this helps a bit more
D
User | Count |
---|---|
92 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.