12

Is there any alternative to Axis2? Or the way to make it work (different data binding, for example)?

Retrieving document at '...'.
Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
        at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:271)
        at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
        at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
        at org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension.engage(SimpleDBExtension.java:53)
        at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:224)
        ... 2 more
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension.engage(SimpleDBExtension.java:50)
        ... 3 more
Caused by: org.apache.axis2.schema.SchemaCompilationException: can not find type {http://schemas.xmlsoap.org/soap/encoding/}Array from the parent schema ...        at org.apache.axis2.schema.SchemaCompiler.copyMetaInfoHierarchy(SchemaCompiler.java:1296)
        at org.apache.axis2.schema.SchemaCompiler.processComplexContent(SchemaCompiler.java:1258)
        at org.apache.axis2.schema.SchemaCompiler.processContentModel(SchemaCompiler.java:1153)
        at org.apache.axis2.schema.SchemaCompiler.processComplexType(SchemaCompiler.java:1097)
        at org.apache.axis2.schema.SchemaCompiler.processNamedComplexSchemaType(SchemaCompiler.java:1017)
        at org.apache.axis2.schema.SchemaCompiler.processSchema(SchemaCompiler.java:931)
        at org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:766)
        at org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:552)
        at org.apache.axis2.schema.SchemaCompiler.process(SchemaCompiler.java:1991)
        at org.apache.axis2.schema.SchemaCompiler.processParticle(SchemaCompiler.java:1874)
        at org.apache.axis2.schema.SchemaCompiler.processComplexType(SchemaCompiler.java:1081)
        at org.apache.axis2.schema.SchemaCompiler.processNamedComplexSchemaType(SchemaCompiler.java:1017)
        at org.apache.axis2.schema.SchemaCompiler.processSchema(SchemaCompiler.java:931)
        at org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:766)
        at org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:552)
        at org.apache.axis2.schema.SchemaCompiler.process(SchemaCompiler.java:1991)
        at org.apache.axis2.schema.SchemaCompiler.processParticle(SchemaCompiler.java:1874)
        at org.apache.axis2.schema.SchemaCompiler.processComplexType(SchemaCompiler.java:1081)
        at org.apache.axis2.schema.SchemaCompiler.processAnonymousComplexSchemaType(SchemaCompiler.java:980)
        at org.apache.axis2.schema.SchemaCompiler.processSchema(SchemaCompiler.java:934)
        at org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:592)
        at org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:563)
        at org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:370)
        at org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:280)
        at org.apache.axis2.schema.ExtensionUtility.invoke(ExtensionUtility.java:103)
        ... 8 more

NOTE: Apache CXF fails as well :(

Andrey Adamovich
  • 20,285
  • 14
  • 94
  • 132

8 Answers8

11

There are only 3 options that I have found that can be used in Java for old-style rpc/encoded web services:

1) SUN's reference implementation of JAX-RPC (wscompile)

2) WebLogic's clientgen (I used 8.1 version)

3) Axis1 v1.4 wsdl2java

Originally we used Axis 1.4 for that and it showed quite poor performance on relatively large service responses (>20k) i.e. client processing time increased more than twice comparing to plain HTTP request without parsing. And the time grows if response gets bigger. It took more than 30s to just deserialize 1MB large respose.

SUN's generated client didn't really work and it failed on request with the message:

unexpected element name: 
   expected=getSubscriberInfoReturn, 
   actual={ws.generated.api}getSubscriberInfoReturn

I have tried using WebLogic's 8.1 clientgen, and compared client code to Axis 1.4 generated client's performance. And Axis won the race. So, even though Axis client is performing not that good on relatively large responses it still is the best option out there for old rpc/encoded web services :(.

Andrew Janke
  • 23,508
  • 5
  • 56
  • 85
Andrey Adamovich
  • 20,285
  • 14
  • 94
  • 132
  • Could you show how to do this precisely? When running `java -classpath path/to/axis-1_4/lib/ org.apache.axis.wsdl.WSDL2Java` I got an `Error: Could not find or load main class org.apache.axis.wsdl.WSDL2Java` – Valentin Waeselynck Apr 03 '15 at 15:36
  • Man, it was 6 years ago :). Your error indicates you have issues with your classpath. – Andrey Adamovich Apr 06 '15 at 20:38
5

RPC encoding is not supported on Axis2. Source: http://wiki.apache.org/ws/StackComparison

Buhake Sindi
  • 87,898
  • 29
  • 167
  • 228
