Wednesday, March 7, 2012

web.xml File: ATG WSDL


web.xml File

The web.xml file is the standard deployment descriptor for the Web application that the Web service is a part of. It declares the filters and servlets used by the service.

On the ATG platform, the servlet that listens for the SOAP request is com.sun.xml.rpc.server.http.JAXRPCServlet. This servlet is part of the JAX-RPC reference implementation, and is responsible for receiving the incoming SOAP request and determining how to dispatch the call. For example, if you create a Web service called getOrderStatus, the entry for it in the web.xml file looks something like this:

<servlet>
 <servlet-name>getOrderStatus</servlet-name>
 <display-name>getOrderStatus</display-name>
 <servlet-class>com.sun.xml.rpc.server.http.JAXRPCServlet</servlet-class>
 <init-param>
 <param-name>configuration.file</param-name>
 <param-value>WEB-INF/wsconfig/getOrderStatus_Config.properties</param-value>
 </init-param>
</servlet>
...
<servlet-mapping>
 <servlet-name>getOrderStatus</servlet-name>
 <url-pattern>/getOrderStatus/*</url-pattern>
</servlet-mapping>

When a call to the getOrderStatus Web service is sent to the ATG platform, the JAXRPCServlet receives the request and dispatches it based on the information in the file that the configuration.file parameter points to. This configuration file is included in the WAR file, and looks similar to this:

port0.wsdl.serviceName=GetOrderStatusSEIService
port0.tie=webservices.GetOrderStatusSEI_Tie
wsdl.transform=true
port0.name=getOrderStatus
portcount=1
wsdl.location=WEB-INF/getOrderStatus.wsdl
port0.servant=webservices.GetOrderStatusSEIImpl
port0.wsdl.targetNamespace=http\://www.atg.com/webservices
port0.wsdl.portName=GetOrderStatusSEIPort

Note that the port0.servant property is set to the name of the service implementation class. This property designates the class that JAXRPCServlet dispatches the SOAP request to.

Handling Imported WSDL Documents:

As discussed in the WSDL Document section, there are two resources that assist in handling WSDL requests. These resources are declared in the web.xml file:

WSDLImportFilter, which is a filter of class atg.webservice.WSDLImportFilter, is mapped to a parent directory that has subdirectories holding WSDL documents.

WSDLFinder, which is a servlet of class atg.webservice.WSDLFinderServlet, should be defined and mapped to each path that will lead to a WSDL document.

For example:

<filter>
 <filter-name>WSDLImportFilter</filter-name>
 <filter-class>atg.webservice.WSDLImportFilter</filter-class>
</filter>
...
<filter-mapping>
 <filter-name>WSDLImportFilter</filter-name>
 <url-pattern>/getOrderStatus/*</url-pattern>
</filter-mapping>
...
<servlet>
 <servlet-name>WSDLFinder</servlet-name>
 <display-name>WSDLFinder</display-name>
 <description>Used to lookup imported wsdl files.</description>
 <servlet-class>atg.webservice.WSDLFinderServlet</servlet-class>
</servlet>
...
<servlet-mapping>
 <servlet-name>WSDLFinder</servlet-name>
 <url-pattern>atg.commerce.order.status.wsdl</url-pattern>
</servlet-mapping>
<servlet-mapping>
 <servlet-name>WSDLFinder</servlet-name>
 <url-pattern>atg.security.wsdl</url-pattern>
</servlet-mapping>
<servlet-mapping>
 <servlet-name>WSDLFinder</servlet-name>
 <url-pattern>atg.commerce.wsdl</url-pattern>
</servlet-mapping>


Web Service Registrar:

To register Web services with the Web Services Registry, the web.xml file declares the WebServiceRegistrar servlet, and sets it to load on startup:

<servlet>
 <servlet-name>WebServiceRegistrar</servlet-name>
 <display-name>WebServiceRegistrar</display-name>
 <description>ATG WebServiceRegistrar for registering servlet
 web-services.</description>
 <servlet-class>atg.webservice.WebServiceRegistrar</servlet-class>
 <load-on-startup>1</load-on-startup>
</servlet>

For more information about the Web Services Registry, see Managing Web Services.

Other Elements of web.xml

The web.xml file may declare certain additional elements:

the servlet atg.nucleus.servlet.NucleusServlet, which runs Nucleus as a servlet within a Web application

the filter atg.filter.dspjsp.PageFilter, which invokes the DAF request-handling pipeline

the context parameter atg.session.parentContextName; its value is set to /dyn, which enables the Web services to share information with the atg_bootstrap.war application

No comments:

Popular Posts