Forwarding as I fell for just pressing respond and googlemail only responded
to the first mail address.

Simon

---------- Forwarded message ----------
From: Simon Laws <[EMAIL PROTECTED]>
Date: Jul 25, 2007 3:01 PM
Subject: Re: servlet TuscanyServlet threw exception
To: Nishant Joshi <[EMAIL PROTECTED]>



On 7/25/07, Nishant Joshi <[EMAIL PROTECTED]> wrote:

 Hi Simon,

I have used target servlet as Tuscany servlet which is actually get some
URI path from me and get me some servlet,

But if u see the complete Process of How it get URI from us and get
servlet back to us it looks there is one map in WebAppServletHost called
servles it is the creating problem for me, You can download source code of
Tuscany from

http://cwiki.apache.org/TUSCANY/sca-java-releases.html



Mine problem now is How to register servlet and call one function
addServletMapping() from WebAppServletHost.java file



thanks



Nishant Joshi



This message and the information contained herein is proprietary and 
confidential and subject to the Amdocs policy statement,
you may review at
http://www.amdocs.com/email_disclaimer.asp


Ok, I think we need to take a step back and walk through what you are trying
to do. From the previous posts I have imagined that you were trying to

1/ run SCA as part of a web app (and that you have got that working)
2/ add some web services to that web app

Let me know if you are trying to do something else.

Assuming this is the case lets talk about 1/ first. There is an example of
how to do this in samples/calculator-webapp. If you look at the
Calculator.composite file for this application you see

<composite xmlns="http://www.osoa.org/xmlns/sca/1.0";
          targetNamespace="
http://sample";
          xmlns:sample="http://sample";
          name="Calculator">

   <component name="CalculatorServiceComponent">

                <implementation.java class="calculator.CalculatorServiceImpl"/>
       <reference name="addService" target="AddServiceComponent"></reference>
       <reference name="subtractService"
target="SubtractServiceComponent"></reference>

       <reference name="multiplyService"
target="MultiplyServiceComponent"></reference>
       <reference name="divideService"
target="DivideServiceComponent"></reference>

   </component>

   <component name="AddServiceComponent">
       <implementation.java class="calculator.AddServiceImpl"/>
   </component>

   <component name="SubtractServiceComponent">

       <implementation.java class="calculator.SubtractServiceImpl"/>
   </component>

   <component name="MultiplyServiceComponent">
       <implementation.java
class="calculator.MultiplyServiceImpl"/>
   </component>

   <component name="DivideServiceComponent">
       <implementation.java class="calculator.DivideServiceImpl
"/>
   </component>

</composite>

Now there is no mention here of servlets or that this application is running
in a webapp. If you look at the calculator-webapp\src\main\webapp\calc.jsp
file you see

<%@ page import="org.apache.tuscany.sca.host.embedded.SCADomain"%>
<%@ page import="calculator.CalculatorService" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
  SCADomain scaDomain = (SCADomain) application.getAttribute("
org.apache.tuscany.sca.SCADomain");
  CalculatorService calculatorService = scaDomain.getService(
CalculatorService.class, "CalculatorServiceComponent");
%>
<html>
<head><title>Calculator sample</title></head>

<body>
<table>
   <tr>
       <th>Expression</th><th>Result</th>
   </tr>
   <tr>
       <td>2 + 3</td><td><%= calculatorService.add(2, 3) %></td>
   </tr>
   <tr>
       <td>3 - 2</td><td><%= calculatorService.subtract(3, 2) %></td>
   </tr>
   <tr>
       <td>3 * 2</td><td><%= calculatorService.multiply(3, 2) %></td>
   </tr>
   <tr>
       <td>3 / 2</td><td><%= calculatorService.divide(3, 2) %></td>
   </tr>
</table>
</body>
</html>

The web.xml file itself uses the TuscanyContextListener to start the SCA
runtime (SCADomain) and register it in the servlet context so that the JSP
can access it.

<web-app>

 <display-name>Tuscany Calculator Web Service Sample</display-name>

 <listener>
   
<listener-class>org.apache.tuscany.sca.webapp.TuscanyContextListener</listener-class>

 </listener>

 <welcome-file-list id="WelcomeFileList">
   <welcome-file>calc.jsp</welcome-file>
 </welcome-file-list>

</web-app>

In case 2/. If you want to expose some of the SCA components as web services
then you need to describe the appropriate bindings in the composite file,
for example, here, I have changed the calculator SCA application to expose
the AddServiceComponent as a web service. I have to provide the WSDL for
this service but the runtime should be able to work out how to register the
underlying Axis servlet so that the web services run.

<composite xmlns="http://www.osoa.org/xmlns/sca/1.0";
          targetNamespace="http://sample";
          xmlns:sample=" http://sample";
          name="Calculator">

   <component name="CalculatorServiceComponent">
       <implementation.java class="calculator.CalculatorServiceImpl "/>
       <reference name="addService" >
          <interface.java interface="calculator.AddService" />
          <binding.ws wsdlElement="
http://calculator#wsdl.port(AddService/AddSoapPort)<http://calculator#wsdl.port%28AddService/AddSoapPort%29>"/>

       </reference>
       <reference name="subtractService"
target="SubtractServiceComponent"></reference>
       <reference name="multiplyService"
target="MultiplyServiceComponent"></reference>
       <reference name="divideService"
target="DivideServiceComponent"></reference>
   </component>

   <component name="AddServiceComponent">
       <implementation.java class="calculator.AddServiceImpl"/>
       <service name="AddService">
           <interface.java interface="calculator.AddService" />
           <binding.ws
wsdlElement="http://calculator#wsdl.port(AddService/AddSoapPort)<http://calculator#wsdl.port%28AddService/AddSoapPort%29>
"/>
       </service>
   </component>

   <component name="SubtractServiceComponent">
       <implementation.java class="calculator.SubtractServiceImpl"/>
   </component>

   <component name="MultiplyServiceComponent">
       <implementation.java class="calculator.MultiplyServiceImpl "/>
   </component>

   <component name="DivideServiceComponent">
       <implementation.java class="calculator.DivideServiceImpl"/>
   </component>

   <component name="ExtensionPointRegistryInspectorComponent">
       <implementation.java class="
org.apache.tuscany.sca.tools.registryinspector.inspector.ExtensionPointRegistryInspectorImpl"/>
   </component>

</composite>

I'm in the middle of trying this out to make sure that it does run :-). Let
me know if these two points are an accurate reflection of what you are
trying to achieve. In particular I'm interested to know why you ask " How to
register servlet and call one function addServletMapping() from
WebAppServletHost.java file" as this function should be hidden unless of
course you are writing some new host integration.

Regards

Simon

Reply via email to