Java Reference
In-Depth Information
publishing a web service via
Endpoint.publish()
, which automatically
generates the artifacts and WSDL/schema. You'll learn about
End-
point.publish()
later in this chapter.
•
wsimport
: This tool generates client-support Java classes (artifacts) from a
givenWSDLdocument.Theseclassesfacilitatewritingaclientagainsttheser-
vice.
•
xjc
: This tool generates Java classes from a schema. The generated classes
contain properties mapped to the XML elements and attributes defined in the
schema.
For brevity, I demonstrate only
wsimport
in this chapter. For demonstrations of
schemagen
and
xjc
, check out “Using JAXB schemagen tooling to generate an
XMLschemafilefromaJavaclass”(
http://publib.boulder.ibm.com/in-
twbs_jaxbjava2schema.html
)
and “Java Architecture for XML Binding
index-140168.html
), respectively.
Lightweight HTTP Server
TheJava7referenceimplementationincludesalightweightHTTPserverfordeploying
and testing web services. The server implementation supports the HTTP and HTTPS
protocols,anditsassociatedAPIcanbeusedtocreateacustomizedwebservertoen-
hance your web service testing or for other purposes.
Theserver'sAPIisnotaformalpartofJava,whichmeansthatit'snotguaranteedto
bepartofnonreferenceJavaimplementations.Asaresult,thelightweightHTTPserver
APIisstoredinthefollowingpackagesinsteadofbeingdistributedinpackagessuchas
java.net.httpserver
and
java.net.httpserver.spi
:
•
com.sun.net.httpserver
: This package provides a high-level HTTP
server API for building embedded HTTP servers.
•
com.sun.net.httpserver.spi
:Thispackageprovidesapluggableser-
vice provider API for installing HTTP server replacement implementations.
The
com.sun.net.httpserver
packagecontainsan
HttpHandler
interface,
whichyoumustimplementtohandleHTTPrequest-responseexchangeswhencreating
yourownHTTPserver.Thispackagealsocontainsseventeenclasses;thefourmostim-
portant classes are described in
Table 11-2
.