I'd like to repost my answer to a Forums question about Web Service mappings in Flex. This shows the relationship of a web service alias the Flex Store application to the class that implements the web service.


Question:


How does the sample flexstore identify the web service location? I've traced it to the flex-config.xml file, under the white list named service "FlexStoreCatalogWS. I guess my question is how, and to what, does {context.root}/services/CatalogWS?wsdl get resolved?

Answer:


The Flex Store application refers to the CatalogWS Web service in flexstore.mxml, including the verbatim comments:










So, here catalogWS is mapped to the service name FlexStoreCatalogWS.


In flex-config.xml, FlexStoreCatalogWS is described as a named webservice like this:



{context.root}/services/CatalogWS?wsdl

{context.root}/services/CatalogWS

true
false



The wsdl location, as you correctly pointed out, is: {context.root}/services/CatalogWS?wsdl


Here, /services/ is a servlet mapping defined in web.xml, the deployment descriptor:



SamplesAxisServlet
/services/*



This maps all requests having the pattern /services/* in the url to the SamplesAxisServlet servlet. Apache Axis is part of the Flex samples application, and can be found inside the webservices.jar in {samples}WEB-INFlib. The SamplesAxisServlet servlet mapping is also defined in web.xml, as shown here:




SamplesAxisServlet
Apache-Axis Servlet
org.apache.axis.transport.http.AxisServlet



Here, the class org.apache.axis.transport.http.AxisServlet in webservices.jar will handle requests that come through the /services/ url pattern.


Apache Axis uses a wsdd file to define specific webservices. In this case, WEB-INF/server-config.wsdd defines CatalogWS as:





>



So, the actual class that implements the Catalog webservice is Catalog.class in the package samples.flexstore. You can find that class at WEB-INFclassessamplesflexstoreCatalog.class, where WEB-INFclasses is the J2EE location to add classes that will be accessible in the web application.


This is how the alias CatalogWS in an MXML file maps all the way down to Catalog.class. The Flex Store application also provides the java source for Catalog.class in the same directory, along with the data for the catalog in catalog.xml.