2

Try Axis 1, I've used it for this exact reason.

Robert Munteanu
  • 67,031
  • 36
  • 206
  • 278
  • Yes, we use Axis 1 at the moment, actualy. But we hit performance problems with that :(. Do you know of any other alternatives to Axis 1 or 2 or Apache CXF? – Andrey Adamovich Aug 31 '09 at 13:41
1

I've had issues with SimpleDataBinding in axis2 too. I resolved them by using the AxisDataBinding option. Which is bit more heavy weight from a coding perspective, but works after all.

ADB in detail

Furthermore I'd agree to Robert, stating that axis1 is an interesting option too.

KB22
  • 6,899
  • 9
  • 43
  • 52
1

You can add following parameter for wsdl2java command

-d xmlbeans
taskinoor
  • 45,586
  • 12
  • 116
  • 142
Olcay Tarazan
  • 931
  • 9
  • 12
0

I'm not going to get in depth with this, but since you asked for alternatives:

Java 6 SE and Java 5 EE ship with the Metro JAX-WS (reference) implementation.

It lives in the javax.xml.ws namespace.

Sun's Developer Network has an article Introducing JAX-WS 2.0 With the Java SE 6 Platform that might be useful.

Having said all this, Eclipse is not very JAX-WS friendly.

Powerlord
  • 87,612
  • 17
  • 125
  • 175
  • I would be happy to use JAX-WS, but JAX-WS does not support rpc/encoded style web services. And I cann't change the web service :(, but I need a client for that. – Andrey Adamovich Aug 31 '09 at 14:06
  • I have tried using JAX-RPC reference implementation and wscompile. After downloading all jars that SUN didn't include in normal distrubtion, I managed to generate the client, but it failed with exception: *Caused by: unexpected element name: expected=getSubscriberInfoReturn, actual={http://ws.generated.api}getSubscriberInfoReturn – Andrey Adamovich Sep 01 '09 at 09:24
0

This issue raises if the soap encoding style is old axis2 wsdl2java or wsimport cannot understand the old RPC encoding style so use the axis 1.4 or older version of axis the draw back is that u will not find wsdl2java as a tool in old axis instead you will find it as a class file in the axis jar file so u have to manually set a the classpath and use that class

D:\axis-1_4\lib>java -classpath \axis-1_4\lib* org.apache.axis.wsdl.WSDL2Java urwsdl

Dmitry Mitskevich
  • 4,946
  • 2
  • 15
  • 8
Prashant
  • 81
  • 1
  • 3
0

The answer post on soapenc.xsd found here Clickatell SOAP wsdl to JAXB java classes helped me .

I was using wsdl2java utility of axis1.5, we got the similar error on array.

Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
            at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:271)
            at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
            at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
    Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
            at org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension.engage(SimpleDBExtension.java:53)
            at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:224)
            ... 2 more
    Caused by: java.lang.reflect.InvocationTargetException
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension.engage(SimpleDBExtension.java:50)
            ... 3 more
    Caused by: org.apache.axis2.schema.SchemaCompilationException: can not find type {http://schemas.xmlsoap.org/soap/encoding/}Array from the parent schema ....
            at org.apache.axis2.schema.SchemaCompiler.copyMetaInfoHierarchy(SchemaCompiler.java:1296)
            at org.apache.axis2.schema.SchemaCompiler.processComplexContent(SchemaCompiler.java:1258)
            at org.apache.axis2.schema.SchemaCompiler.processContentModel(SchemaCompiler.java:1153)
            at org.apache.axis2.schema.SchemaCompiler.processComplexType(SchemaCompiler.java:1097)
            at org.apache.axis2.schema.SchemaCompiler.processNamedComplexSchemaType(SchemaCompiler.java:1017)

I tried updating my wsdl file by creating the soapenc.xsd with the contents from website 'http://schemas.xmlsoap.org/soap/encoding/'. As shown below, this worked really for me.

<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1= .. xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns=.. xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace=..>
<types>
    <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace=.. xmlns:ns1=.. xmlns:ns2=.. xmlns:tns=.. xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
</types>
<import location="soapenc.xsd" namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<message name="Input">
    <part name=../>
</message>
<message name="Output">
    <part name=../>
</message>
<portType name=".."> .. </portType>
<binding name="..." type="tns:"..">
    <operation name="...">          ..          </operation>
    <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
</binding>
<service name="...">
    <port binding="tns:..." name="...">         <soap:address location="..."/>      </port>
</service>