Skip to Content
0
Former Member
Aug 02, 2016 at 04:18 PM

Consuming the Document Service in JAX-WS Application

304 Views

Hello,

I try to consume the Document Service in a RESTful application using JAX-WS(jersey) and I have a problem when I try to connect to the repository.

The example SAP HANA Cloud Platform works fine, but it is implemented with servlets

I implemented a simple JAX-WS application, with contain this method: (I reduced the code to focus only to the problem)



  @GET
  @Produces(MediaType.TEXT_HTML)
  public String CmisConnection()
  {
       try
       {
            Session openCmisSession = null;
            com.sap.ecm.api.EcmService ecmSvc = null;
            InitialContext ctx = new InitialContext();
            String lookupName = "java:comp/env/" + "EcmService";
            try
            {
                 ecmSvc = (EcmService) ctx.lookup(lookupName);
            }
            catch (Exception e)
            {
                 e.printStackTrace();
            }
       }
        catch (Exception e)
       {
            e.printStackTrace();
       }
  return "";
  }



All dependencies(JAR's) are included in WEB-INF/lib directory (neo-sdk-core-api-1.108.14.jar - also). Also, in the web.xml I have included this reference

<resource-ref>

<res-ref-name>EcmService</res-ref-name>

<res-type>com.sap.ecm.api.EcmService</res-type>

</resource-ref>

The application is deployed locally with the lastest version of neo-java-web-sdk.

The problem occurs at line 15, where an exception indicate:

java.lang.ClassCastException: com.sun.proxy.$Proxy76 cannot be cast to com.sap.ecm.api.EcmService


The entire application can be funded here. GitHub - Viplord/CMIS-using-JAX-ws

Could someone explain what am I doing wrong?

Thank you.