geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lasan...@opensource.lk
Subject Session Bean as a Web Service - V2
Date Wed, 18 Oct 2006 19:04:51 GMT
Hi All,

In one of previous mails I asked how can I deploy session bean as a web
service. Now with the help of David and others I can deploy it in G 1.1.1
without errors. But it gives following error when I try to access it
through a web client in same ear. I can't view the WSDL of the WS from a
browser too.

Any obvious thing I am missing here?

########### Error when accessing WS from a client #####################

javax.xml.rpc.ServiceException: no port for class
org.apache.geronimo.samples.calc.CalculatorService
        at
org.apache.geronimo.axis.client.ServiceImpl.internalGetPortFromClassName(ServiceImpl.java:160)
        at
org.apache.geronimo.axis.client.ServiceImpl.getPort(ServiceImpl.java:78)
        at
org.apache.geronimo.samples.calc.web.CalculatorClientServlet.callService(Unknown
Source)
        at
org.apache.geronimo.samples.calc.web.CalculatorClientServlet.doGet(Unknown
Source)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
        at
org.apache.geronimo.tomcat.valve.DefaultSubjectValve.invoke(DefaultSubjectValve.java:56)
        at
org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:342)
        at
org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:31)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
        at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
        at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
        at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
        at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
        at java.lang.Thread.run(Thread.java:595)

################### CalculatorServiceEJB.wsdl ##############################

<?xml version="1.0" encoding="UTF-8"?>

<definitions name="CalculatorServiceEJB"
targetNamespace="urn:geronimo-samples" xmlns:tns="urn:geronimo-samples"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
  <types/>
  <message name="CalculatorService_addition">
    <part name="int_1" type="xsd:int"/>
    <part name="int_2" type="xsd:int"/>
  </message>
  <message name="CalculatorService_additionResponse">
    <part name="result" type="xsd:int"/>
  </message>
  <portType name="CalculatorService">
    <operation name="addition" parameterOrder="int_1 int_2">
      <input message="tns:CalculatorService_addition"/>
      <output message="tns:CalculatorService_additionResponse"/>
    </operation>
  </portType>
  <binding name="CalculatorServiceBinding" type="tns:CalculatorService">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="rpc"/>
    <operation name="addition">
      <soap:operation soapAction=""/>
      <input>
        <soap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
use="encoded" namespace="urn:geronimo-samples"/>
      </input>
      <output>
        <soap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
use="encoded" namespace="urn:geronimo-samples"/>
      </output>
    </operation>
  </binding>
  <service name="CalculatorServiceEJB">
    <port name="CalculatorServicePort"
binding="tns:CalculatorServiceBinding">
      <soap:address location="REPLACE_WITH_ACTUAL_URL"/>
    </port>
  </service>
 </definitions>

###################### jaxrpc-mapping.xml #########################

<?xml version="1.0" encoding="UTF-8"?>
<java-wsdl-mapping xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee   
http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd">
  <package-mapping>
    <package-type>org.apache.geronimo.samples.calc</package-type>
    <namespaceURI>urn:geronimo-samples</namespaceURI>
  </package-mapping>
  <package-mapping>
    <package-type>org.apache.geronimo.samples.calc</package-type>
    <namespaceURI>urn:geronimo-samples</namespaceURI>
  </package-mapping>
  <service-interface-mapping>
	<service-interface>
		org.apache.geronimo.samples.calc.CalculatorService
	</service-interface>
    <wsdl-service-name
xmlns:serviceNS="urn:geronimo-samples">serviceNS:CalculatorServiceEJB</wsdl-service-name>
    <port-mapping>
      <port-name>CalculatorServicePort</port-name>
      <java-port-name>CalculatorServicePort</java-port-name>
    </port-mapping>
  </service-interface-mapping>
  <service-endpoint-interface-mapping>
    <service-endpoint-interface>org.apache.geronimo.samples.calc.CalculatorService</service-endpoint-interface>
    <wsdl-port-type
xmlns:portTypeNS="urn:geronimo-samples">portTypeNS:CalculatorService</wsdl-port-type>
    <wsdl-binding
xmlns:bindingNS="urn:geronimo-samples">bindingNS:CalculatorServiceBinding</wsdl-binding>
    <service-endpoint-method-mapping>
      <java-method-name>addition</java-method-name>
      <wsdl-operation>addition</wsdl-operation>
      <method-param-parts-mapping>
        <param-position>0</param-position>
        <param-type>int</param-type>
        <wsdl-message-mapping>
          <wsdl-message
xmlns:wsdlMsgNS="urn:geronimo-samples">wsdlMsgNS:CalculatorService_addition</wsdl-message>
          <wsdl-message-part-name>int_1</wsdl-message-part-name>
          <parameter-mode>IN</parameter-mode>
        </wsdl-message-mapping>
      </method-param-parts-mapping>
      <method-param-parts-mapping>
        <param-position>1</param-position>
        <param-type>int</param-type>
        <wsdl-message-mapping>
          <wsdl-message
xmlns:wsdlMsgNS="urn:geronimo-samples">wsdlMsgNS:CalculatorService_addition</wsdl-message>
          <wsdl-message-part-name>int_2</wsdl-message-part-name>
          <parameter-mode>IN</parameter-mode>
        </wsdl-message-mapping>
      </method-param-parts-mapping>
      <wsdl-return-value-mapping>
        <method-return-value>int</method-return-value>
        <wsdl-message
