Deploying a web service

You must deploy a web service after you implement it.

Before you begin

Implement the web service.

Procedure

Deploy the web service. Use one of the following methods: user interface, Java™, or script.
Option Description
User interface
  1. Click Collaboration Manager > Web Services > New Web Service.
  2. In the New Web Service page, provide all the details for the new web service.

See Example of using the UI to create a web service for details.

Java Sample 1: The following sample Java code creates a script web service.
public void createScriptWebService()
    {
        Context ctx = PIMContextFactory.getCurrentContext();
        DocstoreManager docstoreManager = ctx.getDocstoreManager();
        Document wsdlDoc = docstoreManager.getDocument("archives/wsdl/ItemFinderService0");
        Document implementationScript = docstoreManager.getDocument("scripts/wbs/ItemFinderService0");
        WebServiceManager webServiceManager = ctx.getWebServiceManager();
        webServiceManager.createWebService(  "myScriptService", "This is a sample script service", 
                 wsdlDoc, WebService.MessageStyle.DOCUMENT_LITERAL, implementationScript, 
                 false, false, true, false, true, true );
    }
Sample 2: The following sample Java code creates a Java web service.
public void createJavaWebService()
    {
        Context ctx = PIMContextFactory.getCurrentContext();        
        DocstoreManager docstoreManager = ctx.getDocstoreManager();
        Document wsdlDoc = docstoreManager.getDocument("archives/wsdl/ItemFinderService0");
        Document wsddDoc = docstoreManager.getDocument("archives/wsdd/ItemFinderService0");
        String implClass = "com.ibm.pim.service.sample.ItemFinderServiceImpl";        
        WebServiceManager webServiceManager = ctx.getWebServiceManager();
        webServiceManager.createWebServiceUsingJava( "myJavaService", "This is a sample Java service", 
                 		                  wsdlDoc,  wsddDoc, 
                 		                  WebService.MessageStyle.DOCUMENT_LITERAL, implClass, 
				                            false, false, true, false, true, true );
}
Script
Sample 1: The following sample code creates a script-based web service.
var attr_Name = "ScriptWebService";
var attr_ImplClass="";
var attr_Desc = "Description for Test Webservice";
var attr_WSDLDocPath = "archives/wsdl/test0";
var attr_WSDDDocPath = "archives/wsdd/
test0";
var attr_Protocol = "SOAP_HTTP";
var attr_Style = "RPC_ENCODED";
var attr_ImplScriptPath = "scripts/wbs/test0";
var b_StoreIncoming = true;
var b_StoreOutgoing = true;
var b_Deployed = true;
var b_AuthRequired = true;
var b_SkipRequestValidation=true;
var b_SkipResponseValidation=true;
var ws = createWebService(
attr_Name, 
attr_ImplClass, 
attr_Desc,
attr_WSDLDocPath,
attr_WSDDDocPath, 
attr_Protocol, 
attr_Style, 
attr_ImplScriptPath, 
b_StoreIncoming,
b_StoreOutgoing, 
b_Deployed, 
b_AuthRequired,
b_SkipRequestValidation,
b_SkipResponseValidation);
ws.saveWebService();
out.writeln(ws);
Sample 2: The following sample code creates a Java based web service.
var attr_Name = "JavaWebService";
var attr_ImplClass="com.ibm.ccd.soap.common.SOAPWebService";
var attr_Desc = "Description for Test Webservice";
var attr_WSDLDocPath = "archives/wsdl/test0";
var attr_WSDDDocPath = "archives/wsdd/test0";
var attr_Protocol = "SOAP_HTTP";
var attr_Style = "RPC_ENCODED";
var attr_ImplScriptPath = "";
var b_StoreIncoming = true;
var b_StoreOutgoing = true;
var b_Deployed = true;
var b_AuthRequired = true;
var b_SkipRequestValidation=true;
var b_SkipResponseValidation=true;
var ws = createWebService(
attr_Name, 
attr_ImplClass, 
attr_Desc,
attr_WSDLDocPath,
attr_WSDDDocPath, 
attr_Protocol, 
attr_Style, 
attr_ImplScriptPath, 
b_StoreIncoming,
b_StoreOutgoing, 
b_Deployed, 
b_AuthRequired,
b_SkipRequestValidation,
b_SkipResponseValidation);
ws.saveWebService();
out.writeln(ws);
]
Note: To deploy a web service on WebLogic application servers, you must remove the value from the Listen Address field from the WebLogic Admin console. Otherwise deploying a web service on WebLogic fails because the SOAPWebService class that is used for deployment of web services uses the Listen Address field.

Results

The simple web service is deployed.

What to do next

Next, access the web service.