SOAP Client

Post here questions and problems related to oXygen frameworks/document types.
nhenel_sog
Posts: 6
Joined: Thu May 31, 2018 4:34 pm

SOAP Client

Post by nhenel_sog » Fri Apr 12, 2019 6:39 pm

Hi,
I'm writing a plugin using some SOAP WS as client.
I have updated my oXygen's version from 20.1 to 21.
Now, my SOAP client throws an exception when I create the service:

Code: Select all

java.lang.Error: javax.xml.soap.SOAPException: Unable to create SAAJ meta-factorycom.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl cannot be cast to javax.xml.soap.SAAJMetaFactory
at com.sun.xml.internal.ws.api.SOAPVersion.<init>(SOAPVersion.java:178) ~[?:1.8.0_101]
at com.sun.xml.internal.ws.api.SOAPVersion.<clinit>(SOAPVersion.java:84) ~[?:1.8.0_101]
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parseBinding(RuntimeWSDLParser.java:578) ~[?:1.8.0_101]
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parseWSDL(RuntimeWSDLParser.java:460) ~[?:1.8.0_101]
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:234) ~[?:1.8.0_101]
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:194) ~[?:1.8.0_101]
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:163) ~[?:1.8.0_101]
at com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:348) ~[?:1.8.0_101]
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:306) ~[?:1.8.0_101]
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:215) ~[?:1.8.0_101]
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:196) ~[?:1.8.0_101]
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:192) ~[?:1.8.0_101]
at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:104) ~[?:1.8.0_101]
at javax.xml.ws.Service.<init>(Service.java:77) ~[?:1.8.0_101]
at javax.xml.ws.Service.create(Service.java:707) ~[?:1.8.0_101]
at com.sogitec.oxygen.server.WebServiceHelper.buildService(WebServiceHelper.java:26) ~[oxyPlugins.jar:?]
at com.sogitec.oxygen.plugin.WorkspaceAccessPlugin.applicationStarted(WorkspaceAccessPlugin.java:25) [oxyPlugins.jar:?]
at ro.sync.exml.MainFrame.ran(Unknown Source) [oxygen.jar:?]
at ro.sync.exml.MainFrame.<init>(Unknown Source) [oxygen.jar:?]
at ro.sync.exml.MainFrame.<init>(Unknown Source) [oxygen.jar:?]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_101]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) [?:1.8.0_101]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [?:1.8.0_101]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) [?:1.8.0_101]
at ro.sync.ui.application.ApplicationLauncher.d(Unknown Source) [oxygen.jar:?]
at ro.sync.ui.application.ApplicationLauncher.launch(Unknown Source) [oxygen.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_101]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_101]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_101]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_101]
at ro.sync.exml.Oxygen.main(Unknown Source) [oxygen.jar:?]
Caused by: javax.xml.soap.SOAPException: Unable to create SAAJ meta-factorycom.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl cannot be cast tojavax.xml.soap.SAAJMetaFactory
at javax.xml.soap.SAAJMetaFactory.getInstance(SAAJMetaFactory.java:80) ~[javax.xml.soap-api-1.4.0.jar:1.8.0_101]
at javax.xml.soap.MessageFactory.newInstance(MessageFactory.java:146) ~[javax.xml.soap-api-1.4.0.jar:1.8.0_101]
at com.sun.xml.internal.ws.api.SOAPVersion.<init>(SOAPVersion.java:175) ~[?:1.8.0_101]
... 30 more
I search a bit and found a classical fix, add this to my pom.xml:

Code: Select all

    <dependency>
<groupId>com.sun.xml.messaging.saaj</groupId>
<artifactId>saaj-impl</artifactId>
<version>1.5.0</version>
</dependency>
But it's solve nothing.
If I create and run a JUnit test, my service is correctly create.
The exception is throwed only if I create it during the oXygen execution.
Could you help me to solve.

Best regards,

