Skip to content
arieligena edited this page May 12, 2016 · 1 revision

Introduction

You've made a web service or sombody has given you a WSDL. So what are the input and output? Check the WSDL? No, that's not readable. Instead you can use wsdl2html to generate a readable HTML page from a WSDL url, such as

Alt html-table

See? You will love it! Here is a colorful version.

Sometimes as a developer you haven't got the WSDL ready. Instead you've just finished the jax-ws stubs:

Alt service

But you still want a HTML spec right away. In this case you can still use wsdl2html to generate a readable HTML page from jax-ws stubs

How to run

Run as a command line tool

mvn package 
cd target 
unzip target/wsdl2html-some-version-jarset.zip -d /path/to/your/dir

# Go to the direction of extraction and you will see an executable file. Run it like, 

./wsdl2html.sh http://.../some?wsdl /path/to/your/html/directory  # or wsdl2html.bat for windows

Run it inside your application

In your pom.xml, add the following:

	<repositories>
		<repository>
			<id>jitpack.io</id>
			<url>https://jitpack.io</url>
		</repository>
		...
	</repositories>


	<dependencies>
		<dependency>
			<groupId>com.github.chenjianjx</groupId>
			<artifactId>wsdl2html</artifactId>
			<version>2.0</version>
		</dependency>
		...
	</dependencies>	
//if you call this method in your code, make sure the jdk version you used to run your code is 
// no lower than that of the jdk used  by your "wsimport" to run in shell

String html = org.jaxws.wsdl2html.service.Wsdl2Html.generateHtml(wsdlUrl); 

To generate html from stub classes, check Wsdl2HtmlITCase

		WebServiceStubSet serviceStubSet = WebServiceStubSetFactory
				.createWebServiceStubSet(webServiceClass);

		WebServiceDisplayEngine displayEngine = org.jaxws.stub2html.view.freemarker.ClasspathFreemarkerWebServiceDisplayEngine.createEngine(
				new SimpleJavaNameDisplayStrategy(),
				/* you can use your own template here. this is a classpath */
				"/service.ftl");
				
		String html = displayEngine.displayWebSerivce(serviceStubSet);

Clone this wiki locally