xmlns:wsdlMsgNS="urn:geronimo-samples">wsdlMsgNS:CalculatorService_additionResponse</wsdl-message>
        <wsdl-message-part-name>result</wsdl-message-part-name>
      </wsdl-return-value-mapping>
    </service-endpoint-method-mapping>
  </service-endpoint-interface-mapping>
</java-wsdl-mapping>

######################### ejb-jar.xml ######################################

<?xml version="1.0" encoding="UTF-8"?>

<ejb-jar  xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd" version="2.1">
   <description><![CDATA[Calc Application]]></description>
   <display-name>Generated by XDoclet</display-name>
   <enterprise-beans>
      <!-- Session Beans -->
      <session >
         <description><![CDATA[]]></description>

         <ejb-name>CalculatorServiceBean</ejb-name>

      	 <service-endpoint>org.apache.geronimo.samples.calc.CalculatorService</service-endpoint>
         <ejb-class>org.apache.geronimo.samples.calc.ejb.CalculatorServiceBean</ejb-class>
         <session-type>Stateless</session-type>
         <transaction-type>Container</transaction-type>

      </session>

</ejb-jar>

############################ openejb-jar.xml
#################################

<?xml version="1.0" encoding="UTF-8"?>
<openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1">
	<dep:environment
xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">
		<dep:moduleId>
			<dep:groupId>org.apache.geronimo.samples</dep:groupId>
			<dep:artifactId>CalculatorEJB</dep:artifactId>
			<dep:version>1.0</dep:version>
			<dep:type>car</dep:type>
		</dep:moduleId>
		<dep:dependencies>
		     <dep:dependency>
			<dep:groupId>geronimo</dep:groupId>
			<dep:artifactId>geronimo-webservices</dep:artifactId>
			<dep:type>jar</dep:type>
		     </dep:dependency>
		     <dep:dependency>
		        <dep:groupId>geronimo</dep:groupId>
               		<dep:artifactId>geronimo-axis</dep:artifactId>
               		<dep:type>jar</dep:type>
             	     </dep:dependency>
		     <dep:dependency>
               		<dep:groupId>geronimo</dep:groupId>
               		<dep:artifactId>tomcat</dep:artifactId>
               		<dep:type>car</dep:type>
            	     </dep:dependency>
		</dep:dependencies>
		<dep:hidden-classes/>
		<dep:non-overridable-classes/>
	</dep:environment>
	<enterprise-beans>
		<session>
			<ejb-name>CalculatorServiceBean</ejb-name>
			<web-service-address>/Calculator/calc-ejb</web-service-address>
		</session>
	</enterprise-beans>

</openejb-jar>

####################### geronimo-web.xml
#####################################

<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1"
xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.1">
  <dep:environment
xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">
    <dep:moduleId>
      <dep:groupId>org.apache.geronimo.samples</dep:groupId>
      <dep:artifactId>CalculatorWeb</dep:artifactId>
      <dep:version>1.0</dep:version>
      <dep:type>car</dep:type>
    </dep:moduleId>
    <dep:dependencies>
	<dep:dependency>
           <dep:groupId>geronimo</dep:groupId>
           <dep:artifactId>geronimo-webservices</dep:artifactId>
           <dep:type>jar</dep:type>
        </dep:dependency>
	<dep:dependency>
           <dep:groupId>geronimo</dep:groupId>
           <dep:artifactId>geronimo-axis</dep:artifactId>
           <dep:type>jar</dep:type>
        </dep:dependency>
    </dep:dependencies>
    <dep:hidden-classes/>
    <dep:non-overridable-classes/>
  </dep:environment>
  <context-root>/Calculator</context-root>

  <service-ref>
	<service-ref-name>services/Calculator</service-ref-name>
	<port>
		<port-name>CalculatorServicePort</port-name>
		<protocol>http</protocol>
		<host>localhost</host>
		<port>8080</port>
		<uri>/Calculator/calc-ejb</uri>
	</port>
  </service-ref>

</web-app>

############################# web.xml
###############################################

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:calc="urn:geronimo-samples"
		xmlns="http://java.sun.com/xml/ns/j2ee"
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
		xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
		version="2.4">
	<servlet>
		<display-name>CalculatorServiceServlet</display-name>
		<servlet-name>CalculatorServiceServlet</servlet-name>
		<servlet-class>
			org.apache.geronimo.samples.calc.web.CalculatorServiceServlet
		</servlet-class>
	</servlet>
	<servlet>
		<display-name>CalculatorClientServlet</display-name>
		<servlet-name>CalculatorClientServlet</servlet-name>
		<servlet-class>
			org.apache.geronimo.samples.calc.web.CalculatorClientServlet
		</servlet-class>
	</servlet>

	<servlet-mapping>
		<servlet-name>CalculatorServiceServlet</servlet-name>
		<url-pattern>/calc-servlet</url-pattern>
	</servlet-mapping>

	<servlet-mapping>
		<servlet-name>CalculatorClientServlet</servlet-name>
		<url-pattern>/calc-client</url-pattern>
	</servlet-mapping>


	<service-ref>
		<service-ref-name>services/Calculator</service-ref-name>
		<service-interface>javax.xml.rpc.Service</service-interface>
	</service-ref>

</web-app>

Thanks,
Lasantha Ranaweera



Mime
View raw message