Nhenel

Radu
Posts: 6134
Joined: Fri Jul 09, 2004 5:18 pm

Re: SOAP Client

Post by Radu » Sat Apr 13, 2019 11:16 am

Hi Nhenel,

In Oxygen 21 we added some new libraries which may indeed interfere with your plugin?
What does your "plugin.xml" descriptor file look like? Can you post its contents here?
Also what is the precise list of JAR libraries you distribute with the plugin?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

nhenel_sog
Posts: 6
Joined: Thu May 31, 2018 4:34 pm

Re: SOAP Client

Post by nhenel_sog » Mon Apr 15, 2019 12:13 pm

Hi Radu,
I have tried with a minimal project and have the same issue.
Here my pom.xml:

Code: Select all

 <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.example.oxygen</groupId>
<artifactId>test-soap-saaj</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</properties>
<dependencies>
<dependency>
<groupId>com.oxygenxml</groupId>
<artifactId>oxygen-sdk</artifactId>
<version>21.0.0.0</version>
<exclusions>
<!--<exclusion>-->
<!--<groupId>xerces</groupId>-->
<!--<artifactId>xercesImpl</artifactId>-->
<!--</exclusion>-->
<!--<exclusion>-->
<!--<groupId>com.oxygenxml</groupId>-->
<!--<artifactId>oxygen-patched-saaj</artifactId>-->
<!--</exclusion>-->
<!--<exclusion>-->
<!--<groupId>javax.xml.soap</groupId>-->
<!--<artifactId>javax.xml.soap-api</artifactId>-->
<!--</exclusion>-->
<!--<exclusion>-->
<!--<groupId>com.sun.xml.messaging.saaj</groupId>-->
<!--<artifactId>saaj-impl</artifactId>-->
<!--</exclusion>-->
</exclusions>
</dependency>
<!--<dependency>-->
<!--<groupId>com.sun.xml.messaging.saaj</groupId>-->
<!--<artifactId>saaj-impl</artifactId>-->
<!--<version>1.5.0</version>-->
<!--</dependency>-->

<!-- for test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sf.jfcunit</groupId>
<artifactId>jfcunit</artifactId>
<version>2.08</version>
<scope>test</scope>
</dependency>

</dependencies>
</project>
As comment, some test to resolve my issue.

And here, the plugin.xml:

Code: Select all

 <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plugin SYSTEM "../plugin.dtd">
<plugin id="com.example.oxygen.plugin.PluginExtensions" name="PluginExtensions" description="Test"
version="1.0.0" vendor="Us" class="com.example.oxygen.plugin.ToolPlugin"
classLoaderType="preferReferencedResources">
<runtime>
<library name="D:/oxygen/TestSoapSaaj/target/oxyPlugins.jar"/>
</runtime>

<extension type="WorkspaceAccess" class="com.example.oxygen.plugin.WorkspaceAccessPlugin"/>
</plugin>
I have tried to play with <plugin classLoaderType="something"/> and with a <librariesFolder scope="something_else"/> too.

I'm not a SOAP expert technologies, maybe the fix is very trivial, but I can't found it.

Best regards,
Nhenel

alex_jitianu
Posts: 662
Joined: Wed Nov 16, 2005 11:11 am

Re: SOAP Client

Post by alex_jitianu » Tue Apr 16, 2019 2:59 pm

Hello,

Thank you for reporting this issue. I managed to reproduce it myself. It all comes from the presence of javax.xml.soap-api-1.4.0.jar inside the Oxygen's classpath. To fix it you should remove javax.xml.soap-api-1.4.0.jar from {oxygenInstallDir}/lib. I will add an issue on our side to see what we should do with that jar. I think that it was added there because starting with openjdk11 the packages javax.xml.soap and javax.xml.ws are no longer distributed. The Oxygen build you are using comes with jre8 so it doesn't really needs it.

Best regards,
Alex

Post Reply