Consuming a SOAP Service using Jakarta XML WS | Community
Skip to main content
January 19, 2024
Solved

Consuming a SOAP Service using Jakarta XML WS

  • January 19, 2024
  • 3 replies
  • 13497 views

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. 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Peter_Puzanovs

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

 

3 replies

TarunKumar
Community Advisor
Community Advisor
January 19, 2024

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

Peter_Puzanovs
Community Advisor
Peter_PuzanovsCommunity AdvisorAccepted solution
Community Advisor
January 19, 2024

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

 

Raja_Reddy
Community Advisor
Community Advisor
January 19, 2024

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.