Expand my Community achievements bar.

SOLVED

Building a Web-Service client: "A WebService annotation is not present on class"

Avatar

Level 2

Hi there

I'm trying to build a client which should submit some form data to a SAP web service. Using wsimport I created the necessary classes to build the client. I then created a standalone client to test out the web service in my IDE, everything worked fine.

Afterwards I tried installing the web service client as a bundle on my CQ instance (5.5), but i failed to start because of the following errors in my bundle:

javax.jws -- Cannot be resolved javax.jws.soap -- Cannot be resolved

After some googling I found this question on StackOverflow which did solve the problem through adding the following dependency to maven:

<dependency> <groupId>org.apache.geronimo.specs</groupId> <artifactId>geronimo-ws-metadata_2.0_spec</artifactId> <version>1.1.2</version> <scope>compile</scope> </dependency>

This is 1 of 2 external dependencies I'm using, the other one is a LDAP SDK from Unboundid. Now my bundle would start, but trying to submit data to the web service would fail with the following message:

A WebService annotation is not present on class: com.company.cq.webservice.SAPWEBSERVICE Cannot serve request to /bin/appName/submit in com.company.cq.servlets.Submit

The class in question does have a WebService annotation - it was also working as a standalone application. Can someone tell me what might be the problem here and how to solve it?

If it helps, this is also my maven-bundle-plugin configuration:

<plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <extensions>true</extensions> <configuration> <instructions> <Bundle-SymbolicName>com.company.cq.appname-bundle</Bundle-SymbolicName>     <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>     <Embed-Directory>OSGI-INF/lib</Embed-Directory>     <Embed-Transitive>true</Embed-Transitive>     <Export-Package>         com.unboundid.*, com.company.cq.*     </Export-Package>         </instructions> </configuration> </plugin>

Any help is greatly appreciated :)

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Level 10

We have 2 AEM web service articles:

1 - using JAX-WS to create the Java proxy clients used within the OSGi bundle: http://helpx.adobe.com/experience-manager/using/creating-cq-bundles-consume-web.html

2- using Apache CFX to build the Java proxy clients used within the OSGi bundle:

http://helpx.adobe.com/experience-manager/using/creating-cxf-bundles-consume-web.html

Try building your web service using Apache CXF as shown in the 2nd article. 

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

We have 2 AEM web service articles:

1 - using JAX-WS to create the Java proxy clients used within the OSGi bundle: http://helpx.adobe.com/experience-manager/using/creating-cq-bundles-consume-web.html

2- using Apache CFX to build the Java proxy clients used within the OSGi bundle:

http://helpx.adobe.com/experience-manager/using/creating-cxf-bundles-consume-web.html

Try building your web service using Apache CXF as shown in the 2nd article. 

Avatar

Level 2

Hi Scott

Thanks for the suggestion. I now tried the CXF web service, and it seems to work. What bugs me a bit though is the fact that I now have to deploy 2 bundles in order to get my project up and running (one bundle for the web service client and one bundle for the rest of the application). Also, after following the CXF article, I now have a bundle that's not a maven project while the rest of the application has been created as a maven project.

Is there any way I could integrate the web service client into one bundle together with the rest of the application?

Don't get me wrong, I'm really glad it's working now (Thanks again!) so I can make some progress in my project, but that would really make things perfect for me :)

Thank you