test
Class DualEndpoint

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by soaprest.DualProvider
              extended by test.DualEndpoint
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig, javax.xml.ws.Provider<javax.xml.transform.Source>

@Copyright
@SoapRestProvider(serviceName="TestService",
                  portName="TestEndpoint",
                  targetNamespace="http://test",
                  wsdlLocation="wsdl/TestService.wsdl")
public class DualEndpoint
extends DualProvider

Test endpoint that can be deployed either stand-alone or in a servlet container. Operations can be invoked using either REST or SOAP.

See Also:
Serialized Form

Field Summary
private static long serialVersionUID
          Default version identifier.
 
Constructor Summary
DualEndpoint()
          Construct a Test web service that can be invoked with either SOAP or ReST.
 
Method Summary
 void init()
          Initialize the web service after it has been deployed in a servlet container.
static void main(java.lang.String... args)
          This program deploys the test web service as a stand-alone service.
 
Methods inherited from class soaprest.DualProvider
deploy, getImplementation, getMessageContext, getWsdlLocation, init, invoke, returnRestFaults, service, setWsdlLocation
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Default version identifier.

See Also:
Constant Field Values
Constructor Detail

DualEndpoint

public DualEndpoint()
             throws java.lang.Exception
Construct a Test web service that can be invoked with either SOAP or ReST. In addition, it can be deployed either stand-alone or in a servlet container. Note that the constructor must have no parameters, so that it can be deployed by a container. Any parameters must be specified in the web.xml file and extracted using the getInitParameter method after the endpoint has been deployed in a servlet container. If the endpoint is deployed stand-alone, then parameters should be set by means of a separate method such as in this example.

Throws:
java.lang.Exception - if the web service provider cannot be constructed.
Method Detail

init

public void init()
Initialize the web service after it has been deployed in a servlet container. This is where one can obtain the servlet context and the parameters specified in the web.xml file.

Overrides:
init in class javax.servlet.GenericServlet

main

public static void main(java.lang.String... args)
                 throws java.lang.Exception
This program deploys the test web service as a stand-alone service.

Parameters:
args - The following are the command-line arguments.
  1. The location of the WSDL document. It can also be specified by an annotation. The one specified on the command-line takes precedence.
  2. The web service URL. The default is http://localhost:7000/test.
  3. Whether to return ReST faults. The default is false.
Throws:
java.lang.Exception - if the test service cannot be deployed.