Show TOC Start of Content Area

Background documentation Writing ABAP-Compliant Web Services  Locate the document in its SAP Library structure

In the following chapter you will find a detailed overview of how to write EJBs and Java classes - which could later be deployed on the SAP J2EE Engine as Web services - with WSDLs without inheritance. This ‘feature’ is required because many proxy implementations do not correctly handle the XML schema inheritance or do not support it at all.

Caution

Due to internal restrictions in SAP Web AS 6.40, namespaces and names of Web services may have no more than 60 characters. For Web services created with the SAP NetWeaver Developer Studio, namespaces and names with more than 60 characters can be adjusted in the VI editor. This problem will be solved in one of the next service packs for SAP Web AS. Please read note 707645 for the most recent information.

Interface Class Requirements

The EJB interface (or Java class) should not refer directly (as method parameters or return types), or indirectly (as field types) to a class that extends classes other than java.lang.Object and interfaces other than java.io.Serializable. The java.io.Serializable interface is required for the EJB classes to enable the de/serialization via RMI. The use of java.lang.Object and java.io.Serializable is not allowed in the interface’s method structure or referenced classes.

Here are some examples of method structures that not allowed:

 

public void echo (Object obj);

Direct use of Object

public java.io.Serializable use(..);

Direct use of Serializable

class MyClass extends MyBaseClass {}

   public MyClass echo(MyClass cl);

The base class of MyClass is MyBaseClass

class MyClass2 extends Object implements java.io.Serializable {public MyClass mcl;}

   public void doSmth(MyClass2 cl);

MyClass2 has a field of type MyClass, which extends MyBaseClass. Inheritance is not possible.

class MyClass3 extends Object implements java.io.Serializable {public Object obj;}

   public void doSmth(MyClass3 cl);

MyClass3 has a field of type Object. The use of a field of type Object is not compatible with ABAP.

 

Use of Exception Classes

All custom exceptions should directly extend java.lang.Exception. Custom exceptions cannot be used as base classes. Only java.lang.Exception can be used as a base type, for example, as shown in the code excerpt below.

Syntax

public class MyException extends Exception {

    public String strValue;

    pubic in intValue;

}

 

The code exceprt above results in the complexType below:

Syntax

<complexType name=”MyException”>

   <sequence>

        <element name=’strValue’ nillable=’true’ minOccurs=’0’/>

        <element name=’intValue’ minOccurs=’0’/>

   </sequence>

 

The following restrictions apply when using java.lang.Exception and java.lang.Throwable:

 

Some examples of what is not allowed:

public class MyException extends MyBaseException {

MyBaseException inheritance

 

public class MyException extends Exception {
   Throwable cause;                 

Use of Throwable as field

public class MyException extends Exception {
   Exception nested;                  

Use of Exception as field

 

public void doSmth() throw Exception;  

Use of Exception

 

class MyClass extends Object implements java.io.Serializable {

public Throwable thr;}

   public void doSmth(MyClass);

MyClass has field of type Throwable

 

 

 

 

End of Content Area