Altova MapForce 2023 Enterprise Edition

Java SOAP Web Services Specifics

Home Prev Top Next

MapForce generates all necessary code and scripts needed to create a SOAP Web service. However, for the Web service to be available to consumers, the generated code must be built and deployed to the Apache Tomcat server with Axis2 installed. Additionally, Apache Ant is required to build the Java code.


Generating and building Java code

1.Open the Web service project from which you want to generate code. See the previous section, Creating Web Service Projects from WSDL files, for an example of how to create such a project.

2.On the Project menu, click Generate code in | Java, and select the target directory. When code generation completes, several folders and files are created in the target directory, including a com directory which contains Altova generic classes, as well as the actual classes of the Web service project.

3.Build the generated Java code (by supplying to Apache Ant the build.xml file generated by MapForce). As a result, an Axis Archive File (*.aar) file is created, which you can then deploy to Axis2.


Note for Eclipse users: when you open the generated project with Eclipse, you may see an error like "The import org.apache cannot be resolved". In this case, make sure that the Axis2 libraries are added to the Java build path. To add the Axis2 libraries to the Java build path in Eclipse 4.4.2, do the following:


1.Right-click the project in the Package Explorer, and select Properties.

2.Click Java Build Path.

3.On the Libraries tab, click Add External JARs, and add the Axis2 libraries from the <AXIS2_HOME>\lib folder.


Deploying the Web service

To deploy the Web service, do one of the following:


Open the "Upload Services" Web administration page of Axis2 and upload the .aar file created in the previous step

Do a manual upload. For example, if your Tomcat server was installed to the folder <TOMCAT_HOME>, you can manually copy the .aar file to <TOMCAT_HOME>\webapps\axis2\WEB-INF\services.

For a step-by-step example, see Example: Generating SOAP Web Services (Java).




Delete the *.aar file from the <TOMCAT_HOME>\webapps\axis2\WEB-INF\services folder.


Axis2 limitations

Axis2 support for RPC/encoded is limited. MapForce can, however, generate RPC/encoded Web services (both SOAP 1.1 and SOAP 1.2). The limitation is that the original WSDL is not retrieved from the Web server.


This means that, for example, would not return a usable .wsdl file.


For document/literal Web services, the URL above will provide a usable and correct .wsdl file. It will differ from the original, however: comments will be stripped out, and namespaces will be changed. It will, however, still have the same semantics as the original .wsdl file with which the service was generated.


Although Axis2 does not support RPC/encoded, it is able to generate WSDL from deployed Java code (compiled code), and thus MapForce-generated code can process RPC/encoded messages; Axis2 is just used for transport.


Known issue: namespaces in the SOAP response message

The code generated by MapForce instantiates the javax.xml.transform.TransformerFactory class. When the class implementation is loaded, it might be read from the javax.xml.transform.TransformerFactory system property (for details, refer to the Java documentation of this class).


If the system property javax.xml.transform.TransformerFactory in your Java environment defines the implementation org.apache.xalan.transformer.TransformerIdentityImpl, the SOAP response message may be generated with incorrect namespaces.


To prevent this issue, it is recommended to use the org.apache.xalan.xsltc.trax.TransformerFactoryImpl implementation. You can do this by adding the following parameter to the Java Virtual Machine (JVM):




The instructions for adding the parameter to the JVM depend on the operating system and server you are using. The following instructions are applicable to Apache Tomcat 7.0 configured to run as a service application on Windows 7:


1.Run Tomcat7w.exe (this file is located in the \bin subfolder of the Tomcat distribution root folder, CATALINA_HOME).

2.Click the Java tab.

3.At the end of "Java Options" box, enter: -Djavax.xml.transform.TransformerFactory=org.apache.xalan.xsltc.trax.TransformerFactoryImpl


© 2016-2022 Altova GmbH