Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

Consuming a SOAP Service using Jakarta XML WS

Avatar

Level 1

I am trying to consume a soap service in AEM 6.5. During runtime I am getting below Exception. 

 

org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Uncaught Throwable
jakarta.xml.ws.WebServiceException: Provider com.sun.xml.ws.spi.ProviderImpl not found
  at jakarta.xml.ws.spi.FactoryFinder$1.createException(FactoryFinder.java:35) [jakarta.xml.ws-api:4.0.1]
  at jakarta.xml.ws.spi.FactoryFinder$1.createException(FactoryFinder.java:32) [jakarta.xml.ws-api:4.0.1]
  at jakarta.xml.ws.spi.ServiceLoaderUtil.newInstance(ServiceLoaderUtil.java:76) [jakarta.xml.ws-api:4.0.1]
  at jakarta.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:110) [jakarta.xml.ws-api:4.0.1]
  at jakarta.xml.ws.spi.Provider.provider(Provider.java:64) [jakarta.xml.ws-api:4.0.1]
  at jakarta.xml.ws.Service.<init>(Service.java:82) [jakarta.xml.ws-api:4.0.1]

 

When I have done the research Below are the details I have found

javax.xml.ws was moved to jakarta.xml.ws. Now the updated Jakarta Bundles was not able to resolve this com.sun.xml.ws.spi. In one of the linkedin article I have seen there is a fix for using javax.xml.ws Package in such a way that installing a bundle provided by Adobe Support has installed all the dependencies required.But For jakarta.xml.ws Package we are not having any fix where all the dependencies are provided as a bundle. Below was the Linkedin Article link https://www.linkedin.com/pulse/invoking-soap-web-services-inside-aem-osgi-service-using-kaushal/

 

If anyone having a fix for this issue please help me out. 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi Sunil,

 

Unfortunately, in recent JDK version with things moving around it may be a bit tricky to get code into proper running mode.

 

In this case you're facing problems due to JEP 320 [1] where certain dependencies have been moved/removed in Java 9+.

 

Kindly ensure you do have com.sun.xml.ws embedded in your OSGi run time to properly resolve it during your SOAP method call.

 

Have fixed similar issue earlier by embedding into our bundle. 

 

<dependency>

  <groupId>com.sun.xml.ws</groupId>

  <artifactId>jaxws-ri</artifactId>

  <version>${jaxws-version}</version

 <scope>runtime</scope>

  <type>pom</type>

</dependency>

 

[1] https://openjdk.org/jeps/320 

 

Hope my answer helps!

 

Regards,

Peter

 

View solution in original post

3 Replies

Avatar

Community Advisor

Hi @Sunil_Kumar_Valleru ,

Are you using java 11, if Yes?. 
Then add the below dependency to your pom :

<dependency>
    <groupId>com.sun.xml.ws</groupId>
    <artifactId>rt</artifactId>
    <version>2.3.1</version>
</dependency>


Hope it helps!

Thanks
Tarun

Avatar

Correct answer by
Community Advisor

Hi Sunil,

 

Unfortunately, in recent JDK version with things moving around it may be a bit tricky to get code into proper running mode.

 

In this case you're facing problems due to JEP 320 [1] where certain dependencies have been moved/removed in Java 9+.

 

Kindly ensure you do have com.sun.xml.ws embedded in your OSGi run time to properly resolve it during your SOAP method call.

 

Have fixed similar issue earlier by embedding into our bundle. 

 

<dependency>

  <groupId>com.sun.xml.ws</groupId>

  <artifactId>jaxws-ri</artifactId>

  <version>${jaxws-version}</version

 <scope>runtime</scope>

  <type>pom</type>

</dependency>

 

[1] https://openjdk.org/jeps/320 

 

Hope my answer helps!

 

Regards,

Peter

 

Avatar

Community Advisor

Hi @Sunil_Kumar_Valleru 

Use Apache CXF:
Consider using Apache CXF as the JAX-WS implementation. Apache CXF supports Jakarta XML Web Services and is widely used in AEM for SOAP integrations.

Add the following Maven dependency to your project:

xml
Copy code
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>3.4.6</version> <!-- Use the appropriate version -->
</dependency>
Additionally, ensure that the necessary CXF bundles are available in your AEM instance.