Java Reference
In-Depth Information
The S: and ns2: namespace prefixes are generated by JAX-WS.
Note To learn more about SOAP message handlers (especially on using @Hand-
lerChain ), check out Oracle's “Creating and Using SOAP Message Handlers” tu-
torial ( http://download.oracle.com/docs/cd/E12840_01/wls/doc-
s103/webserv_adv/handlers.html ) .
Authentication and a Customized Lightweight HTTP Server
YoucancreateacustomizedlightweightHTTPserverthatoffersadditionalfeaturesfor
testing a web service, and replace the default lightweight HTTP server that is started
in response to an Endpoint.publish() invocation with your server. What makes
this possible is that Endpoint 's void publish(Object serverContext)
method can accept as its argument an instance of a class that subclasses the abstract
com.sun.net.httpserver.HTTPContext class.
Note You can find JDK 7 documentation on HTTPContext and the rest of
the com.sun.net.httpserver package's interface and classes at ht-
tp://download.oracle.com/javase/7/docs/jre/api/net/ht-
tpserver/spec/com/sun/net/httpserver/package-summary.html .
Forexample,supposeyouwanttotestbasicauthenticationwithyourwebservice—I
introducedthistopicin Chapter9 . Ontheclientside,youinstalladefaultauthenticator
thatsuppliesausernameandpasswordtothewebservice. Listing11-21 revealsthisau-
thenticator in the context of TempVerterClient .
Listing 11-21. Supporting basic authentication with the TempVerterClient application
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import ca.tutortutor.tv.TempVerter;
class TempVerterClient
Search WWH ::




Custom Search