You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Francesco Sessa <fr...@email.it> on 2006/11/24 22:20:30 UTC

Ejb web services and jndi name

Hi all,
I'm a new user of geronimo.
To complete my bachelor thesis, i need to create simples web services
with ejb.
I create the Jar file and deploy it on application server, but, when i
try to connect my client
to my web services, i receive the message that the jndi name isn't correct.
I think that the error was in the deployment xml of the client, but i
don't be able to get the wsdl of the service
via browser (i try with the url written in the wsdl, but, evidently, it
isn't correct).
Please, i must deliver my work monday morning.

endpoint interface
package org.eclipse.Ciao;

import java.rmi.RemoteException;
import java.rmi.Remote;

public interface CiaoWSService extends Remote{
    public String getString(String name) throws RemoteException;
}

home interface
package org.eclipse.Ciao;

import java.rmi.RemoteException;
import javax.ejb.*;

public interface CiaoWSHome extends EJBHome{
    CiaoWS create() throws RemoteException, CreateException;
}

remote interface
package org.eclipse.Ciao;

import java.rmi.RemoteException;
import javax.ejb.*;

public interface CiaoWS extends EJBObject{

    public String getString(String name) throws RemoteException;
}

bean implementation
package org.eclipse.Ciao;

import javax.ejb.*;
import java.rmi.RemoteException;

public class CiaoWSBean implements SessionBean{

    public String getString(String name) throws RemoteException{
        return "Ciao " + name;
    }
    public void ejbCreate(){}
    public void ejbRemove(){}
    public void ejbActivate(){}
    public void ejbPassivate(){}
    public void setSessionContext(SessionContext sc){}
}

----------------------------------------------------------------------------------------------
wsdl generated with jwsdp

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

<definitions name="CiaoWSService" targetNamespace="urn:geronimo-ciaows"
xmlns:tns="urn:geronimo:ciaows" 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="CiaoWSService_getString">
    <part name="String_1" type="xsd:string"/></message>
  <message name="CiaoWSService_getStringResponse">
    <part name="result" type="xsd:string"/></message>
  <portType name="CiaoWSService">
    <operation name="getString" parameterOrder="String_1">
      <input message="tns:CiaoWSService_getString"/>
      <output
message="tns:CiaoWSService_getStringResponse"/></operation></portType>
  <binding name="CiaoWSServiceBinding" type="tns:CiaoWSService">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="rpc"/>
    <operation name="getString">
      <soap:operation soapAction=""/>
      <input>
        <soap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded"
namespace="http://ciaows.org/wsdl"/></input>
      <output>
        <soap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded"
namespace="http://ciaows.org/wsdl"/></output></operation></binding>
  <service name="CiaoWSService">
    <port name="CiaoWSServicePort" binding="tns:CiaoWSServiceBinding">
      <soap:address
location="http://127.0.0.1:8080/ejb/CiaoWS"/></port></service></definitions>
-------------------------------------------------------------------------------------
ejb-jar.xml

<?xml version="1.0" ?>
<ejb-jar id="ejb-jar_1" 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>Web Service CiaoWS </description>
    <display-name>Ciao WS</display-name>
    <enterprise-beans>
        <session>
            <ejb-name>CiaoWSBean</ejb-name>
            <home>org.eclipse.Ciao.CiaoWSHome</home>
            <remote>org.eclipse.Ciao.CiaoWS</remote>
            <ejb-class>org.eclipse.Ciao.CiaoWSBean</ejb-class>
                <session-type>Stateless</session-type>
                <transaction-type>Container</transaction-type>
            </session>
        </enterprise-beans>
</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"
xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1"
xmlns:pkgen="http://www.openejb.org/xml/ns/pkgen-2.0"
xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1"
xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1">
  <sys:environment>
    <sys:moduleId>
      <sys:groupId>default</sys:groupId>
      <sys:artifactId>CiaoWSBean_artifact_in_openejb</sys:artifactId>
      <sys:version>1.0</sys:version>
      <sys:type>car</sys:type>
    </sys:moduleId>
    <sys:dependencies>
    <sys:dependency>
           <sys:groupId>geronimo</sys:groupId>
           <sys:artifactId>geronimo-webservices</sys:artifactId>
           <sys:type>jar</sys:type>
        </sys:dependency>
    <sys:dependency>
           <sys:groupId>geronimo</sys:groupId>
           <sys:artifactId>geronimo-axis</sys:artifactId>
           <sys:type>jar</sys:type>
        </sys:dependency>
    </sys:dependencies>
    <sys:hidden-classes/>
    <sys:non-overridable-classes/>
  </sys:environment>
  <enterprise-beans>
    <session>
    <ejb-name>CiaoWSBean</ejb-name>
    <jndi-name>CiaoWSBean</jndi-name>
    </session>
  </enterprise-beans>
</openejb-jar>

---------------------------------------------------------------------------------------
webservices.xml

<?xml version="1.0" encoding="UTF-8"?>
<webservices 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://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd"
    xmlns:ger="http://ciaows.org/wsdl"
    version="1.1">
    <webservice-description>
        <webservice-description-name>
            CiaoWS
        </webservice-description-name>
        <wsdl-file>META-INF/CiaoWSService.wsdl</wsdl-file>
        <jaxrpc-mapping-file>META-INF/mapping.xml</jaxrpc-mapping-file>
        <port-component>
            <port-component-name>CiaoWS</port-component-name>
            <wsdl-port>ger:CiaoWSServicePort</wsdl-port>
            <service-endpoint-interface>
                org.eclipse.Ciao.CiaoWSService
            </service-endpoint-interface>
            <service-impl-bean>
                <ejb-link>CiaoWSBean</ejb-link>
            </service-impl-bean>
        </port-component>
    </webservice-description>
</webservices>
------------------------------------------------------------------------------------------
mapping.xml generated with jwsdp

<?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.eclipse</package-type>
    <namespaceURI>http://ciaows.org/types</namespaceURI>
  </package-mapping>
  <package-mapping>
    <package-type>org.eclipse</package-type>
    <namespaceURI>http://ciaows.org/wsdl</namespaceURI>
  </package-mapping>
  <service-interface-mapping>
    <service-interface>org.eclipse.CiaoWSService</service-interface>
    <wsdl-service-name
xmlns:serviceNS="http://ciaows.org/wsdl">serviceNS:CiaoWSService</wsdl-service-name>
    <port-mapping>
      <port-name>CiaoWSServicePort</port-name>
      <java-port-name>CiaoWSServicePort</java-port-name>
    </port-mapping>
  </service-interface-mapping>
  <service-endpoint-interface-mapping>

<service-endpoint-interface>org.eclipse.Ciao.CiaoWSService</service-endpoint-interface>
    <wsdl-port-type
xmlns:portTypeNS="http://ciaows.org/wsdl">portTypeNS:CiaoWSService</wsdl-port-type>
    <wsdl-binding
xmlns:bindingNS="http://ciaows.org/wsdl">bindingNS:CiaoWSServiceBinding</wsdl-binding>
    <service-endpoint-method-mapping>
      <java-method-name>getString</java-method-name>
      <wsdl-operation>getString</wsdl-operation>
      <method-param-parts-mapping>
        <param-position>0</param-position>
        <param-type>java.lang.String</param-type>
        <wsdl-message-mapping>
          <wsdl-message
xmlns:wsdlMsgNS="http://ciaows.org/wsdl">wsdlMsgNS:CiaoWSService_getString</wsdl-message>
          <wsdl-message-part-name>String_1</wsdl-message-part-name>
          <parameter-mode>IN</parameter-mode>
        </wsdl-message-mapping>
      </method-param-parts-mapping>
      <wsdl-return-value-mapping>
        <method-return-value>java.lang.String</method-return-value>
        <wsdl-message
xmlns:wsdlMsgNS="http://ciaows.org/wsdl">wsdlMsgNS:CiaoWSService_getStringResponse</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>

-------------------------------------------------------------------------------------
client jsp implementation

<%@ page import="org.eclipse.Ciao.CiaoWSHome,
    org.eclipse.Ciao.CiaoWS,
    javax.naming.InitialContext,
    javax.naming.Context,
    java.util.*"%>

<html>
<head>
    <title>OpenEJB -- EJB for Tomcat</title>
</head>

<body>
Stateless Session bean - HelloBean - says:
<%
    Context initCtx = new InitialContext();

    Object object = initCtx.lookup("java:comp/env/ejb/CiaoWSBean");

    CiaoWSHome ciaoHome = (CiaoWSHome)
        javax.rmi.PortableRemoteObject.narrow(object, CiaoWSHome.class);
    CiaoWS bean = ciaoHome.create();
%>
<%= bean.getString("Francesco") %>
</body>
</html>
---------------------------------------------------------------------
web.xml

<?xml version="1.0" encoding="ISO-8859-1"?>

<web-app 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">

    <description>
      JSP 2.0 Examples.
    </description>
    <display-name>JSP 2.0 Examples</display-name>
    <welcome-file-list>
         <welcome-file>CiaoWSClient.jsp</welcome-file>
    </welcome-file-list>
<!--<ejb-ref>
    <ejb-ref-name>ejb/CiaoWS</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <home>org.eclipse.Ciao.CiaoWSHome</home>
    <remote>org.eclipse.Ciao.CiaoWS</remote>
    <ejb-link>CiaoWSBean</ejb-link>
</ejb-ref>-->
</web-app>
---------------------------------------------------------------------------
geronimo-web.xml

<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.1">
    <environment>
        <moduleId>
            <groupId>default</groupId>
            <artifactId>ejbref-war</artifactId>
            <version>1.0-SNAPSHOT</version>
            <type>car</type>
        </moduleId>
</environment>
<context-root>/CiaoWSClient</context-root>
<!--
<service-ref>
    <service-ref-name>ejb/CiaowS</service-ref-name>
    <service-interface>org.eclipse.client.CiaoWSClient</service-interface>
    <wsdl-file>WEB-INF/CiaoWSService.wsdl</wsdl-file>
    <jaxrpc-mapping-file>WEB-INF/mapping.xml</jaxrpc-mapping-file>
</service-ref>
-->
<service-ref>
    <service-ref-name>ejb/CiaoWS</service-ref-name>
    <port>
        <port-name>CiaoWS</port-name>
        <uri>http://localhost:8080/CiaoWS</uri>
    </port>
</service-ref>
</web-app>

------------------------------------------------------------------------------

I hope in one quick answer. thanks

Francesco

PS. Sorry for my english.



Re: Ejb web services and jndi name

Posted by Peter Petersson <pe...@pmb.mine.nu>.
Hi Francesco

Have you searched this list content for WSDL ? there may be some 
information here.
I dont know much about WSDL but i found the folowing searching this list 
for WSDL in the content.

I dont know if it helps you but here is one of the posts and there are 
plenty more to  read.

Message heding:
Re: Unable to deploy Web service in Geronimo 1.1.1

I figured it out -  I needed to add a dependency to geronimo-axis in my 
 geronimo-web.xml deployment plan:
                 <dep:dependency>
                               <dep:groupId>geronimo</dep:groupId>
                              
 <dep:artifactId>geronimo-axis</dep:artifactId>
                               <dep:version>1.1.1</dep:version>
                               <dep:type>jar</dep:type>
                           </dep:dependency>


Francesco Sessa skrev:
> Hi All,
> I insert the web-service-address in the openejb-jar.xml, like the 
> following code:
>
>  <enterprise-beans>
>    <session>
>        <ejb-name>CiaoWSBean</ejb-name>
>        <jndi-name>CiaoWSBean</jndi-name>
>        <web-service-address>/ejb/CiaoWS</web-service-address>
>    </session>
>  </enterprise-beans>
>
> but the http://localhost:8080/ejb/CiaoWS?WSDL is not available.
>
> nobody can help me?
> Please it's very important.
>
> Francesco Sessa ha scritto:
>> Hi,
>> I believed that the service-ref element in the geronimo-web.xml was 
>> enught.
>> I have modified the web.xml but i receive this message:
>>
>> java.lang.RuntimeException: Could not open stream to wsdl file
>>
>> I know that it's not clear if the wsdl is accessible to the web 
>> service client, but whitch it is the solution?
>>
>>
>> Please help me.
>> this is the new web.xml
>>
>>
>> <?xml version="1.0" encoding="ISO-8859-1"?>
>>
>> <web-app 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">
>>
>> <description>
>> JSP 2.0 Examples.
>> </description>
>> <display-name>JSP 2.0 Examples</display-name>
>> <welcome-file-list>
>> <welcome-file>CiaoWSClient.jsp</welcome-file>
>> </welcome-file-list>
>> <service-ref>
>> <service-ref-name>CiaoWSService</service-ref-name>
>> <service-interface>org.eclipse.Ciao.CiaoWSService</service-interface>
>> <wsdl-file>META-INF/CiaoWSService.wsdl</wsdl-file>
>> <jaxrpc-mapping-file>META-INF/mapping.xml</jaxrpc-mapping-file>
>> </service-ref>
>> </web-app>
>>
>> How to know the url address of the service?
>>
>> Thanks
>>
>> David Jencks ha scritto:
>>> A couple of obvious problems are that you don't have a service-ref 
>>> in the web.xml and it's not clear if the wsdl is accessible to the 
>>> web service client (which IIUC is the web app)
>>>
>>> thanks
>>> david jencks
>>>
>>> On Nov 24, 2006, at 1:20 PM, Francesco Sessa wrote:
>>>
>>>> Hi all,
>>>> I'm a new user of geronimo.
>>>> To complete my bachelor thesis, i need to create simples web services
>>>> with ejb.
>>>> I create the Jar file and deploy it on application server, but, when i
>>>> try to connect my client
>>>> to my web services, i receive the message that the jndi name isn't 
>>>> correct.
>>>> I think that the error was in the deployment xml of the client, but i
>>>> don't be able to get the wsdl of the service
>>>> via browser (i try with the url written in the wsdl, but, 
>>>> evidently, it
>>>> isn't correct).
>>>> Please, i must deliver my work monday morning.
>>>>
>>>> endpoint interface
>>>> package org.eclipse.Ciao;
>>>>
>>>> import java.rmi.RemoteException;
>>>> import java.rmi.Remote;
>>>>
>>>> public interface CiaoWSService extends Remote{
>>>>    public String getString(String name) throws RemoteException;
>>>> }
>>>>
>>>> home interface
>>>> package org.eclipse.Ciao;
>>>>
>>>> import java.rmi.RemoteException;
>>>> import javax.ejb.*;
>>>>
>>>> public interface CiaoWSHome extends EJBHome{
>>>>    CiaoWS create() throws RemoteException, CreateException;
>>>> }
>>>>
>>>> remote interface
>>>> package org.eclipse.Ciao;
>>>>
>>>> import java.rmi.RemoteException;
>>>> import javax.ejb.*;
>>>>
>>>> public interface CiaoWS extends EJBObject{
>>>>
>>>>    public String getString(String name) throws RemoteException;
>>>> }
>>>>
>>>> bean implementation
>>>> package org.eclipse.Ciao;
>>>>
>>>> import javax.ejb.*;
>>>> import java.rmi.RemoteException;
>>>>
>>>> public class CiaoWSBean implements SessionBean{
>>>>
>>>>    public String getString(String name) throws RemoteException{
>>>>        return "Ciao " + name;
>>>>    }
>>>>    public void ejbCreate(){}
>>>>    public void ejbRemove(){}
>>>>    public void ejbActivate(){}
>>>>    public void ejbPassivate(){}
>>>>    public void setSessionContext(SessionContext sc){}
>>>> }
>>>>
>>>> ---------------------------------------------------------------------------------------------- 
>>>>
>>>> wsdl generated with jwsdp
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>
>>>> <definitions name="CiaoWSService" 
>>>> targetNamespace="urn:geronimo-ciaows"
>>>> xmlns:tns="urn:geronimo:ciaows" 
>>>> 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="CiaoWSService_getString">
>>>>    <part name="String_1" type="xsd:string"/></message>
>>>>  <message name="CiaoWSService_getStringResponse">
>>>>    <part name="result" type="xsd:string"/></message>
>>>>  <portType name="CiaoWSService">
>>>>    <operation name="getString" parameterOrder="String_1">
>>>>      <input message="tns:CiaoWSService_getString"/>
>>>>      <output
>>>> message="tns:CiaoWSService_getStringResponse"/></operation></portType>
>>>>  <binding name="CiaoWSServiceBinding" type="tns:CiaoWSService">
>>>>    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
>>>> style="rpc"/>
>>>>    <operation name="getString">
>>>>      <soap:operation soapAction=""/>
>>>>      <input>
>>>>        <soap:body
>>>> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
>>>> use="encoded"
>>>> namespace="http://ciaows.org/wsdl"/></input>
>>>>      <output>
>>>>        <soap:body
>>>> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
>>>> use="encoded"
>>>> namespace="http://ciaows.org/wsdl"/></output></operation></binding>
>>>>  <service name="CiaoWSService">
>>>>    <port name="CiaoWSServicePort" binding="tns:CiaoWSServiceBinding">
>>>>      <soap:address
>>>> location="http://127.0.0.1:8080/ejb/CiaoWS"/></port></service></definitions> 
>>>>
>>>> ------------------------------------------------------------------------------------- 
>>>>
>>>> ejb-jar.xml
>>>>
>>>> <?xml version="1.0" ?>
>>>> <ejb-jar id="ejb-jar_1" 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>Web Service CiaoWS </description>
>>>>    <display-name>Ciao WS</display-name>
>>>>    <enterprise-beans>
>>>>        <session>
>>>>            <ejb-name>CiaoWSBean</ejb-name>
>>>>            <home>org.eclipse.Ciao.CiaoWSHome</home>
>>>>            <remote>org.eclipse.Ciao.CiaoWS</remote>
>>>>            <ejb-class>org.eclipse.Ciao.CiaoWSBean</ejb-class>
>>>>                <session-type>Stateless</session-type>
>>>>                <transaction-type>Container</transaction-type>
>>>>            </session>
>>>>        </enterprise-beans>
>>>> </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"
>>>> xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1"
>>>> xmlns:pkgen="http://www.openejb.org/xml/ns/pkgen-2.0"
>>>> xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1"
>>>> xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1">
>>>>  <sys:environment>
>>>>    <sys:moduleId>
>>>>      <sys:groupId>default</sys:groupId>
>>>>      <sys:artifactId>CiaoWSBean_artifact_in_openejb</sys:artifactId>
>>>>      <sys:version>1.0</sys:version>
>>>>      <sys:type>car</sys:type>
>>>>    </sys:moduleId>
>>>>    <sys:dependencies>
>>>>    <sys:dependency>
>>>>           <sys:groupId>geronimo</sys:groupId>
>>>>           <sys:artifactId>geronimo-webservices</sys:artifactId>
>>>>           <sys:type>jar</sys:type>
>>>>        </sys:dependency>
>>>>    <sys:dependency>
>>>>           <sys:groupId>geronimo</sys:groupId>
>>>>           <sys:artifactId>geronimo-axis</sys:artifactId>
>>>>           <sys:type>jar</sys:type>
>>>>        </sys:dependency>
>>>>    </sys:dependencies>
>>>>    <sys:hidden-classes/>
>>>>    <sys:non-overridable-classes/>
>>>>  </sys:environment>
>>>>  <enterprise-beans>
>>>>    <session>
>>>>    <ejb-name>CiaoWSBean</ejb-name>
>>>>    <jndi-name>CiaoWSBean</jndi-name>
>>>>    </session>
>>>>  </enterprise-beans>
>>>> </openejb-jar>
>>>>
>>>> --------------------------------------------------------------------------------------- 
>>>>
>>>> webservices.xml
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <webservices 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://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd"
>>>>    xmlns:ger="http://ciaows.org/wsdl"
>>>>    version="1.1">
>>>>    <webservice-description>
>>>>        <webservice-description-name>
>>>>            CiaoWS
>>>>        </webservice-description-name>
>>>>        <wsdl-file>META-INF/CiaoWSService.wsdl</wsdl-file>
>>>>        <jaxrpc-mapping-file>META-INF/mapping.xml</jaxrpc-mapping-file>
>>>>        <port-component>
>>>>            <port-component-name>CiaoWS</port-component-name>
>>>>            <wsdl-port>ger:CiaoWSServicePort</wsdl-port>
>>>>            <service-endpoint-interface>
>>>>                org.eclipse.Ciao.CiaoWSService
>>>>            </service-endpoint-interface>
>>>>            <service-impl-bean>
>>>>                <ejb-link>CiaoWSBean</ejb-link>
>>>>            </service-impl-bean>
>>>>        </port-component>
>>>>    </webservice-description>
>>>> </webservices>
>>>> ------------------------------------------------------------------------------------------ 
>>>>
>>>> mapping.xml generated with jwsdp
>>>>
>>>> <?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.eclipse</package-type>
>>>>    <namespaceURI>http://ciaows.org/types</namespaceURI>
>>>>  </package-mapping>
>>>>  <package-mapping>
>>>>    <package-type>org.eclipse</package-type>
>>>>    <namespaceURI>http://ciaows.org/wsdl</namespaceURI>
>>>>  </package-mapping>
>>>>  <service-interface-mapping>
>>>>    <service-interface>org.eclipse.CiaoWSService</service-interface>
>>>>    <wsdl-service-name
>>>> xmlns:serviceNS="http://ciaows.org/wsdl">serviceNS:CiaoWSService</wsdl-service-name> 
>>>>
>>>>    <port-mapping>
>>>>      <port-name>CiaoWSServicePort</port-name>
>>>>      <java-port-name>CiaoWSServicePort</java-port-name>
>>>>    </port-mapping>
>>>>  </service-interface-mapping>
>>>>  <service-endpoint-interface-mapping>
>>>>
>>>> <service-endpoint-interface>org.eclipse.Ciao.CiaoWSService</service-endpoint-interface> 
>>>>
>>>>    <wsdl-port-type
>>>> xmlns:portTypeNS="http://ciaows.org/wsdl">portTypeNS:CiaoWSService</wsdl-port-type> 
>>>>
>>>>    <wsdl-binding
>>>> xmlns:bindingNS="http://ciaows.org/wsdl">bindingNS:CiaoWSServiceBinding</wsdl-binding> 
>>>>
>>>>    <service-endpoint-method-mapping>
>>>>      <java-method-name>getString</java-method-name>
>>>>      <wsdl-operation>getString</wsdl-operation>
>>>>      <method-param-parts-mapping>
>>>>        <param-position>0</param-position>
>>>>        <param-type>java.lang.String</param-type>
>>>>        <wsdl-message-mapping>
>>>>          <wsdl-message
>>>> xmlns:wsdlMsgNS="http://ciaows.org/wsdl">wsdlMsgNS:CiaoWSService_getString</wsdl-message> 
>>>>
>>>>          <wsdl-message-part-name>String_1</wsdl-message-part-name>
>>>>          <parameter-mode>IN</parameter-mode>
>>>>        </wsdl-message-mapping>
>>>>      </method-param-parts-mapping>
>>>>      <wsdl-return-value-mapping>
>>>>        <method-return-value>java.lang.String</method-return-value>
>>>>        <wsdl-message
>>>> xmlns:wsdlMsgNS="http://ciaows.org/wsdl">wsdlMsgNS:CiaoWSService_getStringResponse</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>
>>>>
>>>> ------------------------------------------------------------------------------------- 
>>>>
>>>> client jsp implementation
>>>>
>>>> <%@ page import="org.eclipse.Ciao.CiaoWSHome,
>>>>    org.eclipse.Ciao.CiaoWS,
>>>>    javax.naming.InitialContext,
>>>>    javax.naming.Context,
>>>>    java.util.*"%>
>>>>
>>>> <html>
>>>> <head>
>>>>    <title>OpenEJB -- EJB for Tomcat</title>
>>>> </head>
>>>>
>>>> <body>
>>>> Stateless Session bean - HelloBean - says:
>>>> <%
>>>>    Context initCtx = new InitialContext();
>>>>
>>>>    Object object = initCtx.lookup("java:comp/env/ejb/CiaoWSBean");
>>>>
>>>>    CiaoWSHome ciaoHome = (CiaoWSHome)
>>>>        javax.rmi.PortableRemoteObject.narrow(object, 
>>>> CiaoWSHome.class);
>>>>    CiaoWS bean = ciaoHome.create();
>>>> %>
>>>> <%= bean.getString("Francesco") %>
>>>> </body>
>>>> </html>
>>>> ---------------------------------------------------------------------
>>>> web.xml
>>>>
>>>> <?xml version="1.0" encoding="ISO-8859-1"?>
>>>>
>>>> <web-app 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">
>>>>
>>>>    <description>
>>>>      JSP 2.0 Examples.
>>>>    </description>
>>>>    <display-name>JSP 2.0 Examples</display-name>
>>>>    <welcome-file-list>
>>>>         <welcome-file>CiaoWSClient.jsp</welcome-file>
>>>>    </welcome-file-list>
>>>> <!--<ejb-ref>
>>>>    <ejb-ref-name>ejb/CiaoWS</ejb-ref-name>
>>>>    <ejb-ref-type>Session</ejb-ref-type>
>>>>    <home>org.eclipse.Ciao.CiaoWSHome</home>
>>>>    <remote>org.eclipse.Ciao.CiaoWS</remote>
>>>>    <ejb-link>CiaoWSBean</ejb-link>
>>>> </ejb-ref>-->
>>>> </web-app>
>>>> --------------------------------------------------------------------------- 
>>>>
>>>> geronimo-web.xml
>>>>
>>>> <web-app 
>>>> xmlns="http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.1">
>>>>    <environment>
>>>>        <moduleId>
>>>>            <groupId>default</groupId>
>>>>            <artifactId>ejbref-war</artifactId>
>>>>            <version>1.0-SNAPSHOT</version>
>>>>            <type>car</type>
>>>>        </moduleId>
>>>> </environment>
>>>> <context-root>/CiaoWSClient</context-root>
>>>> <!--
>>>> <service-ref>
>>>>    <service-ref-name>ejb/CiaowS</service-ref-name>
>>>>    
>>>> <service-interface>org.eclipse.client.CiaoWSClient</service-interface>
>>>>    <wsdl-file>WEB-INF/CiaoWSService.wsdl</wsdl-file>
>>>>    <jaxrpc-mapping-file>WEB-INF/mapping.xml</jaxrpc-mapping-file>
>>>> </service-ref>
>>>> -->
>>>> <service-ref>
>>>>    <service-ref-name>ejb/CiaoWS</service-ref-name>
>>>>    <port>
>>>>        <port-name>CiaoWS</port-name>
>>>>        <uri>http://localhost:8080/CiaoWS</uri>
>>>>    </port>
>>>> </service-ref>
>>>> </web-app>
>>>>
>>>> ------------------------------------------------------------------------------ 
>>>>
>>>>
>>>> I hope in one quick answer. thanks
>>>>
>>>> Francesco
>>>>
>>>> PS. Sorry for my english.
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>>
>>
>
>


Re: Ejb web services and jndi name

Posted by Manu George <ma...@gmail.com>.
Hi Francesco,
               We give the address only in the wsdl like shown below

<service name="HelloService">
    <port name="HelloPort" binding="tns:HelloBinding">
      <soap:address location="http://localhost:8080/TestWS/Hello"/>
    </port>
  </service>

A thing i noticed is that you have not used the <service-endpoint> tag
in your ejb-jar.xml file which is required to identify it as a web
service.

Thanks
Manu

On 11/26/06, Francesco Sessa <fr...@email.it> wrote:
> Hi,
> i have searched for wsdl in mailing list archive, and i have found some
> interesting thread.
> But the wsdl file was generated with wscompile, and i changed only the
> soap address location (the file generated did not contain any address).
> I read the problem releated to the JIRA, but i try with my browser, and
> it don't add the slash.
> I think that the problem is in configuration files of both server and
> client, but i don't understand where.
> As an examples, if i create a ws with servlets, in the geronimo-web or
> other deployment descriptor i can put <context-root> tag;
> but in my case, with ejb, when i deploy the jan on the server, what is
> the tag in the deployment descriptor in which i can specify the address?
> In wsdl? in openejb-jar? in ejb-jar?
> And  the jndi name to lookup the service?
>
> I'm becoming crazy.
>
> Thanks
>
> Manu George ha scritto:
> > Hi Francesco,
> >             Have a look whether your problem related to this JIRA.
> > http://issues.apache.org/jira/browse/GERONIMO-1597
> >
> > Regards
> > Manu
> >
> > On 11/26/06, Francesco Sessa <fr...@email.it> wrote:
> >> Hi All,
> >> I insert the web-service-address in the openejb-jar.xml, like the
> >> following code:
> >>
> >>   <enterprise-beans>
> >>     <session>
> >>         <ejb-name>CiaoWSBean</ejb-name>
> >>         <jndi-name>CiaoWSBean</jndi-name>
> >>         <web-service-address>/ejb/CiaoWS</web-service-address>
> >>     </session>
> >>   </enterprise-beans>
> >>
> >> but the http://localhost:8080/ejb/CiaoWS?WSDL is not available.
> >>
> >> nobody can help me?
> >> Please it's very important.
> >>
> >> Francesco Sessa ha scritto:
> >> > Hi,
> >> > I believed that the service-ref element in the geronimo-web.xml was
> >> > enught.
> >> > I have modified the web.xml but i receive this message:
> >> >
> >> > java.lang.RuntimeException: Could not open stream to wsdl file
> >> >
> >> > I know that it's not clear if the wsdl is accessible to the web
> >> > service client, but whitch it is the solution?
> >> >
> >> >
> >> > Please help me.
> >> > this is the new web.xml
> >> >
> >> >
> >> > <?xml version="1.0" encoding="ISO-8859-1"?>
> >> >
> >> > <web-app 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">
> >> >
> >> > <description>
> >> > JSP 2.0 Examples.
> >> > </description>
> >> > <display-name>JSP 2.0 Examples</display-name>
> >> > <welcome-file-list>
> >> > <welcome-file>CiaoWSClient.jsp</welcome-file>
> >> > </welcome-file-list>
> >> > <service-ref>
> >> > <service-ref-name>CiaoWSService</service-ref-name>
> >> > <service-interface>org.eclipse.Ciao.CiaoWSService</service-interface>
> >> > <wsdl-file>META-INF/CiaoWSService.wsdl</wsdl-file>
> >> > <jaxrpc-mapping-file>META-INF/mapping.xml</jaxrpc-mapping-file>
> >> > </service-ref>
> >> > </web-app>
> >> >
> >> > How to know the url address of the service?
> >> >
> >> > Thanks
> >> >
> >> > David Jencks ha scritto:
> >> >> A couple of obvious problems are that you don't have a service-ref in
> >> >> the web.xml and it's not clear if the wsdl is accessible to the web
> >> >> service client (which IIUC is the web app)
> >> >>
> >> >> thanks
> >> >> david jencks
> >> >>
> >> >> On Nov 24, 2006, at 1:20 PM, Francesco Sessa wrote:
> >> >>
> >> >>> Hi all,
> >> >>> I'm a new user of geronimo.
> >> >>> To complete my bachelor thesis, i need to create simples web
> >> services
> >> >>> with ejb.
> >> >>> I create the Jar file and deploy it on application server, but,
> >> when i
> >> >>> try to connect my client
> >> >>> to my web services, i receive the message that the jndi name isn't
> >> >>> correct.
> >> >>> I think that the error was in the deployment xml of the client,
> >> but i
> >> >>> don't be able to get the wsdl of the service
> >> >>> via browser (i try with the url written in the wsdl, but,
> >> evidently, it
> >> >>> isn't correct).
> >> >>> Please, i must deliver my work monday morning.
> >> >>>
> >> >>> endpoint interface
> >> >>> package org.eclipse.Ciao;
> >> >>>
> >> >>> import java.rmi.RemoteException;
> >> >>> import java.rmi.Remote;
> >> >>>
> >> >>> public interface CiaoWSService extends Remote{
> >> >>>    public String getString(String name) throws RemoteException;
> >> >>> }
> >> >>>
> >> >>> home interface
> >> >>> package org.eclipse.Ciao;
> >> >>>
> >> >>> import java.rmi.RemoteException;
> >> >>> import javax.ejb.*;
> >> >>>
> >> >>> public interface CiaoWSHome extends EJBHome{
> >> >>>    CiaoWS create() throws RemoteException, CreateException;
> >> >>> }
> >> >>>
> >> >>> remote interface
> >> >>> package org.eclipse.Ciao;
> >> >>>
> >> >>> import java.rmi.RemoteException;
> >> >>> import javax.ejb.*;
> >> >>>
> >> >>> public interface CiaoWS extends EJBObject{
> >> >>>
> >> >>>    public String getString(String name) throws RemoteException;
> >> >>> }
> >> >>>
> >> >>> bean implementation
> >> >>> package org.eclipse.Ciao;
> >> >>>
> >> >>> import javax.ejb.*;
> >> >>> import java.rmi.RemoteException;
> >> >>>
> >> >>> public class CiaoWSBean implements SessionBean{
> >> >>>
> >> >>>    public String getString(String name) throws RemoteException{
> >> >>>        return "Ciao " + name;
> >> >>>    }
> >> >>>    public void ejbCreate(){}
> >> >>>    public void ejbRemove(){}
> >> >>>    public void ejbActivate(){}
> >> >>>    public void ejbPassivate(){}
> >> >>>    public void setSessionContext(SessionContext sc){}
> >> >>> }
> >> >>>
> >> >>>
> >> ----------------------------------------------------------------------------------------------
> >>
> >> >>>
> >> >>> wsdl generated with jwsdp
> >> >>>
> >> >>> <?xml version="1.0" encoding="UTF-8"?>
> >> >>>
> >> >>> <definitions name="CiaoWSService"
> >> targetNamespace="urn:geronimo-ciaows"
> >> >>> xmlns:tns="urn:geronimo:ciaows"
> >> >>> 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="CiaoWSService_getString">
> >> >>>    <part name="String_1" type="xsd:string"/></message>
> >> >>>  <message name="CiaoWSService_getStringResponse">
> >> >>>    <part name="result" type="xsd:string"/></message>
> >> >>>  <portType name="CiaoWSService">
> >> >>>    <operation name="getString" parameterOrder="String_1">
> >> >>>      <input message="tns:CiaoWSService_getString"/>
> >> >>>      <output
> >> >>>
> >> message="tns:CiaoWSService_getStringResponse"/></operation></portType>
> >> >>>  <binding name="CiaoWSServiceBinding" type="tns:CiaoWSService">
> >> >>>    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
> >> >>> style="rpc"/>
> >> >>>    <operation name="getString">
> >> >>>      <soap:operation soapAction=""/>
> >> >>>      <input>
> >> >>>        <soap:body
> >> >>> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> >> use="encoded"
> >> >>> namespace="http://ciaows.org/wsdl"/></input>
> >> >>>      <output>
> >> >>>        <soap:body
> >> >>> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> >> use="encoded"
> >> >>> namespace="http://ciaows.org/wsdl"/></output></operation></binding>
> >> >>>  <service name="CiaoWSService">
> >> >>>    <port name="CiaoWSServicePort"
> >> binding="tns:CiaoWSServiceBinding">
> >> >>>      <soap:address
> >> >>>
> >> location="http://127.0.0.1:8080/ejb/CiaoWS"/></port></service></definitions>
> >>
> >> >>>
> >> >>>
> >> -------------------------------------------------------------------------------------
> >>
> >> >>>
> >> >>> ejb-jar.xml
> >> >>>
> >> >>> <?xml version="1.0" ?>
> >> >>> <ejb-jar id="ejb-jar_1" 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>Web Service CiaoWS </description>
> >> >>>    <display-name>Ciao WS</display-name>
> >> >>>    <enterprise-beans>
> >> >>>        <session>
> >> >>>            <ejb-name>CiaoWSBean</ejb-name>
> >> >>>            <home>org.eclipse.Ciao.CiaoWSHome</home>
> >> >>>            <remote>org.eclipse.Ciao.CiaoWS</remote>
> >> >>>            <ejb-class>org.eclipse.Ciao.CiaoWSBean</ejb-class>
> >> >>>                <session-type>Stateless</session-type>
> >> >>>                <transaction-type>Container</transaction-type>
> >> >>>            </session>
> >> >>>        </enterprise-beans>
> >> >>> </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"
> >> >>> xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1"
> >> >>> xmlns:pkgen="http://www.openejb.org/xml/ns/pkgen-2.0"
> >> >>> xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1"
> >> >>> xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1">
> >> >>>  <sys:environment>
> >> >>>    <sys:moduleId>
> >> >>>      <sys:groupId>default</sys:groupId>
> >> >>>      <sys:artifactId>CiaoWSBean_artifact_in_openejb</sys:artifactId>
> >> >>>      <sys:version>1.0</sys:version>
> >> >>>      <sys:type>car</sys:type>
> >> >>>    </sys:moduleId>
> >> >>>    <sys:dependencies>
> >> >>>    <sys:dependency>
> >> >>>           <sys:groupId>geronimo</sys:groupId>
> >> >>>           <sys:artifactId>geronimo-webservices</sys:artifactId>
> >> >>>           <sys:type>jar</sys:type>
> >> >>>        </sys:dependency>
> >> >>>    <sys:dependency>
> >> >>>           <sys:groupId>geronimo</sys:groupId>
> >> >>>           <sys:artifactId>geronimo-axis</sys:artifactId>
> >> >>>           <sys:type>jar</sys:type>
> >> >>>        </sys:dependency>
> >> >>>    </sys:dependencies>
> >> >>>    <sys:hidden-classes/>
> >> >>>    <sys:non-overridable-classes/>
> >> >>>  </sys:environment>
> >> >>>  <enterprise-beans>
> >> >>>    <session>
> >> >>>    <ejb-name>CiaoWSBean</ejb-name>
> >> >>>    <jndi-name>CiaoWSBean</jndi-name>
> >> >>>    </session>
> >> >>>  </enterprise-beans>
> >> >>> </openejb-jar>
> >> >>>
> >> >>>
> >> ---------------------------------------------------------------------------------------
> >>
> >> >>>
> >> >>> webservices.xml
> >> >>>
> >> >>> <?xml version="1.0" encoding="UTF-8"?>
> >> >>> <webservices 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://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd"
> >> >>>    xmlns:ger="http://ciaows.org/wsdl"
> >> >>>    version="1.1">
> >> >>>    <webservice-description>
> >> >>>        <webservice-description-name>
> >> >>>            CiaoWS
> >> >>>        </webservice-description-name>
> >> >>>        <wsdl-file>META-INF/CiaoWSService.wsdl</wsdl-file>
> >> >>>
> >> <jaxrpc-mapping-file>META-INF/mapping.xml</jaxrpc-mapping-file>
> >> >>>        <port-component>
> >> >>>            <port-component-name>CiaoWS</port-component-name>
> >> >>>            <wsdl-port>ger:CiaoWSServicePort</wsdl-port>
> >> >>>            <service-endpoint-interface>
> >> >>>                org.eclipse.Ciao.CiaoWSService
> >> >>>            </service-endpoint-interface>
> >> >>>            <service-impl-bean>
> >> >>>                <ejb-link>CiaoWSBean</ejb-link>
> >> >>>            </service-impl-bean>
> >> >>>        </port-component>
> >> >>>    </webservice-description>
> >> >>> </webservices>
> >> >>>
> >> ------------------------------------------------------------------------------------------
> >>
> >> >>>
> >> >>> mapping.xml generated with jwsdp
> >> >>>
> >> >>> <?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.eclipse</package-type>
> >> >>>    <namespaceURI>http://ciaows.org/types</namespaceURI>
> >> >>>  </package-mapping>
> >> >>>  <package-mapping>
> >> >>>    <package-type>org.eclipse</package-type>
> >> >>>    <namespaceURI>http://ciaows.org/wsdl</namespaceURI>
> >> >>>  </package-mapping>
> >> >>>  <service-interface-mapping>
> >> >>>    <service-interface>org.eclipse.CiaoWSService</service-interface>
> >> >>>    <wsdl-service-name
> >> >>>
> >> xmlns:serviceNS="http://ciaows.org/wsdl">serviceNS:CiaoWSService</wsdl-service-name>
> >>
> >> >>>
> >> >>>    <port-mapping>
> >> >>>      <port-name>CiaoWSServicePort</port-name>
> >> >>>      <java-port-name>CiaoWSServicePort</java-port-name>
> >> >>>    </port-mapping>
> >> >>>  </service-interface-mapping>
> >> >>>  <service-endpoint-interface-mapping>
> >> >>>
> >> >>>
> >> <service-endpoint-interface>org.eclipse.Ciao.CiaoWSService</service-endpoint-interface>
> >>
> >> >>>
> >> >>>    <wsdl-port-type
> >> >>>
> >> xmlns:portTypeNS="http://ciaows.org/wsdl">portTypeNS:CiaoWSService</wsdl-port-type>
> >>
> >> >>>
> >> >>>    <wsdl-binding
> >> >>>
> >> xmlns:bindingNS="http://ciaows.org/wsdl">bindingNS:CiaoWSServiceBinding</wsdl-binding>
> >>
> >> >>>
> >> >>>    <service-endpoint-method-mapping>
> >> >>>      <java-method-name>getString</java-method-name>
> >> >>>      <wsdl-operation>getString</wsdl-operation>
> >> >>>      <method-param-parts-mapping>
> >> >>>        <param-position>0</param-position>
> >> >>>        <param-type>java.lang.String</param-type>
> >> >>>        <wsdl-message-mapping>
> >> >>>          <wsdl-message
> >> >>>
> >> xmlns:wsdlMsgNS="http://ciaows.org/wsdl">wsdlMsgNS:CiaoWSService_getString</wsdl-message>
> >>
> >> >>>
> >> >>>          <wsdl-message-part-name>String_1</wsdl-message-part-name>
> >> >>>          <parameter-mode>IN</parameter-mode>
> >> >>>        </wsdl-message-mapping>
> >> >>>      </method-param-parts-mapping>
> >> >>>      <wsdl-return-value-mapping>
> >> >>>        <method-return-value>java.lang.String</method-return-value>
> >> >>>        <wsdl-message
> >> >>>
> >> xmlns:wsdlMsgNS="http://ciaows.org/wsdl">wsdlMsgNS:CiaoWSService_getStringResponse</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>
> >> >>>
> >> >>>
> >> -------------------------------------------------------------------------------------
> >>
> >> >>>
> >> >>> client jsp implementation
> >> >>>
> >> >>> <%@ page import="org.eclipse.Ciao.CiaoWSHome,
> >> >>>    org.eclipse.Ciao.CiaoWS,
> >> >>>    javax.naming.InitialContext,
> >> >>>    javax.naming.Context,
> >> >>>    java.util.*"%>
> >> >>>
> >> >>> <html>
> >> >>> <head>
> >> >>>    <title>OpenEJB -- EJB for Tomcat</title>
> >> >>> </head>
> >> >>>
> >> >>> <body>
> >> >>> Stateless Session bean - HelloBean - says:
> >> >>> <%
> >> >>>    Context initCtx = new InitialContext();
> >> >>>
> >> >>>    Object object = initCtx.lookup("java:comp/env/ejb/CiaoWSBean");
> >> >>>
> >> >>>    CiaoWSHome ciaoHome = (CiaoWSHome)
> >> >>>        javax.rmi.PortableRemoteObject.narrow(object,
> >> CiaoWSHome.class);
> >> >>>    CiaoWS bean = ciaoHome.create();
> >> >>> %>
> >> >>> <%= bean.getString("Francesco") %>
> >> >>> </body>
> >> >>> </html>
> >> >>>
> >> ---------------------------------------------------------------------
> >> >>> web.xml
> >> >>>
> >> >>> <?xml version="1.0" encoding="ISO-8859-1"?>
> >> >>>
> >> >>> <web-app 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">
> >> >>>
> >> >>>    <description>
> >> >>>      JSP 2.0 Examples.
> >> >>>    </description>
> >> >>>    <display-name>JSP 2.0 Examples</display-name>
> >> >>>    <welcome-file-list>
> >> >>>         <welcome-file>CiaoWSClient.jsp</welcome-file>
> >> >>>    </welcome-file-list>
> >> >>> <!--<ejb-ref>
> >> >>>    <ejb-ref-name>ejb/CiaoWS</ejb-ref-name>
> >> >>>    <ejb-ref-type>Session</ejb-ref-type>
> >> >>>    <home>org.eclipse.Ciao.CiaoWSHome</home>
> >> >>>    <remote>org.eclipse.Ciao.CiaoWS</remote>
> >> >>>    <ejb-link>CiaoWSBean</ejb-link>
> >> >>> </ejb-ref>-->
> >> >>> </web-app>
> >> >>>
> >> ---------------------------------------------------------------------------
> >>
> >> >>>
> >> >>> geronimo-web.xml
> >> >>>
> >> >>> <web-app
> >> xmlns="http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.1">
> >> >>>    <environment>
> >> >>>        <moduleId>
> >> >>>            <groupId>default</groupId>
> >> >>>            <artifactId>ejbref-war</artifactId>
> >> >>>            <version>1.0-SNAPSHOT</version>
> >> >>>            <type>car</type>
> >> >>>        </moduleId>
> >> >>> </environment>
> >> >>> <context-root>/CiaoWSClient</context-root>
> >> >>> <!--
> >> >>> <service-ref>
> >> >>>    <service-ref-name>ejb/CiaowS</service-ref-name>
> >> >>>
> >> >>>
> >> <service-interface>org.eclipse.client.CiaoWSClient</service-interface>
> >> >>>    <wsdl-file>WEB-INF/CiaoWSService.wsdl</wsdl-file>
> >> >>>    <jaxrpc-mapping-file>WEB-INF/mapping.xml</jaxrpc-mapping-file>
> >> >>> </service-ref>
> >> >>> -->
> >> >>> <service-ref>
> >> >>>    <service-ref-name>ejb/CiaoWS</service-ref-name>
> >> >>>    <port>
> >> >>>        <port-name>CiaoWS</port-name>
> >> >>>        <uri>http://localhost:8080/CiaoWS</uri>
> >> >>>    </port>
> >> >>> </service-ref>
> >> >>> </web-app>
> >> >>>
> >> >>>
> >> ------------------------------------------------------------------------------
> >>
> >> >>>
> >> >>>
> >> >>> I hope in one quick answer. thanks
> >> >>>
> >> >>> Francesco
> >> >>>
> >> >>> PS. Sorry for my english.
> >> >>>
> >> >>>
> >> >>
> >> >>
> >> >>
> >> >
> >> >
> >> >
> >> >
> >>
> >>
> >>
> >
> >
>
>
>

Re: Ejb web services and jndi name

Posted by Francesco Sessa <fr...@email.it>.
Hi,
i have searched for wsdl in mailing list archive, and i have found some 
interesting thread.
But the wsdl file was generated with wscompile, and i changed only the 
soap address location (the file generated did not contain any address).
I read the problem releated to the JIRA, but i try with my browser, and 
it don't add the slash.
I think that the problem is in configuration files of both server and 
client, but i don't understand where.
As an examples, if i create a ws with servlets, in the geronimo-web or 
other deployment descriptor i can put <context-root> tag;
but in my case, with ejb, when i deploy the jan on the server, what is 
the tag in the deployment descriptor in which i can specify the address?
In wsdl? in openejb-jar? in ejb-jar?
And  the jndi name to lookup the service?

I'm becoming crazy.

Thanks

Manu George ha scritto:
> Hi Francesco,
>             Have a look whether your problem related to this JIRA.
> http://issues.apache.org/jira/browse/GERONIMO-1597
>
> Regards
> Manu
>
> On 11/26/06, Francesco Sessa <fr...@email.it> wrote:
>> Hi All,
>> I insert the web-service-address in the openejb-jar.xml, like the
>> following code:
>>
>>   <enterprise-beans>
>>     <session>
>>         <ejb-name>CiaoWSBean</ejb-name>
>>         <jndi-name>CiaoWSBean</jndi-name>
>>         <web-service-address>/ejb/CiaoWS</web-service-address>
>>     </session>
>>   </enterprise-beans>
>>
>> but the http://localhost:8080/ejb/CiaoWS?WSDL is not available.
>>
>> nobody can help me?
>> Please it's very important.
>>
>> Francesco Sessa ha scritto:
>> > Hi,
>> > I believed that the service-ref element in the geronimo-web.xml was
>> > enught.
>> > I have modified the web.xml but i receive this message:
>> >
>> > java.lang.RuntimeException: Could not open stream to wsdl file
>> >
>> > I know that it's not clear if the wsdl is accessible to the web
>> > service client, but whitch it is the solution?
>> >
>> >
>> > Please help me.
>> > this is the new web.xml
>> >
>> >
>> > <?xml version="1.0" encoding="ISO-8859-1"?>
>> >
>> > <web-app 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">
>> >
>> > <description>
>> > JSP 2.0 Examples.
>> > </description>
>> > <display-name>JSP 2.0 Examples</display-name>
>> > <welcome-file-list>
>> > <welcome-file>CiaoWSClient.jsp</welcome-file>
>> > </welcome-file-list>
>> > <service-ref>
>> > <service-ref-name>CiaoWSService</service-ref-name>
>> > <service-interface>org.eclipse.Ciao.CiaoWSService</service-interface>
>> > <wsdl-file>META-INF/CiaoWSService.wsdl</wsdl-file>
>> > <jaxrpc-mapping-file>META-INF/mapping.xml</jaxrpc-mapping-file>
>> > </service-ref>
>> > </web-app>
>> >
>> > How to know the url address of the service?
>> >
>> > Thanks
>> >
>> > David Jencks ha scritto:
>> >> A couple of obvious problems are that you don't have a service-ref in
>> >> the web.xml and it's not clear if the wsdl is accessible to the web
>> >> service client (which IIUC is the web app)
>> >>
>> >> thanks
>> >> david jencks
>> >>
>> >> On Nov 24, 2006, at 1:20 PM, Francesco Sessa wrote:
>> >>
>> >>> Hi all,
>> >>> I'm a new user of geronimo.
>> >>> To complete my bachelor thesis, i need to create simples web 
>> services
>> >>> with ejb.
>> >>> I create the Jar file and deploy it on application server, but, 
>> when i
>> >>> try to connect my client
>> >>> to my web services, i receive the message that the jndi name isn't
>> >>> correct.
>> >>> I think that the error was in the deployment xml of the client, 
>> but i
>> >>> don't be able to get the wsdl of the service
>> >>> via browser (i try with the url written in the wsdl, but, 
>> evidently, it
>> >>> isn't correct).
>> >>> Please, i must deliver my work monday morning.
>> >>>
>> >>> endpoint interface
>> >>> package org.eclipse.Ciao;
>> >>>
>> >>> import java.rmi.RemoteException;
>> >>> import java.rmi.Remote;
>> >>>
>> >>> public interface CiaoWSService extends Remote{
>> >>>    public String getString(String name) throws RemoteException;
>> >>> }
>> >>>
>> >>> home interface
>> >>> package org.eclipse.Ciao;
>> >>>
>> >>> import java.rmi.RemoteException;
>> >>> import javax.ejb.*;
>> >>>
>> >>> public interface CiaoWSHome extends EJBHome{
>> >>>    CiaoWS create() throws RemoteException, CreateException;
>> >>> }
>> >>>
>> >>> remote interface
>> >>> package org.eclipse.Ciao;
>> >>>
>> >>> import java.rmi.RemoteException;
>> >>> import javax.ejb.*;
>> >>>
>> >>> public interface CiaoWS extends EJBObject{
>> >>>
>> >>>    public String getString(String name) throws RemoteException;
>> >>> }
>> >>>
>> >>> bean implementation
>> >>> package org.eclipse.Ciao;
>> >>>
>> >>> import javax.ejb.*;
>> >>> import java.rmi.RemoteException;
>> >>>
>> >>> public class CiaoWSBean implements SessionBean{
>> >>>
>> >>>    public String getString(String name) throws RemoteException{
>> >>>        return "Ciao " + name;
>> >>>    }
>> >>>    public void ejbCreate(){}
>> >>>    public void ejbRemove(){}
>> >>>    public void ejbActivate(){}
>> >>>    public void ejbPassivate(){}
>> >>>    public void setSessionContext(SessionContext sc){}
>> >>> }
>> >>>
>> >>> 
>> ---------------------------------------------------------------------------------------------- 
>>
>> >>>
>> >>> wsdl generated with jwsdp
>> >>>
>> >>> <?xml version="1.0" encoding="UTF-8"?>
>> >>>
>> >>> <definitions name="CiaoWSService" 
>> targetNamespace="urn:geronimo-ciaows"
>> >>> xmlns:tns="urn:geronimo:ciaows"
>> >>> 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="CiaoWSService_getString">
>> >>>    <part name="String_1" type="xsd:string"/></message>
>> >>>  <message name="CiaoWSService_getStringResponse">
>> >>>    <part name="result" type="xsd:string"/></message>
>> >>>  <portType name="CiaoWSService">
>> >>>    <operation name="getString" parameterOrder="String_1">
>> >>>      <input message="tns:CiaoWSService_getString"/>
>> >>>      <output
>> >>> 
>> message="tns:CiaoWSService_getStringResponse"/></operation></portType>
>> >>>  <binding name="CiaoWSServiceBinding" type="tns:CiaoWSService">
>> >>>    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
>> >>> style="rpc"/>
>> >>>    <operation name="getString">
>> >>>      <soap:operation soapAction=""/>
>> >>>      <input>
>> >>>        <soap:body
>> >>> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
>> use="encoded"
>> >>> namespace="http://ciaows.org/wsdl"/></input>
>> >>>      <output>
>> >>>        <soap:body
>> >>> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
>> use="encoded"
>> >>> namespace="http://ciaows.org/wsdl"/></output></operation></binding>
>> >>>  <service name="CiaoWSService">
>> >>>    <port name="CiaoWSServicePort" 
>> binding="tns:CiaoWSServiceBinding">
>> >>>      <soap:address
>> >>> 
>> location="http://127.0.0.1:8080/ejb/CiaoWS"/></port></service></definitions> 
>>
>> >>>
>> >>> 
>> ------------------------------------------------------------------------------------- 
>>
>> >>>
>> >>> ejb-jar.xml
>> >>>
>> >>> <?xml version="1.0" ?>
>> >>> <ejb-jar id="ejb-jar_1" 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>Web Service CiaoWS </description>
>> >>>    <display-name>Ciao WS</display-name>
>> >>>    <enterprise-beans>
>> >>>        <session>
>> >>>            <ejb-name>CiaoWSBean</ejb-name>
>> >>>            <home>org.eclipse.Ciao.CiaoWSHome</home>
>> >>>            <remote>org.eclipse.Ciao.CiaoWS</remote>
>> >>>            <ejb-class>org.eclipse.Ciao.CiaoWSBean</ejb-class>
>> >>>                <session-type>Stateless</session-type>
>> >>>                <transaction-type>Container</transaction-type>
>> >>>            </session>
>> >>>        </enterprise-beans>
>> >>> </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"
>> >>> xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1"
>> >>> xmlns:pkgen="http://www.openejb.org/xml/ns/pkgen-2.0"
>> >>> xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1"
>> >>> xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1">
>> >>>  <sys:environment>
>> >>>    <sys:moduleId>
>> >>>      <sys:groupId>default</sys:groupId>
>> >>>      <sys:artifactId>CiaoWSBean_artifact_in_openejb</sys:artifactId>
>> >>>      <sys:version>1.0</sys:version>
>> >>>      <sys:type>car</sys:type>
>> >>>    </sys:moduleId>
>> >>>    <sys:dependencies>
>> >>>    <sys:dependency>
>> >>>           <sys:groupId>geronimo</sys:groupId>
>> >>>           <sys:artifactId>geronimo-webservices</sys:artifactId>
>> >>>           <sys:type>jar</sys:type>
>> >>>        </sys:dependency>
>> >>>    <sys:dependency>
>> >>>           <sys:groupId>geronimo</sys:groupId>
>> >>>           <sys:artifactId>geronimo-axis</sys:artifactId>
>> >>>           <sys:type>jar</sys:type>
>> >>>        </sys:dependency>
>> >>>    </sys:dependencies>
>> >>>    <sys:hidden-classes/>
>> >>>    <sys:non-overridable-classes/>
>> >>>  </sys:environment>
>> >>>  <enterprise-beans>
>> >>>    <session>
>> >>>    <ejb-name>CiaoWSBean</ejb-name>
>> >>>    <jndi-name>CiaoWSBean</jndi-name>
>> >>>    </session>
>> >>>  </enterprise-beans>
>> >>> </openejb-jar>
>> >>>
>> >>> 
>> --------------------------------------------------------------------------------------- 
>>
>> >>>
>> >>> webservices.xml
>> >>>
>> >>> <?xml version="1.0" encoding="UTF-8"?>
>> >>> <webservices 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://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd"
>> >>>    xmlns:ger="http://ciaows.org/wsdl"
>> >>>    version="1.1">
>> >>>    <webservice-description>
>> >>>        <webservice-description-name>
>> >>>            CiaoWS
>> >>>        </webservice-description-name>
>> >>>        <wsdl-file>META-INF/CiaoWSService.wsdl</wsdl-file>
>> >>>        
>> <jaxrpc-mapping-file>META-INF/mapping.xml</jaxrpc-mapping-file>
>> >>>        <port-component>
>> >>>            <port-component-name>CiaoWS</port-component-name>
>> >>>            <wsdl-port>ger:CiaoWSServicePort</wsdl-port>
>> >>>            <service-endpoint-interface>
>> >>>                org.eclipse.Ciao.CiaoWSService
>> >>>            </service-endpoint-interface>
>> >>>            <service-impl-bean>
>> >>>                <ejb-link>CiaoWSBean</ejb-link>
>> >>>            </service-impl-bean>
>> >>>        </port-component>
>> >>>    </webservice-description>
>> >>> </webservices>
>> >>> 
>> ------------------------------------------------------------------------------------------ 
>>
>> >>>
>> >>> mapping.xml generated with jwsdp
>> >>>
>> >>> <?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.eclipse</package-type>
>> >>>    <namespaceURI>http://ciaows.org/types</namespaceURI>
>> >>>  </package-mapping>
>> >>>  <package-mapping>
>> >>>    <package-type>org.eclipse</package-type>
>> >>>    <namespaceURI>http://ciaows.org/wsdl</namespaceURI>
>> >>>  </package-mapping>
>> >>>  <service-interface-mapping>
>> >>>    <service-interface>org.eclipse.CiaoWSService</service-interface>
>> >>>    <wsdl-service-name
>> >>> 
>> xmlns:serviceNS="http://ciaows.org/wsdl">serviceNS:CiaoWSService</wsdl-service-name> 
>>
>> >>>
>> >>>    <port-mapping>
>> >>>      <port-name>CiaoWSServicePort</port-name>
>> >>>      <java-port-name>CiaoWSServicePort</java-port-name>
>> >>>    </port-mapping>
>> >>>  </service-interface-mapping>
>> >>>  <service-endpoint-interface-mapping>
>> >>>
>> >>> 
>> <service-endpoint-interface>org.eclipse.Ciao.CiaoWSService</service-endpoint-interface> 
>>
>> >>>
>> >>>    <wsdl-port-type
>> >>> 
>> xmlns:portTypeNS="http://ciaows.org/wsdl">portTypeNS:CiaoWSService</wsdl-port-type> 
>>
>> >>>
>> >>>    <wsdl-binding
>> >>> 
>> xmlns:bindingNS="http://ciaows.org/wsdl">bindingNS:CiaoWSServiceBinding</wsdl-binding> 
>>
>> >>>
>> >>>    <service-endpoint-method-mapping>
>> >>>      <java-method-name>getString</java-method-name>
>> >>>      <wsdl-operation>getString</wsdl-operation>
>> >>>      <method-param-parts-mapping>
>> >>>        <param-position>0</param-position>
>> >>>        <param-type>java.lang.String</param-type>
>> >>>        <wsdl-message-mapping>
>> >>>          <wsdl-message
>> >>> 
>> xmlns:wsdlMsgNS="http://ciaows.org/wsdl">wsdlMsgNS:CiaoWSService_getString</wsdl-message> 
>>
>> >>>
>> >>>          <wsdl-message-part-name>String_1</wsdl-message-part-name>
>> >>>          <parameter-mode>IN</parameter-mode>
>> >>>        </wsdl-message-mapping>
>> >>>      </method-param-parts-mapping>
>> >>>      <wsdl-return-value-mapping>
>> >>>        <method-return-value>java.lang.String</method-return-value>
>> >>>        <wsdl-message
>> >>> 
>> xmlns:wsdlMsgNS="http://ciaows.org/wsdl">wsdlMsgNS:CiaoWSService_getStringResponse</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>
>> >>>
>> >>> 
>> ------------------------------------------------------------------------------------- 
>>
>> >>>
>> >>> client jsp implementation
>> >>>
>> >>> <%@ page import="org.eclipse.Ciao.CiaoWSHome,
>> >>>    org.eclipse.Ciao.CiaoWS,
>> >>>    javax.naming.InitialContext,
>> >>>    javax.naming.Context,
>> >>>    java.util.*"%>
>> >>>
>> >>> <html>
>> >>> <head>
>> >>>    <title>OpenEJB -- EJB for Tomcat</title>
>> >>> </head>
>> >>>
>> >>> <body>
>> >>> Stateless Session bean - HelloBean - says:
>> >>> <%
>> >>>    Context initCtx = new InitialContext();
>> >>>
>> >>>    Object object = initCtx.lookup("java:comp/env/ejb/CiaoWSBean");
>> >>>
>> >>>    CiaoWSHome ciaoHome = (CiaoWSHome)
>> >>>        javax.rmi.PortableRemoteObject.narrow(object, 
>> CiaoWSHome.class);
>> >>>    CiaoWS bean = ciaoHome.create();
>> >>> %>
>> >>> <%= bean.getString("Francesco") %>
>> >>> </body>
>> >>> </html>
>> >>> 
>> ---------------------------------------------------------------------
>> >>> web.xml
>> >>>
>> >>> <?xml version="1.0" encoding="ISO-8859-1"?>
>> >>>
>> >>> <web-app 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">
>> >>>
>> >>>    <description>
>> >>>      JSP 2.0 Examples.
>> >>>    </description>
>> >>>    <display-name>JSP 2.0 Examples</display-name>
>> >>>    <welcome-file-list>
>> >>>         <welcome-file>CiaoWSClient.jsp</welcome-file>
>> >>>    </welcome-file-list>
>> >>> <!--<ejb-ref>
>> >>>    <ejb-ref-name>ejb/CiaoWS</ejb-ref-name>
>> >>>    <ejb-ref-type>Session</ejb-ref-type>
>> >>>    <home>org.eclipse.Ciao.CiaoWSHome</home>
>> >>>    <remote>org.eclipse.Ciao.CiaoWS</remote>
>> >>>    <ejb-link>CiaoWSBean</ejb-link>
>> >>> </ejb-ref>-->
>> >>> </web-app>
>> >>> 
>> --------------------------------------------------------------------------- 
>>
>> >>>
>> >>> geronimo-web.xml
>> >>>
>> >>> <web-app 
>> xmlns="http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.1">
>> >>>    <environment>
>> >>>        <moduleId>
>> >>>            <groupId>default</groupId>
>> >>>            <artifactId>ejbref-war</artifactId>
>> >>>            <version>1.0-SNAPSHOT</version>
>> >>>            <type>car</type>
>> >>>        </moduleId>
>> >>> </environment>
>> >>> <context-root>/CiaoWSClient</context-root>
>> >>> <!--
>> >>> <service-ref>
>> >>>    <service-ref-name>ejb/CiaowS</service-ref-name>
>> >>>
>> >>> 
>> <service-interface>org.eclipse.client.CiaoWSClient</service-interface>
>> >>>    <wsdl-file>WEB-INF/CiaoWSService.wsdl</wsdl-file>
>> >>>    <jaxrpc-mapping-file>WEB-INF/mapping.xml</jaxrpc-mapping-file>
>> >>> </service-ref>
>> >>> -->
>> >>> <service-ref>
>> >>>    <service-ref-name>ejb/CiaoWS</service-ref-name>
>> >>>    <port>
>> >>>        <port-name>CiaoWS</port-name>
>> >>>        <uri>http://localhost:8080/CiaoWS</uri>
>> >>>    </port>
>> >>> </service-ref>
>> >>> </web-app>
>> >>>
>> >>> 
>> ------------------------------------------------------------------------------ 
>>
>> >>>
>> >>>
>> >>> I hope in one quick answer. thanks
>> >>>
>> >>> Francesco
>> >>>
>> >>> PS. Sorry for my english.
>> >>>
>> >>>
>> >>
>> >>
>> >>
>> >
>> >
>> >
>> >
>>
>>
>>
>
>



Re: Ejb web services and jndi name

Posted by Manu George <ma...@gmail.com>.
Hi Francesco,
             Have a look whether your problem related to this JIRA.
http://issues.apache.org/jira/browse/GERONIMO-1597

Regards
Manu

On 11/26/06, Francesco Sessa <fr...@email.it> wrote:
> Hi All,
> I insert the web-service-address in the openejb-jar.xml, like the
> following code:
>
>   <enterprise-beans>
>     <session>
>         <ejb-name>CiaoWSBean</ejb-name>
>         <jndi-name>CiaoWSBean</jndi-name>
>         <web-service-address>/ejb/CiaoWS</web-service-address>
>     </session>
>   </enterprise-beans>
>
> but the http://localhost:8080/ejb/CiaoWS?WSDL is not available.
>
> nobody can help me?
> Please it's very important.
>
> Francesco Sessa ha scritto:
> > Hi,
> > I believed that the service-ref element in the geronimo-web.xml was
> > enught.
> > I have modified the web.xml but i receive this message:
> >
> > java.lang.RuntimeException: Could not open stream to wsdl file
> >
> > I know that it's not clear if the wsdl is accessible to the web
> > service client, but whitch it is the solution?
> >
> >
> > Please help me.
> > this is the new web.xml
> >
> >
> > <?xml version="1.0" encoding="ISO-8859-1"?>
> >
> > <web-app 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">
> >
> > <description>
> > JSP 2.0 Examples.
> > </description>
> > <display-name>JSP 2.0 Examples</display-name>
> > <welcome-file-list>
> > <welcome-file>CiaoWSClient.jsp</welcome-file>
> > </welcome-file-list>
> > <service-ref>
> > <service-ref-name>CiaoWSService</service-ref-name>
> > <service-interface>org.eclipse.Ciao.CiaoWSService</service-interface>
> > <wsdl-file>META-INF/CiaoWSService.wsdl</wsdl-file>
> > <jaxrpc-mapping-file>META-INF/mapping.xml</jaxrpc-mapping-file>
> > </service-ref>
> > </web-app>
> >
> > How to know the url address of the service?
> >
> > Thanks
> >
> > David Jencks ha scritto:
> >> A couple of obvious problems are that you don't have a service-ref in
> >> the web.xml and it's not clear if the wsdl is accessible to the web
> >> service client (which IIUC is the web app)
> >>
> >> thanks
> >> david jencks
> >>
> >> On Nov 24, 2006, at 1:20 PM, Francesco Sessa wrote:
> >>
> >>> Hi all,
> >>> I'm a new user of geronimo.
> >>> To complete my bachelor thesis, i need to create simples web services
> >>> with ejb.
> >>> I create the Jar file and deploy it on application server, but, when i
> >>> try to connect my client
> >>> to my web services, i receive the message that the jndi name isn't
> >>> correct.
> >>> I think that the error was in the deployment xml of the client, but i
> >>> don't be able to get the wsdl of the service
> >>> via browser (i try with the url written in the wsdl, but, evidently, it
> >>> isn't correct).
> >>> Please, i must deliver my work monday morning.
> >>>
> >>> endpoint interface
> >>> package org.eclipse.Ciao;
> >>>
> >>> import java.rmi.RemoteException;
> >>> import java.rmi.Remote;
> >>>
> >>> public interface CiaoWSService extends Remote{
> >>>    public String getString(String name) throws RemoteException;
> >>> }
> >>>
> >>> home interface
> >>> package org.eclipse.Ciao;
> >>>
> >>> import java.rmi.RemoteException;
> >>> import javax.ejb.*;
> >>>
> >>> public interface CiaoWSHome extends EJBHome{
> >>>    CiaoWS create() throws RemoteException, CreateException;
> >>> }
> >>>
> >>> remote interface
> >>> package org.eclipse.Ciao;
> >>>
> >>> import java.rmi.RemoteException;
> >>> import javax.ejb.*;
> >>>
> >>> public interface CiaoWS extends EJBObject{
> >>>
> >>>    public String getString(String name) throws RemoteException;
> >>> }
> >>>
> >>> bean implementation
> >>> package org.eclipse.Ciao;
> >>>
> >>> import javax.ejb.*;
> >>> import java.rmi.RemoteException;
> >>>
> >>> public class CiaoWSBean implements SessionBean{
> >>>
> >>>    public String getString(String name) throws RemoteException{
> >>>        return "Ciao " + name;
> >>>    }
> >>>    public void ejbCreate(){}
> >>>    public void ejbRemove(){}
> >>>    public void ejbActivate(){}
> >>>    public void ejbPassivate(){}
> >>>    public void setSessionContext(SessionContext sc){}
> >>> }
> >>>
> >>> ----------------------------------------------------------------------------------------------
> >>>
> >>> wsdl generated with jwsdp
> >>>
> >>> <?xml version="1.0" encoding="UTF-8"?>
> >>>
> >>> <definitions name="CiaoWSService" targetNamespace="urn:geronimo-ciaows"
> >>> xmlns:tns="urn:geronimo:ciaows"
> >>> 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="CiaoWSService_getString">
> >>>    <part name="String_1" type="xsd:string"/></message>
> >>>  <message name="CiaoWSService_getStringResponse">
> >>>    <part name="result" type="xsd:string"/></message>
> >>>  <portType name="CiaoWSService">
> >>>    <operation name="getString" parameterOrder="String_1">
> >>>      <input message="tns:CiaoWSService_getString"/>
> >>>      <output
> >>> message="tns:CiaoWSService_getStringResponse"/></operation></portType>
> >>>  <binding name="CiaoWSServiceBinding" type="tns:CiaoWSService">
> >>>    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
> >>> style="rpc"/>
> >>>    <operation name="getString">
> >>>      <soap:operation soapAction=""/>
> >>>      <input>
> >>>        <soap:body
> >>> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded"
> >>> namespace="http://ciaows.org/wsdl"/></input>
> >>>      <output>
> >>>        <soap:body
> >>> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded"
> >>> namespace="http://ciaows.org/wsdl"/></output></operation></binding>
> >>>  <service name="CiaoWSService">
> >>>    <port name="CiaoWSServicePort" binding="tns:CiaoWSServiceBinding">
> >>>      <soap:address
> >>> location="http://127.0.0.1:8080/ejb/CiaoWS"/></port></service></definitions>
> >>>
> >>> -------------------------------------------------------------------------------------
> >>>
> >>> ejb-jar.xml
> >>>
> >>> <?xml version="1.0" ?>
> >>> <ejb-jar id="ejb-jar_1" 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>Web Service CiaoWS </description>
> >>>    <display-name>Ciao WS</display-name>
> >>>    <enterprise-beans>
> >>>        <session>
> >>>            <ejb-name>CiaoWSBean</ejb-name>
> >>>            <home>org.eclipse.Ciao.CiaoWSHome</home>
> >>>            <remote>org.eclipse.Ciao.CiaoWS</remote>
> >>>            <ejb-class>org.eclipse.Ciao.CiaoWSBean</ejb-class>
> >>>                <session-type>Stateless</session-type>
> >>>                <transaction-type>Container</transaction-type>
> >>>            </session>
> >>>        </enterprise-beans>
> >>> </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"
> >>> xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1"
> >>> xmlns:pkgen="http://www.openejb.org/xml/ns/pkgen-2.0"
> >>> xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1"
> >>> xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1">
> >>>  <sys:environment>
> >>>    <sys:moduleId>
> >>>      <sys:groupId>default</sys:groupId>
> >>>      <sys:artifactId>CiaoWSBean_artifact_in_openejb</sys:artifactId>
> >>>      <sys:version>1.0</sys:version>
> >>>      <sys:type>car</sys:type>
> >>>    </sys:moduleId>
> >>>    <sys:dependencies>
> >>>    <sys:dependency>
> >>>           <sys:groupId>geronimo</sys:groupId>
> >>>           <sys:artifactId>geronimo-webservices</sys:artifactId>
> >>>           <sys:type>jar</sys:type>
> >>>        </sys:dependency>
> >>>    <sys:dependency>
> >>>           <sys:groupId>geronimo</sys:groupId>
> >>>           <sys:artifactId>geronimo-axis</sys:artifactId>
> >>>           <sys:type>jar</sys:type>
> >>>        </sys:dependency>
> >>>    </sys:dependencies>
> >>>    <sys:hidden-classes/>
> >>>    <sys:non-overridable-classes/>
> >>>  </sys:environment>
> >>>  <enterprise-beans>
> >>>    <session>
> >>>    <ejb-name>CiaoWSBean</ejb-name>
> >>>    <jndi-name>CiaoWSBean</jndi-name>
> >>>    </session>
> >>>  </enterprise-beans>
> >>> </openejb-jar>
> >>>
> >>> ---------------------------------------------------------------------------------------
> >>>
> >>> webservices.xml
> >>>
> >>> <?xml version="1.0" encoding="UTF-8"?>
> >>> <webservices 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://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd"
> >>>    xmlns:ger="http://ciaows.org/wsdl"
> >>>    version="1.1">
> >>>    <webservice-description>
> >>>        <webservice-description-name>
> >>>            CiaoWS
> >>>        </webservice-description-name>
> >>>        <wsdl-file>META-INF/CiaoWSService.wsdl</wsdl-file>
> >>>        <jaxrpc-mapping-file>META-INF/mapping.xml</jaxrpc-mapping-file>
> >>>        <port-component>
> >>>            <port-component-name>CiaoWS</port-component-name>
> >>>            <wsdl-port>ger:CiaoWSServicePort</wsdl-port>
> >>>            <service-endpoint-interface>
> >>>                org.eclipse.Ciao.CiaoWSService
> >>>            </service-endpoint-interface>
> >>>            <service-impl-bean>
> >>>                <ejb-link>CiaoWSBean</ejb-link>
> >>>            </service-impl-bean>
> >>>        </port-component>
> >>>    </webservice-description>
> >>> </webservices>
> >>> ------------------------------------------------------------------------------------------
> >>>
> >>> mapping.xml generated with jwsdp
> >>>
> >>> <?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.eclipse</package-type>
> >>>    <namespaceURI>http://ciaows.org/types</namespaceURI>
> >>>  </package-mapping>
> >>>  <package-mapping>
> >>>    <package-type>org.eclipse</package-type>
> >>>    <namespaceURI>http://ciaows.org/wsdl</namespaceURI>
> >>>  </package-mapping>
> >>>  <service-interface-mapping>
> >>>    <service-interface>org.eclipse.CiaoWSService</service-interface>
> >>>    <wsdl-service-name
> >>> xmlns:serviceNS="http://ciaows.org/wsdl">serviceNS:CiaoWSService</wsdl-service-name>
> >>>
> >>>    <port-mapping>
> >>>      <port-name>CiaoWSServicePort</port-name>
> >>>      <java-port-name>CiaoWSServicePort</java-port-name>
> >>>    </port-mapping>
> >>>  </service-interface-mapping>
> >>>  <service-endpoint-interface-mapping>
> >>>
> >>> <service-endpoint-interface>org.eclipse.Ciao.CiaoWSService</service-endpoint-interface>
> >>>
> >>>    <wsdl-port-type
> >>> xmlns:portTypeNS="http://ciaows.org/wsdl">portTypeNS:CiaoWSService</wsdl-port-type>
> >>>
> >>>    <wsdl-binding
> >>> xmlns:bindingNS="http://ciaows.org/wsdl">bindingNS:CiaoWSServiceBinding</wsdl-binding>
> >>>
> >>>    <service-endpoint-method-mapping>
> >>>      <java-method-name>getString</java-method-name>
> >>>      <wsdl-operation>getString</wsdl-operation>
> >>>      <method-param-parts-mapping>
> >>>        <param-position>0</param-position>
> >>>        <param-type>java.lang.String</param-type>
> >>>        <wsdl-message-mapping>
> >>>          <wsdl-message
> >>> xmlns:wsdlMsgNS="http://ciaows.org/wsdl">wsdlMsgNS:CiaoWSService_getString</wsdl-message>
> >>>
> >>>          <wsdl-message-part-name>String_1</wsdl-message-part-name>
> >>>          <parameter-mode>IN</parameter-mode>
> >>>        </wsdl-message-mapping>
> >>>      </method-param-parts-mapping>
> >>>      <wsdl-return-value-mapping>
> >>>        <method-return-value>java.lang.String</method-return-value>
> >>>        <wsdl-message
> >>> xmlns:wsdlMsgNS="http://ciaows.org/wsdl">wsdlMsgNS:CiaoWSService_getStringResponse</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>
> >>>
> >>> -------------------------------------------------------------------------------------
> >>>
> >>> client jsp implementation
> >>>
> >>> <%@ page import="org.eclipse.Ciao.CiaoWSHome,
> >>>    org.eclipse.Ciao.CiaoWS,
> >>>    javax.naming.InitialContext,
> >>>    javax.naming.Context,
> >>>    java.util.*"%>
> >>>
> >>> <html>
> >>> <head>
> >>>    <title>OpenEJB -- EJB for Tomcat</title>
> >>> </head>
> >>>
> >>> <body>
> >>> Stateless Session bean - HelloBean - says:
> >>> <%
> >>>    Context initCtx = new InitialContext();
> >>>
> >>>    Object object = initCtx.lookup("java:comp/env/ejb/CiaoWSBean");
> >>>
> >>>    CiaoWSHome ciaoHome = (CiaoWSHome)
> >>>        javax.rmi.PortableRemoteObject.narrow(object, CiaoWSHome.class);
> >>>    CiaoWS bean = ciaoHome.create();
> >>> %>
> >>> <%= bean.getString("Francesco") %>
> >>> </body>
> >>> </html>
> >>> ---------------------------------------------------------------------
> >>> web.xml
> >>>
> >>> <?xml version="1.0" encoding="ISO-8859-1"?>
> >>>
> >>> <web-app 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">
> >>>
> >>>    <description>
> >>>      JSP 2.0 Examples.
> >>>    </description>
> >>>    <display-name>JSP 2.0 Examples</display-name>
> >>>    <welcome-file-list>
> >>>         <welcome-file>CiaoWSClient.jsp</welcome-file>
> >>>    </welcome-file-list>
> >>> <!--<ejb-ref>
> >>>    <ejb-ref-name>ejb/CiaoWS</ejb-ref-name>
> >>>    <ejb-ref-type>Session</ejb-ref-type>
> >>>    <home>org.eclipse.Ciao.CiaoWSHome</home>
> >>>    <remote>org.eclipse.Ciao.CiaoWS</remote>
> >>>    <ejb-link>CiaoWSBean</ejb-link>
> >>> </ejb-ref>-->
> >>> </web-app>
> >>> ---------------------------------------------------------------------------
> >>>
> >>> geronimo-web.xml
> >>>
> >>> <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.1">
> >>>    <environment>
> >>>        <moduleId>
> >>>            <groupId>default</groupId>
> >>>            <artifactId>ejbref-war</artifactId>
> >>>            <version>1.0-SNAPSHOT</version>
> >>>            <type>car</type>
> >>>        </moduleId>
> >>> </environment>
> >>> <context-root>/CiaoWSClient</context-root>
> >>> <!--
> >>> <service-ref>
> >>>    <service-ref-name>ejb/CiaowS</service-ref-name>
> >>>
> >>> <service-interface>org.eclipse.client.CiaoWSClient</service-interface>
> >>>    <wsdl-file>WEB-INF/CiaoWSService.wsdl</wsdl-file>
> >>>    <jaxrpc-mapping-file>WEB-INF/mapping.xml</jaxrpc-mapping-file>
> >>> </service-ref>
> >>> -->
> >>> <service-ref>
> >>>    <service-ref-name>ejb/CiaoWS</service-ref-name>
> >>>    <port>
> >>>        <port-name>CiaoWS</port-name>
> >>>        <uri>http://localhost:8080/CiaoWS</uri>
> >>>    </port>
> >>> </service-ref>
> >>> </web-app>
> >>>
> >>> ------------------------------------------------------------------------------
> >>>
> >>>
> >>> I hope in one quick answer. thanks
> >>>
> >>> Francesco
> >>>
> >>> PS. Sorry for my english.
> >>>
> >>>
> >>
> >>
> >>
> >
> >
> >
> >
>
>
>

Re: Ejb web services and jndi name

Posted by Francesco Sessa <fr...@email.it>.
Hi All,
I insert the web-service-address in the openejb-jar.xml, like the 
following code:

  <enterprise-beans>
    <session>
        <ejb-name>CiaoWSBean</ejb-name>
        <jndi-name>CiaoWSBean</jndi-name>
        <web-service-address>/ejb/CiaoWS</web-service-address>
    </session>
  </enterprise-beans>

but the http://localhost:8080/ejb/CiaoWS?WSDL is not available.

nobody can help me?
Please it's very important.

Francesco Sessa ha scritto:
> Hi,
> I believed that the service-ref element in the geronimo-web.xml was 
> enught.
> I have modified the web.xml but i receive this message:
>
> java.lang.RuntimeException: Could not open stream to wsdl file
>
> I know that it's not clear if the wsdl is accessible to the web 
> service client, but whitch it is the solution?
>
>
> Please help me.
> this is the new web.xml
>
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <web-app 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">
>
> <description>
> JSP 2.0 Examples.
> </description>
> <display-name>JSP 2.0 Examples</display-name>
> <welcome-file-list>
> <welcome-file>CiaoWSClient.jsp</welcome-file>
> </welcome-file-list>
> <service-ref>
> <service-ref-name>CiaoWSService</service-ref-name>
> <service-interface>org.eclipse.Ciao.CiaoWSService</service-interface>
> <wsdl-file>META-INF/CiaoWSService.wsdl</wsdl-file>
> <jaxrpc-mapping-file>META-INF/mapping.xml</jaxrpc-mapping-file>
> </service-ref>
> </web-app>
>
> How to know the url address of the service?
>
> Thanks
>
> David Jencks ha scritto:
>> A couple of obvious problems are that you don't have a service-ref in 
>> the web.xml and it's not clear if the wsdl is accessible to the web 
>> service client (which IIUC is the web app)
>>
>> thanks
>> david jencks
>>
>> On Nov 24, 2006, at 1:20 PM, Francesco Sessa wrote:
>>
>>> Hi all,
>>> I'm a new user of geronimo.
>>> To complete my bachelor thesis, i need to create simples web services
>>> with ejb.
>>> I create the Jar file and deploy it on application server, but, when i
>>> try to connect my client
>>> to my web services, i receive the message that the jndi name isn't 
>>> correct.
>>> I think that the error was in the deployment xml of the client, but i
>>> don't be able to get the wsdl of the service
>>> via browser (i try with the url written in the wsdl, but, evidently, it
>>> isn't correct).
>>> Please, i must deliver my work monday morning.
>>>
>>> endpoint interface
>>> package org.eclipse.Ciao;
>>>
>>> import java.rmi.RemoteException;
>>> import java.rmi.Remote;
>>>
>>> public interface CiaoWSService extends Remote{
>>>    public String getString(String name) throws RemoteException;
>>> }
>>>
>>> home interface
>>> package org.eclipse.Ciao;
>>>
>>> import java.rmi.RemoteException;
>>> import javax.ejb.*;
>>>
>>> public interface CiaoWSHome extends EJBHome{
>>>    CiaoWS create() throws RemoteException, CreateException;
>>> }
>>>
>>> remote interface
>>> package org.eclipse.Ciao;
>>>
>>> import java.rmi.RemoteException;
>>> import javax.ejb.*;
>>>
>>> public interface CiaoWS extends EJBObject{
>>>
>>>    public String getString(String name) throws RemoteException;
>>> }
>>>
>>> bean implementation
>>> package org.eclipse.Ciao;
>>>
>>> import javax.ejb.*;
>>> import java.rmi.RemoteException;
>>>
>>> public class CiaoWSBean implements SessionBean{
>>>
>>>    public String getString(String name) throws RemoteException{
>>>        return "Ciao " + name;
>>>    }
>>>    public void ejbCreate(){}
>>>    public void ejbRemove(){}
>>>    public void ejbActivate(){}
>>>    public void ejbPassivate(){}
>>>    public void setSessionContext(SessionContext sc){}
>>> }
>>>
>>> ---------------------------------------------------------------------------------------------- 
>>>
>>> wsdl generated with jwsdp
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>>
>>> <definitions name="CiaoWSService" targetNamespace="urn:geronimo-ciaows"
>>> xmlns:tns="urn:geronimo:ciaows" 
>>> 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="CiaoWSService_getString">
>>>    <part name="String_1" type="xsd:string"/></message>
>>>  <message name="CiaoWSService_getStringResponse">
>>>    <part name="result" type="xsd:string"/></message>
>>>  <portType name="CiaoWSService">
>>>    <operation name="getString" parameterOrder="String_1">
>>>      <input message="tns:CiaoWSService_getString"/>
>>>      <output
>>> message="tns:CiaoWSService_getStringResponse"/></operation></portType>
>>>  <binding name="CiaoWSServiceBinding" type="tns:CiaoWSService">
>>>    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
>>> style="rpc"/>
>>>    <operation name="getString">
>>>      <soap:operation soapAction=""/>
>>>      <input>
>>>        <soap:body
>>> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded"
>>> namespace="http://ciaows.org/wsdl"/></input>
>>>      <output>
>>>        <soap:body
>>> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded"
>>> namespace="http://ciaows.org/wsdl"/></output></operation></binding>
>>>  <service name="CiaoWSService">
>>>    <port name="CiaoWSServicePort" binding="tns:CiaoWSServiceBinding">
>>>      <soap:address
>>> location="http://127.0.0.1:8080/ejb/CiaoWS"/></port></service></definitions> 
>>>
>>> ------------------------------------------------------------------------------------- 
>>>
>>> ejb-jar.xml
>>>
>>> <?xml version="1.0" ?>
>>> <ejb-jar id="ejb-jar_1" 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>Web Service CiaoWS </description>
>>>    <display-name>Ciao WS</display-name>
>>>    <enterprise-beans>
>>>        <session>
>>>            <ejb-name>CiaoWSBean</ejb-name>
>>>            <home>org.eclipse.Ciao.CiaoWSHome</home>
>>>            <remote>org.eclipse.Ciao.CiaoWS</remote>
>>>            <ejb-class>org.eclipse.Ciao.CiaoWSBean</ejb-class>
>>>                <session-type>Stateless</session-type>
>>>                <transaction-type>Container</transaction-type>
>>>            </session>
>>>        </enterprise-beans>
>>> </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"
>>> xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1"
>>> xmlns:pkgen="http://www.openejb.org/xml/ns/pkgen-2.0"
>>> xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1"
>>> xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1">
>>>  <sys:environment>
>>>    <sys:moduleId>
>>>      <sys:groupId>default</sys:groupId>
>>>      <sys:artifactId>CiaoWSBean_artifact_in_openejb</sys:artifactId>
>>>      <sys:version>1.0</sys:version>
>>>      <sys:type>car</sys:type>
>>>    </sys:moduleId>
>>>    <sys:dependencies>
>>>    <sys:dependency>
>>>           <sys:groupId>geronimo</sys:groupId>
>>>           <sys:artifactId>geronimo-webservices</sys:artifactId>
>>>           <sys:type>jar</sys:type>
>>>        </sys:dependency>
>>>    <sys:dependency>
>>>           <sys:groupId>geronimo</sys:groupId>
>>>           <sys:artifactId>geronimo-axis</sys:artifactId>
>>>           <sys:type>jar</sys:type>
>>>        </sys:dependency>
>>>    </sys:dependencies>
>>>    <sys:hidden-classes/>
>>>    <sys:non-overridable-classes/>
>>>  </sys:environment>
>>>  <enterprise-beans>
>>>    <session>
>>>    <ejb-name>CiaoWSBean</ejb-name>
>>>    <jndi-name>CiaoWSBean</jndi-name>
>>>    </session>
>>>  </enterprise-beans>
>>> </openejb-jar>
>>>
>>> --------------------------------------------------------------------------------------- 
>>>
>>> webservices.xml
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <webservices 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://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd"
>>>    xmlns:ger="http://ciaows.org/wsdl"
>>>    version="1.1">
>>>    <webservice-description>
>>>        <webservice-description-name>
>>>            CiaoWS
>>>        </webservice-description-name>
>>>        <wsdl-file>META-INF/CiaoWSService.wsdl</wsdl-file>
>>>        <jaxrpc-mapping-file>META-INF/mapping.xml</jaxrpc-mapping-file>
>>>        <port-component>
>>>            <port-component-name>CiaoWS</port-component-name>
>>>            <wsdl-port>ger:CiaoWSServicePort</wsdl-port>
>>>            <service-endpoint-interface>
>>>                org.eclipse.Ciao.CiaoWSService
>>>            </service-endpoint-interface>
>>>            <service-impl-bean>
>>>                <ejb-link>CiaoWSBean</ejb-link>
>>>            </service-impl-bean>
>>>        </port-component>
>>>    </webservice-description>
>>> </webservices>
>>> ------------------------------------------------------------------------------------------ 
>>>
>>> mapping.xml generated with jwsdp
>>>
>>> <?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.eclipse</package-type>
>>>    <namespaceURI>http://ciaows.org/types</namespaceURI>
>>>  </package-mapping>
>>>  <package-mapping>
>>>    <package-type>org.eclipse</package-type>
>>>    <namespaceURI>http://ciaows.org/wsdl</namespaceURI>
>>>  </package-mapping>
>>>  <service-interface-mapping>
>>>    <service-interface>org.eclipse.CiaoWSService</service-interface>
>>>    <wsdl-service-name
>>> xmlns:serviceNS="http://ciaows.org/wsdl">serviceNS:CiaoWSService</wsdl-service-name> 
>>>
>>>    <port-mapping>
>>>      <port-name>CiaoWSServicePort</port-name>
>>>      <java-port-name>CiaoWSServicePort</java-port-name>
>>>    </port-mapping>
>>>  </service-interface-mapping>
>>>  <service-endpoint-interface-mapping>
>>>
>>> <service-endpoint-interface>org.eclipse.Ciao.CiaoWSService</service-endpoint-interface> 
>>>
>>>    <wsdl-port-type
>>> xmlns:portTypeNS="http://ciaows.org/wsdl">portTypeNS:CiaoWSService</wsdl-port-type> 
>>>
>>>    <wsdl-binding
>>> xmlns:bindingNS="http://ciaows.org/wsdl">bindingNS:CiaoWSServiceBinding</wsdl-binding> 
>>>
>>>    <service-endpoint-method-mapping>
>>>      <java-method-name>getString</java-method-name>
>>>      <wsdl-operation>getString</wsdl-operation>
>>>      <method-param-parts-mapping>
>>>        <param-position>0</param-position>
>>>        <param-type>java.lang.String</param-type>
>>>        <wsdl-message-mapping>
>>>          <wsdl-message
>>> xmlns:wsdlMsgNS="http://ciaows.org/wsdl">wsdlMsgNS:CiaoWSService_getString</wsdl-message> 
>>>
>>>          <wsdl-message-part-name>String_1</wsdl-message-part-name>
>>>          <parameter-mode>IN</parameter-mode>
>>>        </wsdl-message-mapping>
>>>      </method-param-parts-mapping>
>>>      <wsdl-return-value-mapping>
>>>        <method-return-value>java.lang.String</method-return-value>
>>>        <wsdl-message
>>> xmlns:wsdlMsgNS="http://ciaows.org/wsdl">wsdlMsgNS:CiaoWSService_getStringResponse</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>
>>>
>>> ------------------------------------------------------------------------------------- 
>>>
>>> client jsp implementation
>>>
>>> <%@ page import="org.eclipse.Ciao.CiaoWSHome,
>>>    org.eclipse.Ciao.CiaoWS,
>>>    javax.naming.InitialContext,
>>>    javax.naming.Context,
>>>    java.util.*"%>
>>>
>>> <html>
>>> <head>
>>>    <title>OpenEJB -- EJB for Tomcat</title>
>>> </head>
>>>
>>> <body>
>>> Stateless Session bean - HelloBean - says:
>>> <%
>>>    Context initCtx = new InitialContext();
>>>
>>>    Object object = initCtx.lookup("java:comp/env/ejb/CiaoWSBean");
>>>
>>>    CiaoWSHome ciaoHome = (CiaoWSHome)
>>>        javax.rmi.PortableRemoteObject.narrow(object, CiaoWSHome.class);
>>>    CiaoWS bean = ciaoHome.create();
>>> %>
>>> <%= bean.getString("Francesco") %>
>>> </body>
>>> </html>
>>> ---------------------------------------------------------------------
>>> web.xml
>>>
>>> <?xml version="1.0" encoding="ISO-8859-1"?>
>>>
>>> <web-app 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">
>>>
>>>    <description>
>>>      JSP 2.0 Examples.
>>>    </description>
>>>    <display-name>JSP 2.0 Examples</display-name>
>>>    <welcome-file-list>
>>>         <welcome-file>CiaoWSClient.jsp</welcome-file>
>>>    </welcome-file-list>
>>> <!--<ejb-ref>
>>>    <ejb-ref-name>ejb/CiaoWS</ejb-ref-name>
>>>    <ejb-ref-type>Session</ejb-ref-type>
>>>    <home>org.eclipse.Ciao.CiaoWSHome</home>
>>>    <remote>org.eclipse.Ciao.CiaoWS</remote>
>>>    <ejb-link>CiaoWSBean</ejb-link>
>>> </ejb-ref>-->
>>> </web-app>
>>> --------------------------------------------------------------------------- 
>>>
>>> geronimo-web.xml
>>>
>>> <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.1">
>>>    <environment>
>>>        <moduleId>
>>>            <groupId>default</groupId>
>>>            <artifactId>ejbref-war</artifactId>
>>>            <version>1.0-SNAPSHOT</version>
>>>            <type>car</type>
>>>        </moduleId>
>>> </environment>
>>> <context-root>/CiaoWSClient</context-root>
>>> <!--
>>> <service-ref>
>>>    <service-ref-name>ejb/CiaowS</service-ref-name>
>>>    
>>> <service-interface>org.eclipse.client.CiaoWSClient</service-interface>
>>>    <wsdl-file>WEB-INF/CiaoWSService.wsdl</wsdl-file>
>>>    <jaxrpc-mapping-file>WEB-INF/mapping.xml</jaxrpc-mapping-file>
>>> </service-ref>
>>> -->
>>> <service-ref>
>>>    <service-ref-name>ejb/CiaoWS</service-ref-name>
>>>    <port>
>>>        <port-name>CiaoWS</port-name>
>>>        <uri>http://localhost:8080/CiaoWS</uri>
>>>    </port>
>>> </service-ref>
>>> </web-app>
>>>
>>> ------------------------------------------------------------------------------ 
>>>
>>>
>>> I hope in one quick answer. thanks
>>>
>>> Francesco
>>>
>>> PS. Sorry for my english.
>>>
>>>
>>
>>
>>
>
>
>
>



Re: Ejb web services and jndi name

Posted by Francesco Sessa <fr...@email.it>.
Hi,
I believed that the service-ref element in the geronimo-web.xml was enught.
I have modified the web.xml but i receive this message:

java.lang.RuntimeException: Could not open stream to wsdl file

I know that it's not clear if the wsdl is accessible to the web service client, but whitch it is the solution?


Please help me.
this is the new web.xml


<?xml version="1.0" encoding="ISO-8859-1"?>

<web-app 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">

<description>
JSP 2.0 Examples.
</description>
<display-name>JSP 2.0 Examples</display-name>
<welcome-file-list>
<welcome-file>CiaoWSClient.jsp</welcome-file>
</welcome-file-list>
<service-ref>
<service-ref-name>CiaoWSService</service-ref-name>
<service-interface>org.eclipse.Ciao.CiaoWSService</service-interface>
<wsdl-file>META-INF/CiaoWSService.wsdl</wsdl-file>
<jaxrpc-mapping-file>META-INF/mapping.xml</jaxrpc-mapping-file>
</service-ref>
</web-app>

How to know the url address of the service?

Thanks

David Jencks ha scritto:
> A couple of obvious problems are that you don't have a service-ref in 
> the web.xml and it's not clear if the wsdl is accessible to the web 
> service client (which IIUC is the web app)
>
> thanks
> david jencks
>
> On Nov 24, 2006, at 1:20 PM, Francesco Sessa wrote:
>
>> Hi all,
>> I'm a new user of geronimo.
>> To complete my bachelor thesis, i need to create simples web services
>> with ejb.
>> I create the Jar file and deploy it on application server, but, when i
>> try to connect my client
>> to my web services, i receive the message that the jndi name isn't 
>> correct.
>> I think that the error was in the deployment xml of the client, but i
>> don't be able to get the wsdl of the service
>> via browser (i try with the url written in the wsdl, but, evidently, it
>> isn't correct).
>> Please, i must deliver my work monday morning.
>>
>> endpoint interface
>> package org.eclipse.Ciao;
>>
>> import java.rmi.RemoteException;
>> import java.rmi.Remote;
>>
>> public interface CiaoWSService extends Remote{
>>    public String getString(String name) throws RemoteException;
>> }
>>
>> home interface
>> package org.eclipse.Ciao;
>>
>> import java.rmi.RemoteException;
>> import javax.ejb.*;
>>
>> public interface CiaoWSHome extends EJBHome{
>>    CiaoWS create() throws RemoteException, CreateException;
>> }
>>
>> remote interface
>> package org.eclipse.Ciao;
>>
>> import java.rmi.RemoteException;
>> import javax.ejb.*;
>>
>> public interface CiaoWS extends EJBObject{
>>
>>    public String getString(String name) throws RemoteException;
>> }
>>
>> bean implementation
>> package org.eclipse.Ciao;
>>
>> import javax.ejb.*;
>> import java.rmi.RemoteException;
>>
>> public class CiaoWSBean implements SessionBean{
>>
>>    public String getString(String name) throws RemoteException{
>>        return "Ciao " + name;
>>    }
>>    public void ejbCreate(){}
>>    public void ejbRemove(){}
>>    public void ejbActivate(){}
>>    public void ejbPassivate(){}
>>    public void setSessionContext(SessionContext sc){}
>> }
>>
>> ---------------------------------------------------------------------------------------------- 
>>
>> wsdl generated with jwsdp
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>>
>> <definitions name="CiaoWSService" targetNamespace="urn:geronimo-ciaows"
>> xmlns:tns="urn:geronimo:ciaows" 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="CiaoWSService_getString">
>>    <part name="String_1" type="xsd:string"/></message>
>>  <message name="CiaoWSService_getStringResponse">
>>    <part name="result" type="xsd:string"/></message>
>>  <portType name="CiaoWSService">
>>    <operation name="getString" parameterOrder="String_1">
>>      <input message="tns:CiaoWSService_getString"/>
>>      <output
>> message="tns:CiaoWSService_getStringResponse"/></operation></portType>
>>  <binding name="CiaoWSServiceBinding" type="tns:CiaoWSService">
>>    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
>> style="rpc"/>
>>    <operation name="getString">
>>      <soap:operation soapAction=""/>
>>      <input>
>>        <soap:body
>> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded"
>> namespace="http://ciaows.org/wsdl"/></input>
>>      <output>
>>        <soap:body
>> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded"
>> namespace="http://ciaows.org/wsdl"/></output></operation></binding>
>>  <service name="CiaoWSService">
>>    <port name="CiaoWSServicePort" binding="tns:CiaoWSServiceBinding">
>>      <soap:address
>> location="http://127.0.0.1:8080/ejb/CiaoWS"/></port></service></definitions> 
>>
>> ------------------------------------------------------------------------------------- 
>>
>> ejb-jar.xml
>>
>> <?xml version="1.0" ?>
>> <ejb-jar id="ejb-jar_1" 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>Web Service CiaoWS </description>
>>    <display-name>Ciao WS</display-name>
>>    <enterprise-beans>
>>        <session>
>>            <ejb-name>CiaoWSBean</ejb-name>
>>            <home>org.eclipse.Ciao.CiaoWSHome</home>
>>            <remote>org.eclipse.Ciao.CiaoWS</remote>
>>            <ejb-class>org.eclipse.Ciao.CiaoWSBean</ejb-class>
>>                <session-type>Stateless</session-type>
>>                <transaction-type>Container</transaction-type>
>>            </session>
>>        </enterprise-beans>
>> </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"
>> xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1"
>> xmlns:pkgen="http://www.openejb.org/xml/ns/pkgen-2.0"
>> xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1"
>> xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1">
>>  <sys:environment>
>>    <sys:moduleId>
>>      <sys:groupId>default</sys:groupId>
>>      <sys:artifactId>CiaoWSBean_artifact_in_openejb</sys:artifactId>
>>      <sys:version>1.0</sys:version>
>>      <sys:type>car</sys:type>
>>    </sys:moduleId>
>>    <sys:dependencies>
>>    <sys:dependency>
>>           <sys:groupId>geronimo</sys:groupId>
>>           <sys:artifactId>geronimo-webservices</sys:artifactId>
>>           <sys:type>jar</sys:type>
>>        </sys:dependency>
>>    <sys:dependency>
>>           <sys:groupId>geronimo</sys:groupId>
>>           <sys:artifactId>geronimo-axis</sys:artifactId>
>>           <sys:type>jar</sys:type>
>>        </sys:dependency>
>>    </sys:dependencies>
>>    <sys:hidden-classes/>
>>    <sys:non-overridable-classes/>
>>  </sys:environment>
>>  <enterprise-beans>
>>    <session>
>>    <ejb-name>CiaoWSBean</ejb-name>
>>    <jndi-name>CiaoWSBean</jndi-name>
>>    </session>
>>  </enterprise-beans>
>> </openejb-jar>
>>
>> --------------------------------------------------------------------------------------- 
>>
>> webservices.xml
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <webservices 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://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd"
>>    xmlns:ger="http://ciaows.org/wsdl"
>>    version="1.1">
>>    <webservice-description>
>>        <webservice-description-name>
>>            CiaoWS
>>        </webservice-description-name>
>>        <wsdl-file>META-INF/CiaoWSService.wsdl</wsdl-file>
>>        <jaxrpc-mapping-file>META-INF/mapping.xml</jaxrpc-mapping-file>
>>        <port-component>
>>            <port-component-name>CiaoWS</port-component-name>
>>            <wsdl-port>ger:CiaoWSServicePort</wsdl-port>
>>            <service-endpoint-interface>
>>                org.eclipse.Ciao.CiaoWSService
>>            </service-endpoint-interface>
>>            <service-impl-bean>
>>                <ejb-link>CiaoWSBean</ejb-link>
>>            </service-impl-bean>
>>        </port-component>
>>    </webservice-description>
>> </webservices>
>> ------------------------------------------------------------------------------------------ 
>>
>> mapping.xml generated with jwsdp
>>
>> <?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.eclipse</package-type>
>>    <namespaceURI>http://ciaows.org/types</namespaceURI>
>>  </package-mapping>
>>  <package-mapping>
>>    <package-type>org.eclipse</package-type>
>>    <namespaceURI>http://ciaows.org/wsdl</namespaceURI>
>>  </package-mapping>
>>  <service-interface-mapping>
>>    <service-interface>org.eclipse.CiaoWSService</service-interface>
>>    <wsdl-service-name
>> xmlns:serviceNS="http://ciaows.org/wsdl">serviceNS:CiaoWSService</wsdl-service-name> 
>>
>>    <port-mapping>
>>      <port-name>CiaoWSServicePort</port-name>
>>      <java-port-name>CiaoWSServicePort</java-port-name>
>>    </port-mapping>
>>  </service-interface-mapping>
>>  <service-endpoint-interface-mapping>
>>
>> <service-endpoint-interface>org.eclipse.Ciao.CiaoWSService</service-endpoint-interface> 
>>
>>    <wsdl-port-type
>> xmlns:portTypeNS="http://ciaows.org/wsdl">portTypeNS:CiaoWSService</wsdl-port-type> 
>>
>>    <wsdl-binding
>> xmlns:bindingNS="http://ciaows.org/wsdl">bindingNS:CiaoWSServiceBinding</wsdl-binding> 
>>
>>    <service-endpoint-method-mapping>
>>      <java-method-name>getString</java-method-name>
>>      <wsdl-operation>getString</wsdl-operation>
>>      <method-param-parts-mapping>
>>        <param-position>0</param-position>
>>        <param-type>java.lang.String</param-type>
>>        <wsdl-message-mapping>
>>          <wsdl-message
>> xmlns:wsdlMsgNS="http://ciaows.org/wsdl">wsdlMsgNS:CiaoWSService_getString</wsdl-message> 
>>
>>          <wsdl-message-part-name>String_1</wsdl-message-part-name>
>>          <parameter-mode>IN</parameter-mode>
>>        </wsdl-message-mapping>
>>      </method-param-parts-mapping>
>>      <wsdl-return-value-mapping>
>>        <method-return-value>java.lang.String</method-return-value>
>>        <wsdl-message
>> xmlns:wsdlMsgNS="http://ciaows.org/wsdl">wsdlMsgNS:CiaoWSService_getStringResponse</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>
>>
>> ------------------------------------------------------------------------------------- 
>>
>> client jsp implementation
>>
>> <%@ page import="org.eclipse.Ciao.CiaoWSHome,
>>    org.eclipse.Ciao.CiaoWS,
>>    javax.naming.InitialContext,
>>    javax.naming.Context,
>>    java.util.*"%>
>>
>> <html>
>> <head>
>>    <title>OpenEJB -- EJB for Tomcat</title>
>> </head>
>>
>> <body>
>> Stateless Session bean - HelloBean - says:
>> <%
>>    Context initCtx = new InitialContext();
>>
>>    Object object = initCtx.lookup("java:comp/env/ejb/CiaoWSBean");
>>
>>    CiaoWSHome ciaoHome = (CiaoWSHome)
>>        javax.rmi.PortableRemoteObject.narrow(object, CiaoWSHome.class);
>>    CiaoWS bean = ciaoHome.create();
>> %>
>> <%= bean.getString("Francesco") %>
>> </body>
>> </html>
>> ---------------------------------------------------------------------
>> web.xml
>>
>> <?xml version="1.0" encoding="ISO-8859-1"?>
>>
>> <web-app 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">
>>
>>    <description>
>>      JSP 2.0 Examples.
>>    </description>
>>    <display-name>JSP 2.0 Examples</display-name>
>>    <welcome-file-list>
>>         <welcome-file>CiaoWSClient.jsp</welcome-file>
>>    </welcome-file-list>
>> <!--<ejb-ref>
>>    <ejb-ref-name>ejb/CiaoWS</ejb-ref-name>
>>    <ejb-ref-type>Session</ejb-ref-type>
>>    <home>org.eclipse.Ciao.CiaoWSHome</home>
>>    <remote>org.eclipse.Ciao.CiaoWS</remote>
>>    <ejb-link>CiaoWSBean</ejb-link>
>> </ejb-ref>-->
>> </web-app>
>> --------------------------------------------------------------------------- 
>>
>> geronimo-web.xml
>>
>> <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.1">
>>    <environment>
>>        <moduleId>
>>            <groupId>default</groupId>
>>            <artifactId>ejbref-war</artifactId>
>>            <version>1.0-SNAPSHOT</version>
>>            <type>car</type>
>>        </moduleId>
>> </environment>
>> <context-root>/CiaoWSClient</context-root>
>> <!--
>> <service-ref>
>>    <service-ref-name>ejb/CiaowS</service-ref-name>
>>    
>> <service-interface>org.eclipse.client.CiaoWSClient</service-interface>
>>    <wsdl-file>WEB-INF/CiaoWSService.wsdl</wsdl-file>
>>    <jaxrpc-mapping-file>WEB-INF/mapping.xml</jaxrpc-mapping-file>
>> </service-ref>
>> -->
>> <service-ref>
>>    <service-ref-name>ejb/CiaoWS</service-ref-name>
>>    <port>
>>        <port-name>CiaoWS</port-name>
>>        <uri>http://localhost:8080/CiaoWS</uri>
>>    </port>
>> </service-ref>
>> </web-app>
>>
>> ------------------------------------------------------------------------------ 
>>
>>
>> I hope in one quick answer. thanks
>>
>> Francesco
>>
>> PS. Sorry for my english.
>>
>>
>
>
>



Re: Ejb web services and jndi name

Posted by David Jencks <da...@yahoo.com>.
A couple of obvious problems are that you don't have a service-ref in  
the web.xml and it's not clear if the wsdl is accessible to the web  
service client (which IIUC is the web app)

thanks
david jencks

On Nov 24, 2006, at 1:20 PM, Francesco Sessa wrote:

> Hi all,
> I'm a new user of geronimo.
> To complete my bachelor thesis, i need to create simples web services
> with ejb.
> I create the Jar file and deploy it on application server, but, when i
> try to connect my client
> to my web services, i receive the message that the jndi name isn't  
> correct.
> I think that the error was in the deployment xml of the client, but i
> don't be able to get the wsdl of the service
> via browser (i try with the url written in the wsdl, but,  
> evidently, it
> isn't correct).
> Please, i must deliver my work monday morning.
>
> endpoint interface
> package org.eclipse.Ciao;
>
> import java.rmi.RemoteException;
> import java.rmi.Remote;
>
> public interface CiaoWSService extends Remote{
>    public String getString(String name) throws RemoteException;
> }
>
> home interface
> package org.eclipse.Ciao;
>
> import java.rmi.RemoteException;
> import javax.ejb.*;
>
> public interface CiaoWSHome extends EJBHome{
>    CiaoWS create() throws RemoteException, CreateException;
> }
>
> remote interface
> package org.eclipse.Ciao;
>
> import java.rmi.RemoteException;
> import javax.ejb.*;
>
> public interface CiaoWS extends EJBObject{
>
>    public String getString(String name) throws RemoteException;
> }
>
> bean implementation
> package org.eclipse.Ciao;
>
> import javax.ejb.*;
> import java.rmi.RemoteException;
>
> public class CiaoWSBean implements SessionBean{
>
>    public String getString(String name) throws RemoteException{
>        return "Ciao " + name;
>    }
>    public void ejbCreate(){}
>    public void ejbRemove(){}
>    public void ejbActivate(){}
>    public void ejbPassivate(){}
>    public void setSessionContext(SessionContext sc){}
> }
>
> ---------------------------------------------------------------------- 
> ------------------------
> wsdl generated with jwsdp
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <definitions name="CiaoWSService" targetNamespace="urn:geronimo- 
> ciaows"
> xmlns:tns="urn:geronimo:ciaows" 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="CiaoWSService_getString">
>    <part name="String_1" type="xsd:string"/></message>
>  <message name="CiaoWSService_getStringResponse">
>    <part name="result" type="xsd:string"/></message>
>  <portType name="CiaoWSService">
>    <operation name="getString" parameterOrder="String_1">
>      <input message="tns:CiaoWSService_getString"/>
>      <output
> message="tns:CiaoWSService_getStringResponse"/></operation></portType>
>  <binding name="CiaoWSServiceBinding" type="tns:CiaoWSService">
>    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
> style="rpc"/>
>    <operation name="getString">
>      <soap:operation soapAction=""/>
>      <input>
>        <soap:body
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"  
> use="encoded"
> namespace="http://ciaows.org/wsdl"/></input>
>      <output>
>        <soap:body
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"  
> use="encoded"
> namespace="http://ciaows.org/wsdl"/></output></operation></binding>
>  <service name="CiaoWSService">
>    <port name="CiaoWSServicePort" binding="tns:CiaoWSServiceBinding">
>      <soap:address
> location="http://127.0.0.1:8080/ejb/CiaoWS"/></port></service></ 
> definitions>
> ---------------------------------------------------------------------- 
> ---------------
> ejb-jar.xml
>
> <?xml version="1.0" ?>
> <ejb-jar id="ejb-jar_1" 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>Web Service CiaoWS </description>
>    <display-name>Ciao WS</display-name>
>    <enterprise-beans>
>        <session>
>            <ejb-name>CiaoWSBean</ejb-name>
>            <home>org.eclipse.Ciao.CiaoWSHome</home>
>            <remote>org.eclipse.Ciao.CiaoWS</remote>
>            <ejb-class>org.eclipse.Ciao.CiaoWSBean</ejb-class>
>                <session-type>Stateless</session-type>
>                <transaction-type>Container</transaction-type>
>            </session>
>        </enterprise-beans>
> </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"
> xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1"
> xmlns:pkgen="http://www.openejb.org/xml/ns/pkgen-2.0"
> xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1"
> xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1">
>  <sys:environment>
>    <sys:moduleId>
>      <sys:groupId>default</sys:groupId>
>      <sys:artifactId>CiaoWSBean_artifact_in_openejb</sys:artifactId>
>      <sys:version>1.0</sys:version>
>      <sys:type>car</sys:type>
>    </sys:moduleId>
>    <sys:dependencies>
>    <sys:dependency>
>           <sys:groupId>geronimo</sys:groupId>
>           <sys:artifactId>geronimo-webservices</sys:artifactId>
>           <sys:type>jar</sys:type>
>        </sys:dependency>
>    <sys:dependency>
>           <sys:groupId>geronimo</sys:groupId>
>           <sys:artifactId>geronimo-axis</sys:artifactId>
>           <sys:type>jar</sys:type>
>        </sys:dependency>
>    </sys:dependencies>
>    <sys:hidden-classes/>
>    <sys:non-overridable-classes/>
>  </sys:environment>
>  <enterprise-beans>
>    <session>
>    <ejb-name>CiaoWSBean</ejb-name>
>    <jndi-name>CiaoWSBean</jndi-name>
>    </session>
>  </enterprise-beans>
> </openejb-jar>
>
> ---------------------------------------------------------------------- 
> -----------------
> webservices.xml
>
> <?xml version="1.0" encoding="UTF-8"?>
> <webservices 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://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd"
>    xmlns:ger="http://ciaows.org/wsdl"
>    version="1.1">
>    <webservice-description>
>        <webservice-description-name>
>            CiaoWS
>        </webservice-description-name>
>        <wsdl-file>META-INF/CiaoWSService.wsdl</wsdl-file>
>        <jaxrpc-mapping-file>META-INF/mapping.xml</jaxrpc-mapping-file>
>        <port-component>
>            <port-component-name>CiaoWS</port-component-name>
>            <wsdl-port>ger:CiaoWSServicePort</wsdl-port>
>            <service-endpoint-interface>
>                org.eclipse.Ciao.CiaoWSService
>            </service-endpoint-interface>
>            <service-impl-bean>
>                <ejb-link>CiaoWSBean</ejb-link>
>            </service-impl-bean>
>        </port-component>
>    </webservice-description>
> </webservices>
> ---------------------------------------------------------------------- 
> --------------------
> mapping.xml generated with jwsdp
>
> <?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.eclipse</package-type>
>    <namespaceURI>http://ciaows.org/types</namespaceURI>
>  </package-mapping>
>  <package-mapping>
>    <package-type>org.eclipse</package-type>
>    <namespaceURI>http://ciaows.org/wsdl</namespaceURI>
>  </package-mapping>
>  <service-interface-mapping>
>    <service-interface>org.eclipse.CiaoWSService</service-interface>
>    <wsdl-service-name
> xmlns:serviceNS="http://ciaows.org/wsdl">serviceNS:CiaoWSService</ 
> wsdl-service-name>
>    <port-mapping>
>      <port-name>CiaoWSServicePort</port-name>
>      <java-port-name>CiaoWSServicePort</java-port-name>
>    </port-mapping>
>  </service-interface-mapping>
>  <service-endpoint-interface-mapping>
>
> <service-endpoint-interface>org.eclipse.Ciao.CiaoWSService</service- 
> endpoint-interface>
>    <wsdl-port-type
> xmlns:portTypeNS="http://ciaows.org/wsdl">portTypeNS:CiaoWSService</ 
> wsdl-port-type>
>    <wsdl-binding
> xmlns:bindingNS="http://ciaows.org/ 
> wsdl">bindingNS:CiaoWSServiceBinding</wsdl-binding>
>    <service-endpoint-method-mapping>
>      <java-method-name>getString</java-method-name>
>      <wsdl-operation>getString</wsdl-operation>
>      <method-param-parts-mapping>
>        <param-position>0</param-position>
>        <param-type>java.lang.String</param-type>
>        <wsdl-message-mapping>
>          <wsdl-message
> xmlns:wsdlMsgNS="http://ciaows.org/ 
> wsdl">wsdlMsgNS:CiaoWSService_getString</wsdl-message>
>          <wsdl-message-part-name>String_1</wsdl-message-part-name>
>          <parameter-mode>IN</parameter-mode>
>        </wsdl-message-mapping>
>      </method-param-parts-mapping>
>      <wsdl-return-value-mapping>
>        <method-return-value>java.lang.String</method-return-value>
>        <wsdl-message
> xmlns:wsdlMsgNS="http://ciaows.org/ 
> wsdl">wsdlMsgNS:CiaoWSService_getStringResponse</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>
>
> ---------------------------------------------------------------------- 
> ---------------
> client jsp implementation
>
> <%@ page import="org.eclipse.Ciao.CiaoWSHome,
>    org.eclipse.Ciao.CiaoWS,
>    javax.naming.InitialContext,
>    javax.naming.Context,
>    java.util.*"%>
>
> <html>
> <head>
>    <title>OpenEJB -- EJB for Tomcat</title>
> </head>
>
> <body>
> Stateless Session bean - HelloBean - says:
> <%
>    Context initCtx = new InitialContext();
>
>    Object object = initCtx.lookup("java:comp/env/ejb/CiaoWSBean");
>
>    CiaoWSHome ciaoHome = (CiaoWSHome)
>        javax.rmi.PortableRemoteObject.narrow(object,  
> CiaoWSHome.class);
>    CiaoWS bean = ciaoHome.create();
> %>
> <%= bean.getString("Francesco") %>
> </body>
> </html>
> ---------------------------------------------------------------------
> web.xml
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <web-app 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">
>
>    <description>
>      JSP 2.0 Examples.
>    </description>
>    <display-name>JSP 2.0 Examples</display-name>
>    <welcome-file-list>
>         <welcome-file>CiaoWSClient.jsp</welcome-file>
>    </welcome-file-list>
> <!--<ejb-ref>
>    <ejb-ref-name>ejb/CiaoWS</ejb-ref-name>
>    <ejb-ref-type>Session</ejb-ref-type>
>    <home>org.eclipse.Ciao.CiaoWSHome</home>
>    <remote>org.eclipse.Ciao.CiaoWS</remote>
>    <ejb-link>CiaoWSBean</ejb-link>
> </ejb-ref>-->
> </web-app>
> ---------------------------------------------------------------------- 
> -----
> geronimo-web.xml
>
> <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web/ 
> tomcat-1.1">
>    <environment>
>        <moduleId>
>            <groupId>default</groupId>
>            <artifactId>ejbref-war</artifactId>
>            <version>1.0-SNAPSHOT</version>
>            <type>car</type>
>        </moduleId>
> </environment>
> <context-root>/CiaoWSClient</context-root>
> <!--
> <service-ref>
>    <service-ref-name>ejb/CiaowS</service-ref-name>
>    <service-interface>org.eclipse.client.CiaoWSClient</service- 
> interface>
>    <wsdl-file>WEB-INF/CiaoWSService.wsdl</wsdl-file>
>    <jaxrpc-mapping-file>WEB-INF/mapping.xml</jaxrpc-mapping-file>
> </service-ref>
> -->
> <service-ref>
>    <service-ref-name>ejb/CiaoWS</service-ref-name>
>    <port>
>        <port-name>CiaoWS</port-name>
>        <uri>http://localhost:8080/CiaoWS</uri>
>    </port>
> </service-ref>
> </web-app>
>
> ---------------------------------------------------------------------- 
> --------
>
> I hope in one quick answer. thanks
>
> Francesco
>
> PS. Sorry for my english.
>
>