How to consume JAX-RPC wsdl / wstools - [ERROR] rpc/encoded wsdls are not supported in JAXWS 2.0 in JBoss EAP?

Solution Unverified - Updated -

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)

    • 4.3
    • 5.x
  • JBossWS-Native

  • Spring

Issue

  • I need to build a WS client or endpoint using an RPC/encoded WSDL.
  • I am unable to generate java files from my WSDL using wsconsume; I got this error:
"[ERROR] rpc/encoded wsdls are not supported in JAXWS 2.0."
  • I got these warnings also:
[wsconsume] [WARNING] src-resolve: Cannot resolve the name 'soapenc:Array' to a(n) 'type definition' component.
...
[wsconsume] [ERROR] undefined simple or complex type 'soapenc:Array'
...
[wsconsume] [ERROR] undefined attribute 'soapenc:arrayType'
...
  • How can one make jax-rpc calls using spring ?

Resolution

JAX-WS does not support RPC/endoded WSDLs, and RPC/encoded WSDLs have never been fully supported in JBossWS tools. It's highly recommended that your web services is migrated to a supported encoding. The recommended encoding is document/literal.

If you must use RPC/encoded, you need to use wscompile (found in JWSDP) to generate stubs and wstools to generate a JAX-RPC mapping file. Please note that this is not guaranteed to work; we can only give a commercially reasonable effort to solve any issues with this solution.

  • First, you must install JWSDP. This can be found at Oracle's website[1]. The JWSDP installer may not work correctly. Here's how to work around those issue:
    1. This assumes you're using Fedora. The locations/settings may be different for other OSes.
    2. You need Java 1.5. Download the non-RPM Oracle JDK 1.5 from their website.
    3. Execute the downloaded file. Press enter until you're prompted, then type yes (the whole word). This will unzip the JDK in the current directory.
    4. Copy the extracted directory to /usr/lib/jvm. I renamed mine to oracle-jdk1.5.0_22.
    5. link /etc/alternatives/java to /usr/lib/jvm/oracle-jdk1.5.0_22. [I tried linking javac and jar, but I just linked those directly from /usr/bin]
    6. Download JWSDP 2.0.
    7. First try executing the .sh. If that doesn't work, extract the jar from the .sh: tail -n +368 jwsdp-2_0-unix.sh > out.jar
    8. Explode the jar: unzip -d tmp out.jar && rm out.jar && mv tmp out.jar && cd out.jar
    9. Run the installer: java -classpath . JWSDP
    10. Choose no when it asks you about a web container. All defaults are fine.
  • Next, download the attached zip file. This contains a script to run wscompile. You need to modify wscompile-config.xml to point to your WSDL.
  • Once you're run wscompile-wsdl.sh, run the commands in the README to remove files that aren't needed and are incompatible with JBoss.
  • Now you need to generate the mapping file. To generate the mapping file, create a wstools config file:
<?xml version="1.0" encoding="UTF-8">
<configuration xmlns="http://www.jboss.org/jbossws-tools" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.jboss.org/jbossws-tools http://www.jboss.org/jbossws-tools/schema/jbossws-tool_1_0.xsd">
    <wsdl-java location="MyService.wsdl" serializable-types="true">
    <mapping file="jaxrpc-mapping.xml"/>
    </wsdl-java>
</configuration>
  • Run this command: $JBOSS_HOME/bin/wstools.sh -config wstools-wsdl-java.xml -dest ./tmp
  • Make sure the wstools-wsdl-java.xml is in the same directory as the WSDL.
  • You then need to combine all these files into a deployment or project.
    • jaxrpc-mapping.xml goes in WEB-INF
    • Stub classes go in their respective packages within WEB-INF/classes
    • Follow the standard methodology for creating a JAX-RPC client/endpoint

If you cannot get this to work, you will need to use Apache Axis 1.x to deploy your client/endpoint. Include the Axis libraries in your application library, and make sure your application is isolated (WARs are isolated by default). We don't support Apache Axis, but JBoss support can give a commercially reasonable effort to help you out if you run across additional issues.

[1] http://java.sun.com/webservices/downloads/previous/webservicespack.jsp

Attachments

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.