This section describes the command-line options for deploying J2EE Web services using the deploy command located in the bin subdirectory of your EAServer installation. See Chapter 12, “Command Line Tools” for more information about this, and other command line tools.
deploy [options] entity [-contextpath path]
The most simple form of the deploy command for the various archive files is:
deploy foo.jar
deploy foo.ear
deploy foo.war
Where:
Option |
Description |
---|---|
|
There are three ws options that define how a Web service is exposed:
|
|
Use this syntax to overwrite the <soap:address location> in the WSDL file referred to by <service-ref-name> in the web.xml, ejb-jar.xml or application-client.xml and the <port name> in the WSDL file: -wsClientAddress:<serviceRefName>: <portComponentName> <address> |
|
Use this syntax to specify the context path for an EJB Web service in an application EAR file: -wsContextPath:<jarFileInEar>:<contextpath> Use this syntax to specify the context path for an EJB Web Service: -wsContextPath <contextpath> |
|
Specify the endpoint address URI for an EJB Web service using this syntax: -wsEndpointAddressURI <ejbName>:<endpoint-address-uri> Specify the endpoint address URI for an EJB Web service in an Application EAR file using this syntax: -wsEndpointAddressURI:<jarFileInEar>:<ejbName>: <endpoint-address-uri> |
|
Specify the Web service style ( DOCUMENT, RPC or WRAPPED) of the generated WSDL binding used when exposing an EJB as a Web service using this syntax: -wsStyle <style> Specify the Web service style ( DOCUMENT, RPC or WRAPPED) of the generated WSDL binding used when exposing an EJB as a Web service contained in an application EAR file using this syntax: -wsStyle:<jarFileInEar>:<style> |
|
Specify the use (LITERAL or ENCODED) of items in the generated WSDL binding when exposing an EJB as a Web service using this syntax: -wsUse <use> Specify the use (LITERAL or ENCODED) of items in the generated WSDL binding when exposing an EJB as a Web service in an application EAR file using this syntax: -wsUse:<jarFileInEar>:<use> |
|
Override the default name for the Web application generated from an EJB Web Service using this syntax: -wsWebAppName <webappname> Override default name for the Web application generated from an EJB Web Service in an application EAR file using this syntax: -wsWebAppName:<jarFileInEar>:<webappname> |
|
The file that you are deploying. entity should be located in the current directory, or provide the full path using the contextpath option. |
|
Specify the contextPath for Web application deployment. The default is the name of the WAR file. If -package is specified, then the package is the context path. |
|
Enter deploy -help to display all command line options |
This example uses the deploy and undeploy commands located in EAServer’s bin subdirectory to demonstrate using default context path and default end point addresses for stateless EJB Web Services by deploying a Web service contained in the HiWS.jar file, and the client that is contained in the HiWSClient.war file.
Deploy the HiWS.jar file:
deploy.bat C:\WebSvcSample\setA\HiWS.jar (Windows) deploy.sh WebSvcSample/setA/HiWS.jar (Unix)
Verify the EJB Web Service URL location from your browser:
http://localhost:8000/hiws/HiWS?WSDL
The WSDL of HiWS EJB Web service displays
Deploy the HiWSClient.war file by entering this command from EAServer’s bin subdirectory:
deploy.bat C:\WebSvcSample\setA\HiWSClient.war (Windows) deploy.sh WebSvcSample/setA/HiWSClient.war (Unix)
Test the servlet by entering this URL in your browser:
http://localhost:8000/HiWSClient/HiServlet
Enter a name (e.g., John) and click Enter
Result: Hi John!
Undeploy the EJB and Web applications by entering these commands from EAServer’s bin subdirectory
undeploy ejbjar-hiws
undeploy webapp-hiwsclient
This example uses the deploy command to specify the context path and end point address for a stateless EJB Web service by matching the context path and end point address to the SOAP address specified in the HiWSClient.war’s hiWS.wsdl file. This typically happens when one organization provides the Web service and another organization uses/consumes the Web service. The set of published URIs (e.g., webservice/sayHi) serves as a contract between Web service provider and Web service consumer.
Deploy the HiWS.jar file:
deploy.bat -wsContextPath webservice -wsEndpointAddressURI HiWS:sayHi
C:\WebSvcSample\setB\HiWS.jar
(Windows)
deploy.sh -wsContextPath webservice -wsEndpointAddressURI HiWS:sayHi
WebSvcSample/setB/HiWS.jar
(Unix)
Verify the EJB Web service URL location by entering this in your browser:
http://localhost:8000/\b
webservice/sayHi\b0 ?WSDL
The WSDL of HiWS EJB Web service displayes
Deploy the HiWSClient.war file:
deploy.bat C:\WebSvcSample\setB\HiWSClient.war
(Windows)
deploy.sh WebSvcSample\setB\HiWSClient.war
(Unix)
Test the servlet by entering this URL in your browser:
http://localhost:8000/HiWSClient/HiServlet
Enter a name (e.g., John) and click Enter
Result: Hi John!
Undeploy the EJB and Web applications:
undeploy ejbjar-hiws
undeploy webapp-hiwsclient