Using HashMaps in an EJB

Ok this is the second time Im posting this problem. Last time I posted all the details and it may have been more general. This time I will be more specific. The following are the requirement that we were given for a school assignment,
Develop a prototype software module to implement a messenger service. Messaging
Systems consist of one Messaging server and several clients. Message can differ from a simple text message to a complex object like an Image. System should include following components.
� Messaging Server: A Messaging server will hold the message queue for our
Messaging system (which you need to develop)
� Messaging Queue: A Queue will hold the messages from the client. The
messages on this queue will be MapMessages that will allow us to store
name/value pair information about the message to be sent out
� Message Client: A client will create a message, and put it on the Messaging
Queue. This message will hold the information for the email message to be sent out
� Message Driven Bean: A message driven bean will be responsible for taking in the Message MapMessage and for mailing it out.
To develop the system you have to use EJB 3.0 architecture. Usage of Java Persistence
API for modeling data would be recommended.
I dont want the coding to develop the system, I have already created that part and it works perfectly when I send text or numbers as messages. What I need help is on how to handle a hashMap. Simply SET'ing and GET'ing a hashMap does not seem to work. If you good people can give me some pointers on how to set up the entity and how the GET'ing and SET'ing methods work in relation to the HashMap I would be a very happy and thankful guy indeed.
P.S - The *** indicate 'ing. The forum seems to sensor those words.
Message was edited by:
jomanlk

WELL I gone through your code in the link
http://forum.java.sun.com/thread.jspa?threadID=5138929&messageID=9509475#9509475
Well thats the important parts of the code. it works fine when I send >simple messages but when I try out the HashMap the servlet is >displayed but no messages are sent to the queue. It would be great if >anyone could help. The reason is simple;
THE HASHMAP CONTAIN NULL VALUES AND YOU ARE SENDING NULL TO THE JMS SO NO OUTPUT.
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
String title=request.getParameter("title");
     System.out.println("TITLE IS     :"+title);
String body=request.getParameter("body");
     System.out.println("BODY IS     :"+body);
HashMap hm = new HashMap();
//hm.put("title", request.getParameter("title"));
//hm.put("body", request.getParameter("body"));
     hm.put("title",title );
hm.put("body", body);
if ((title!=null) && (body!=null)) {
try {
Connection connection = connectionFactory.createConnection();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer messageProducer = session.createProducer(queue);
ObjectMessage message = session.createObjectMessage();
// here we create NewsEntity, that will be sent in JMS message
NewsEntity e = new NewsEntity();
e.setTitle(title);
e.setBody(body);
e.setHm(hm);
message.setObject(e);
messageProducer.send(message);
messageProducer.close();
connection.close();
// response.sendRedirect("ListNews");
} catch (JMSException ex) {
ex.printStackTrace();
try out this code this modified code and allot some dukes if you succeed best of luck :))

Similar Messages

  • Using HashMap's ContainsKey() in JSTL

    Can we use HashMap's containsKey() in JSTL <c:if > statement
    I tried with the sample
    <html:select property="Type" multiple = "true" size = "3">
    <option value='<c:out value="${key}"/>'
    <c:if test="${requestScope.test.containsKey(key)}">
    selected
    </c:if>     
    <c:out value="${value}"/></option>
    </html:select >
    When i executed the above code i encountered JSP Error
    Can any one please let me know the correct code

    You can't call java methods from JSTL. It uses the EL - not java.
    However there is a solution.
    You access maps using the square brackets [ ] notation.
    ie ${test[key]}
    is the same as test.get(key)
    try
    <c:if test="${ not empty test[key] }"/>
    However seeing as you are using the struts tags, doesn't that automatically take care of this for you? Why don't you use the struts tags for the options list as well as the select? Just a thought :-)
    Cheers,
    evnafets

  • Using JarSettings to generate EJB client jar, but supported classes missed

    Appreciated for any comments in advance.
    I am using @jarSetting to generate EJB client jar file from workshop 9.2. The remote method of EJB has one input parameter that is defined as an interface. The interface is included in client jar, but the implementation of this interface is not.
    Please advise how I can add the implementation of this interface to client jar?
    Best Regards,
    James

    Hi James,
    I believe the algorithm for creating the client jar is to simply inspect the EJB interfaces using reflection and to include all user defined classes and exceptions that are referenced by the interfaces. In your case, it sounds like a class is not being included because it is not directly referenced by one of the EJB interfaces.
    I think the client jar creation algorithm can be described as "best effort" and unfortunately, it does not always end up including all classes needed by the client. I would recommend you add the additional classes manually using the jar tool.
    - Matt

  • Using HashMaps from another class

    I'm trying to use a HashMap to store a person with a given Id. When i create a HashMap as part of a main method and use the put method on that HashMap everything goes fine ie:
    Map myMap = new HashMap();
    Person james = new Person)("James", "Smith");
    myMap.put(1,james);However, when I use a HashMap as part of one class and attempt to call it in another using a simple add method I get a null pointer exception. For example, I have the class People which is basically:
    import java.util.*;
    public class People
        private Map myPeople;
        public People()
            Map myPeople = new HashMap();
        public void addPerson(int id, Person p)
            PeopleTable.put(id,p);
    }I then make a call to this using a separate main method
    Person james = new Person ("James","Smith");
    People myFamily = new myFamily();
    myFamily.addPerson(1,james);but get a null pointer exception. I can't see anything glaringly obvious that i'm getting wrong, but i've just started using HashMaps so I may be missing something.
    Any insight would be greatly appreciated!
    Thanks,
    Nick

    nickd_101 wrote:
    However, when I use a HashMap as part of one class and attempt to call it in another using a simple add method I get a null pointer exception. For example, I have the class People which is basically:
    import java.util.*;
    public class People
    private Map myPeople;
    public People()
    Map myPeople = new HashMap(); //*** You're declaring the map again here, don't do this.
    public void addPerson(int id, Person p)
    PeopleTable.put(id,p);
    You're declaring the map twice, once at the top of the class, which is good, and once again in the constructor, which is very bad since the class's hashmap never gets constructed. Don't do this.
    The constructor should be:
        public People()
            myPeople = new HashMap(); // ** better
        }

  • Using swing to develop EJB project

    Hi, Folks
    I am using jbuilder7 to develop swing connect to ejb project, one requirement is that i should doing control with the editable table. That requirement make me to tied with JBuilder component JDBTable. However the development time would become remarkable long. does anybody have experience of using fancy swing and EJB in the same project?
    thansk in advance.

    forget to tell you I am using JDBTable already. the problem is that how
    could i serlize the dataset to EJB in a easy way? ok, you don't need to serialize your dataset to trasmit to server side. Class com.borland.dx.dataset.DataSetData implements Serializable interface already, so you can send your dataset to server and do not care about serialization. But what to do with this DataSet on server side is very interesting question ;). As for me, it's not very handly to pull out your data from Dataset on server side (DataSet "looks" like client-side class). But, of course, it's up to you.
    unfortunlly I should doing add, delete, edit from my table. So its
    pretty complex to deal with this sort of issue.Why complex? I don't think so. For example, you may set 2 buttons: "Set" and "Delete" under your Jtable view and just "to fish" data client entered in your Jtable string, pack this data in your own serializable model and send this data to server session facade. As for me that's very handly and fast. And there is no complexity...
    Regards.

  • Can I use static variable in EJB?

    Many books suggest developer don't use static variable in EJB,I want to know why?
    I know there isn't any problem if the static varibale is read only
    For writable static varible ,what will happen if I use a static Hashtable for share data
    Help me!Thank you very much!!

    Greetings,
    I know that "EJB business methods are not allowed to
    block on synchronized resources" Just where do you "know" that from?? The EJB 2.0 Specification, at least, is nowhere in agrement with this statement. If it comes from a book I would question the author's reasoning. Contractually, there's no sound basis for this. In the case of Session Beans, they have an expressedly direct and single-threaded association with a client. From a design viewpoint, it certainly seems unnecessary for a bean to "block" its one-and-only client, but to say that it "is not allowed to" do so is without merit. Entity Beans, on the other hand, are concurrently accessible. Yet, with regard to a transactional context being in effect, the container does indeed block on a bean's business methods. For the bean to do so itself is, therefore, unnecessary. Furthermore, the specification explicitly concedes that a "Bean Provider is typically an application domain expert" and "is not required to be an expert at system-level programming." (EJB 2.0 Spec. 3.1.1) From these statements alone it is reasonable to assume the above statement is meritless since the Bean Provider is not expected to even consider synchronization issues when developing a bean.
    But I'm mixed up why we could use "Hashtable" or otherApparently, because your sources are as well...
    collection classes in the EJB ,in these method many
    methods are synchronized In fact, not only "can we use" them but, with respect to multiple-row finders in Entity Beans we are [i]required to use them (or an iteration of them)! Not all Collection classes are synchronized (so called "heavy-weight collections"). As shown above, that the choice of a particular Collection class might be synchronized is of little consequence since a bean designed under strict adherence to the specification ensures that it is never concurrently writeable.
    Could someone provide a good way for this problem?
    Please Help Me!!!Regards,
    Tony "Vee Schade" Cook

  • How to use Java WebStart with EJB ?

    hi forum...
    how to use Java WebStart with EJB ? examples ?
    thanks
    mindu

    Greetings,
    hi forum...
    how to use Java WebStart with EJB ? examples ?Well, for starters these are complementing, not 'cooperating', technologies. I presume, since EJB's do not - directly, at least - communicate with a web browser, that you intend for "Java WebStart" to somehow invoke an EJB?? Java WebStart is a technology for running client-side (Java) applications from the web browser - perceptively, the application resides on the server, but technically it, like an applet, is downloaded to the client and run there. Unlike an applet, however, it is not constrained by "sandbox" restrictions and does not have to be re-downloaded each time it is invoked - though the process allows for automagically updating the client-side with new versions of the application. ;) So, with this in mind, to "use Java WebStart with EJB" means little more than deploying an EJB client application with Java WebStart as the distribution channel.
    thanks
    minduRegards,
    Tony "Vee Schade" Cook

  • Using Spring beans from EJB MDB

    I have a situation where I need to use spring beans from an EJB 3.0 MDB. The project does not have any webapps or anything,
    it will be only a MessageBean facade that needs to call spring beans. It is meant to be a service, that can be called by usign a single EJB message.
    The problem is I cannot get the spring context to load properly, since the MDBean it self is initialized(constructor called) only when it receives the first message from the broker, thus It's "too late" to initialize the spring context. What I want to do is load the spring context when the EJB is deployed in the Java EE container. So, is there a way I can call a some method, class, anything when the EJB is deployed in the container. Can I do something with a deployment descriptor?
    I am using glassfish V2 UR1, EJB 3.0, Spring 2.0.7 The project is deployed as a jar.

    Miku wrote:
    I have a situation where I need to use spring beans from an EJB 3.0 MDB. The project does not have any webapps or anything,
    it will be only a MessageBean facade that needs to call spring beans. It is meant to be a service, that can be called by usign a single EJB message. Why not make it a real service? Spring's contract first web services are a very nice way to go. It hides the fact that you're using a message-driven component for processing, too.
    %

  • Deploying the SQLJ files used by the Rentals EJB

    In a previous section of the documentation for acmevideo demo, we
    address the issue of deployment of the Rentals EJB. This contains
    the rentals.sqlj file.
    Due to an issue with the current versio of Oracle 8i(8.1.5), a
    workaround must be deployed to explicitly deploy the *.ser file
    used by the Rentals EJB to the Oracle 8i database. (I don't know
    or understand what the issue is - can someone explain ?)
    Anyway, I am using Oracles suggested workaround and the
    deployment fails.
    Here is the text:
    *** Invoking the Oracle JDeveloper deployment utility ***
    Scanning project files...done
    Generating classpath dependencies...done
    Generating archive entries table...done
    Writing archive...done
    *** Invoking the Oracle8i deployment utility ***
    interrupted by user
    <The dialog in JDeveloper displays>:
    Cannot load java classes into database
    Any suggestions or tips how to get this working ?
    Regards,
    Mark Battersby
    null

    Mark,
    I had the same problem. Have you increased your Java_pool and
    your shared pool? That and having the right classpath/path
    helped. Also, I think that there are some SQL prep scripts that
    need to be run.
    Todd Kromann
    mark tomlinson (guest) wrote:
    : You might try using the command line version of the deployejb
    : tool and see if you can get a more verbose error message
    : (Jdeveloper might be 'eating' the errors coming back). I have
    : seen that happen when the loadjava portion of deployment would
    : fail (i.e. not getting back an error).
    null

  • Why use app server and EJB?

    we have a project about Component-based Library for Business Information Systems.
    We have chosen Point-Of-Sales System as the type of our system.
    why do we need to use app server and EJB?
    Hope can have replies soon. Thanks so much!
    regards
    beginning of EJB

    Well, you don't need to. You might want to because transaction management is important for point-of-sales and app server/EJB gives you that for 'almost nothing'.

  • Getting Out of memory error while using HashMap

    Hi,
    I'm using HashMap to have string as key, some object as value.
    oHm.put(sKey, oMyVal); //oHM - HashMap
    The actual number of entries i need to put is 200K....
    Buy my program is not crossing even for 100K....
    Its giving OutOfMemory error...... ( 1 GB memory, Win XP )
    Any pointers to resolve this?
    Thanks in Advance...
    Ashok

    Do we have any alternate other than increasing the memory for JVM?Did you read what I said on 8/04/2008 22:20 (reply 1 of 5)?
    It's still the best looking option, especially if this large number is going to grow.

  • Using OID APIs in EJB

    hi,
    Can i use OID APIs in EJB?How to do it?

    That error is unrelated to your use of OracleXMLQuery (XSU) inside your bean. You might post to the JDeveloper forum where EJB folks hang out...

  • Need help using HashMap in a Message Driven App

    Hi ppl,
    Im new to the forum and to Java as well. I do have some basic Java knowledge though. Anyway Im a 4th Year student and I got an assignment to build a message server that uses map messages. I fiddled around with the NewsApp example provided at NetBeans ( http://www.netbeans.org/kb/55/ejb30.html)and tried modifying it to set up to use a HashMap but no success :(
    Here are some snippets,
    NewsEntity.java
    package ejb;
    import java.io.Serializable;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    import javax.persistence.Id;
    * Entity class NewsEntity
    * @author Kiran
    @Entity
    public class NewsEntity implements Serializable {
        private String title;
        private String body;
        private HashMap hm = new HashMap();
        @Id
        @GeneratedValue(strategy = GenerationType.AUTO)
        private Long id;
        /** Creates a new instance of NewsEntity */
        public NewsEntity() {
        public Long getId() {
            return this.id;
        public void setId(Long id) {
            this.id = id;
        @Override
        public int hashCode() {
            int hash = 0;
            hash += (this.getId() != null ? this.getId().hashCode() : 0);
            return hash;
        @Override
        public boolean equals(Object object) {
            // TODO: Warning - this method won't work in the case the id fields are not set
            if (!(object instanceof NewsEntity)) {
                return false;
            NewsEntity other = (NewsEntity)object;
            if (this.getId() != other.getId() && (this.getId() == null || !this.getId().equals(other.getId()))) return false;
            return true;
         * Returns a string representation of the object.  This implementation constructs
         * that representation based on the id fields.
         * @return a string representation of the object.
        @Override
        public String toString() {
            return "ejb.NewsEntity[id=" + getId() + "]";
        public String getTitle() {
            return title;
        public void setTitle(String title) {
            this.title = title;
        public String getBody() {
            return body;
        public void setBody(String body) {
            this.body = body;
    public HashMap getHm() {
            return hm;
        public void setHm(HashMap hm) {
            this.hm = hm;
    PostMessage.java
    public class PostMessage extends HttpServlet {
        @Resource(mappedName="jms/NewMessageFactory")
        private  ConnectionFactory connectionFactory;
        @Resource(mappedName="jms/NewMessage")
        private  Queue queue;
        /** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
         * @param request servlet request
         * @param response servlet response
        protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            response.setContentType("text/html;charset=UTF-8");
            String title=request.getParameter("title");
            String body=request.getParameter("body");
            HashMap hm = new HashMap();
            hm.put("title", request.getParameter("title"));
            hm.put("body", request.getParameter("body"));
            if ((title!=null) && (body!=null)) {
                try {
                    Connection connection = connectionFactory.createConnection();
                    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
                    MessageProducer messageProducer = session.createProducer(queue);
                    ObjectMessage message = session.createObjectMessage();
                    // here we create NewsEntity, that will be sent in JMS message
                    NewsEntity e = new NewsEntity();
                    e.setTitle(title);
                    e.setBody(body);
                    e.setHm(hm);
                    message.setObject(e);               
                    messageProducer.send(message);
                    messageProducer.close();
                    connection.close();
                    // response.sendRedirect("ListNews");
                } catch (JMSException ex) {
                    ex.printStackTrace();
            }(Some other code goes here to display the HTML form. not important)
    ListNews.Java
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            response.setContentType("text/html;charset=UTF-8");
            PrintWriter out = response.getWriter();
            HashMap hm = new HashMap();
            out.println("<html>");
            out.println("<head>");
            out.println("<title>Show Messages</title>");
            out.println("</head>");
            out.println("<body bgcolor='#FFCCFF'>");
            out.println("<h1>Showing all Messages</h1>");
            List news = newsEntityFacade.findAll();
            for (Iterator it = news.iterator(); it.hasNext();) {
                 NewsEntity elem = (NewsEntity) it.next();
                hm = elem.getHm();
                out.println(" <table width='35%' border='0' cellpadding='1' cellspacing='1' bgcolor='#000000'> ");
                out.println("   <tr bordercolor='#000000' bgcolor='#CC99FF'> ");
                out.println("     <td width='19%' bgcolor='#CC99FF'><font color='#000000'><strong>Name</strong></font></td>");
                out.println("     <td width='81%' bgcolor='#CC99FF'><font color='#000000'>" + elem.getTitle() + "</font></td>");
                out.println("   </tr>");
                out.println("   <tr bordercolor='#000000' bgcolor='#CC99FF'> ");
                out.println("     <td><font color='#000000'><strong>Message</strong></font></td>");
                out.println("     <td><font color='#000000'>" + elem.getBody() + "</font></td>");
                out.println("   </tr>");
                out.println(" </table>");
                out.println("-----" + hm.get("title")); //I just want to try to get 1 item to see if it works
                out.println("   <br />");
            }Well thats the important parts of the code. it works fine when I send simple messages but when I try out the HashMap the servlet is displayed but no messages are sent to the queue. It would be great if anyone could help.
    I know this isnt that clear but Im really tired and frustrated right now if you need more info please ask and I can supply it. Thanks

    Hi, so I've added a weblogic-ejb.jar.xml file with a reference to the JNDI name of the work manager:
    <?xml version="1.0" encoding="UTF-8"?>
    <wls:weblogic-ejb-jar xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-ejb-jar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd http://xmlns.oracle.com/weblogic/weblogic-ejb-jar http://xmlns.oracle.com/weblogic/weblogic-ejb-jar/1.0/weblogic-ejb-jar.xsd">
        <wls:weblogic-enterprise-bean>
            <wls:ejb-name>DependencyWorker</wls:ejb-name>
            <wls:resource-description>
                <wls:res-ref-name>MyWorkManager</wls:res-ref-name>
                <wls:jndi-name>wm/MyWorkManager</wls:jndi-name>
            </wls:resource-description>
        </wls:weblogic-enterprise-bean>
    </wls:weblogic-ejb-jar>But I still get exactly the same error when I try to start my server. The example you referred to kind of cryptically suggests that adding a plan.xml suddenly fixed everything, but what am I missing here that actually hooks the work manager up to JNDI? am I getting these problems because I'm using annotations, or are people not supposed to access work managers in this way?
    Thanks,
    Edited by: 806682 on 05-Nov-2010 08:57

  • PHP using soap to call EJB

    Hello everybody,
    I've a problem to call a EJB form a PHP script.
    There is a Apache with PHP 5.2.0 and a SAP NetWeaver Application Server 7.10 / AS Java 7.10 running on the system.
    I wanted to use soap to call a method in an EJB. It's only a test EJB:
    [code]
    package beans;
    import javax.ejb.Stateless;
    import javax.jws.WebService;
    import javax.jws.WebMethod;
    @WebService(name="HelloWorldEARBean",serviceName="HelloWorldEARBeanService",targetNamespace="http://beans/",portName="HelloWorldEARBeanPort") @Stateless public class HelloWorldEARBean {
      @WebMethod public String sayHello(String testStr){
                return "Hello Mr. "+testStr;
      @WebMethod public String getReturn(String inputStr){
                return "the return value is"+inputStr;
    [/code]
    I tried it with the PEAR SOAP in the following script:
    [code]
    <?php
    require_once 'SOAP/Client.php';
    $wsdl_url     = 'http://localhost:50000/HelloWorldEARBeanService/HelloWorldEARBean?wsdl';
    $WSDL = new SOAP_WSDL($wsdl_url);
    $client = $WSDL->getProxy();
    $client->__trace(1);
    $options=array('namespace' => 'http://beans/',
      'style' => 'rpc',
      'soapaction' => 'sayHello');
    $NAME = "Bob"; 
    $parameters=array(
         'parameters', $NAME
    $result = $client->getReturn($parameters);
    echo "<pre>";
    print_r($params);
    echo "</pre>";
    echo "<h2>return</h2>";
    echo "<pre>";
    print_r($result);
    echo "</pre>";
    echo '<h2>Request</h2>';
    echo '<pre>' . htmlspecialchars($client->__getlastrequest(), ENT_QUOTES) . '</pre>';
    echo '<h2>Response</h2>';
    echo '<pre>' . htmlspecialchars($client->__getlastresponse(), ENT_QUOTES). '</pre>';
    ?>
    [/code]
    The AS distributes the following WSDL:
    [code]
    - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://beans/" xmlns:tns="http://beans/">
    - <wsdl:types>
    - <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0" targetNamespace="http://beans/">
      <xs:element name="getReturn" type="tns:getReturn" />
      <xs:element name="getReturnResponse" type="tns:getReturnResponse" />
      <xs:element name="sayHello" type="tns:sayHello" />
      <xs:element name="sayHelloResponse" type="tns:sayHelloResponse" />
    - <xs:complexType name="sayHello">
    - <xs:sequence>
      <xs:element name="arg0" type="xs:string" minOccurs="0" />
      </xs:sequence>
      </xs:complexType>
    - <xs:complexType name="sayHelloResponse">
    - <xs:sequence>
      <xs:element name="return" type="xs:string" minOccurs="0" />
      </xs:sequence>
      </xs:complexType>
    - <xs:complexType name="getReturn">
    - <xs:sequence>
      <xs:element name="arg0" type="xs:string" minOccurs="0" />
      </xs:sequence>
      </xs:complexType>
    - <xs:complexType name="getReturnResponse">
    - <xs:sequence>
      <xs:element name="return" type="xs:string" minOccurs="0" />
      </xs:sequence>
      </xs:complexType>
      </xs:schema>
      </wsdl:types>
    - <wsdl:message name="sayHelloIn">
      <wsdl:part name="parameters" element="tns:sayHello" />
      </wsdl:message>
    - <wsdl:message name="sayHelloOut">
      <wsdl:part name="sayHelloResponse" element="tns:sayHelloResponse" />
      </wsdl:message>
    - <wsdl:message name="getReturnIn">
      <wsdl:part name="parameters" element="tns:getReturn" />
      </wsdl:message>
    - <wsdl:message name="getReturnOut">
      <wsdl:part name="getReturnResponse" element="tns:getReturnResponse" />
      </wsdl:message>
    - <wsdl:portType name="HelloWorldEARBean">
    - <wsdl:operation name="sayHello" parameterOrder="parameters">
      <wsdl:input message="tns:sayHelloIn" />
      <wsdl:output message="tns:sayHelloOut" />
      </wsdl:operation>
    - <wsdl:operation name="getReturn" parameterOrder="parameters">
      <wsdl:input message="tns:getReturnIn" />
      <wsdl:output message="tns:getReturnOut" />
      </wsdl:operation>
      </wsdl:portType>
    - <wsdl:binding name="HelloWorldEARBeanBinding" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" type="tns:HelloWorldEARBean">
      <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
    - <wsdl:operation name="sayHello">
      <soap:operation soapAction="" />
    - <wsdl:input>
      <soap:body parts="parameters" use="literal" />
      </wsdl:input>
    - <wsdl:output>
      <soap:body use="literal" />
      </wsdl:output>
      </wsdl:operation>
    - <wsdl:operation name="getReturn">
      <soap:operation soapAction="" />
    - <wsdl:input>
      <soap:body parts="parameters" use="literal" />
      </wsdl:input>
    - <wsdl:output>
      <soap:body use="literal" />
      </wsdl:output>
      </wsdl:operation>
      </wsdl:binding>
    - <wsdl:service name="HelloWorldEARBeanService">
    - <wsdl:port name="HelloWorldEARBeanPort" binding="tns:HelloWorldEARBeanBinding">
      <soap:address xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" location="http://localhost:50000/HelloWorldEARBeanService/HelloWorldEARBean" />
      </wsdl:port>
      </wsdl:service>
      </wsdl:definitions>
    [/code]
    By the following output it's obvious that the AS or the EJB (webservice) doesn't receive the parameter send by the PHP script. Look at the output:
    return value:
    the return value is null
    [code]
    Request:
    POST /HelloWorldEARBeanService/HelloWorldEARBean HTTP/1.0
    User-Agent: PEAR-SOAP 0.8.0RC4-devel
    Host: localhost
    Content-Type: text/xml; charset=UTF-8
    Content-Length: 438
    SOAPAction: ""
    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
    >
    <SOAP-ENV:Body>
    <getReturn xmlns="http://beans/">
    <item>parameters</item>
    <item>Bob</item></getReturn>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    Response:
    HTTP/1.1 200 OK
    server: SAP NetWeaver Application Server 7.10 / AS Java 7.10
    content-type: text/xml; charset=utf-8
    date: Wed, 14 Feb 2007 15:51:53 GMT
    connection: close
    <?xml version="1.0" encoding="utf-8"?>
    <SOAP-ENV:Envelope xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <SOAP-ENV:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
    <wsu:Timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <wsu:Created>2007-02-14T15:51:53Z</wsu:Created>
    <wsu:Expires>2007-02-14T15:52:23Z</wsu:Expires></wsu:Timestamp></wsse:Security></SOAP-ENV:Header>
    <SOAP-ENV:Body><ns2:getReturnResponse xmlns:ns2='http://beans/'>
    <return>the return value is null</return></ns2:getReturnResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
    [/code]
    I used different soap interfaces for PHP like nusoap and the integrated soap interface of PHP 5.
    Further I experimented with different parameters inside the function call
    that results in small differencies at the xml-request.
    Thanks.

    Hi
    I've solved the problem now. I just have to add
    @SOAPBinding(style=SOAPBinding.Style.RPC)
    in the EJB, that's all.
    Here is the complete code, ... maybe some other guys have this problem too, so I will post the working code:
    At first the EJB:
    package beans;
    import javax.ejb.Stateless;
    import javax.jws.WebParam;
    import javax.jws.WebService;
    import javax.jws.WebMethod;
    import javax.jws.soap.SOAPBinding;
    import beans.HelloWorldEARBean;
    @WebService(name="HelloWorldEARBean",serviceName="HelloWorldEARBeanService",targetNamespace="http://beans/",portName="HelloWorldEARBeanPort")
    @SOAPBinding(style=SOAPBinding.Style.RPC)
    @Stateless public class HelloWorldEARBean {
         @WebMethod public String sayHello(@WebParam(name="testStr") String testStr){
                return "Hello Mr. "+testStr;
    2. the local XML:
    <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://beans/" xmlns:tns="http://beans/">
      <wsdl:types>
        <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0" targetNamespace="http://beans/">
          <xs:element name="sayHello" type="tns:sayHello"/>
          <xs:element name="sayHelloResponse" type="tns:sayHelloResponse"/>
          <xs:complexType name="sayHello">
              <xs:element name="testStr" type="xs:string" minOccurs="0"/>
          </xs:complexType>
          <xs:complexType name="sayHelloResponse">
              <xs:element name="return" type="xs:string" minOccurs="0"/>
          </xs:complexType>
        </xs:schema>
      </wsdl:types>
      <wsdl:message name="sayHelloIn">
        <wsdl:part name="parameters" element="tns:sayHello"/>
      </wsdl:message>
      <wsdl:message name="sayHelloOut">
        <wsdl:part name="sayHelloResponse" element="tns:sayHelloResponse"/>
      </wsdl:message>
      <wsdl:portType name="HelloWorldEARBean">
        <wsdl:operation name="sayHello" parameterOrder="parameters">
          <wsdl:input message="tns:sayHelloIn"/>
          <wsdl:output message="tns:sayHelloOut"/>
        </wsdl:operation>
      </wsdl:portType>
      <wsdl:binding name="HelloWorldEARBeanBinding" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" type="tns:HelloWorldEARBean">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="sayHello">
          <soap:operation soapAction=""/>
          <wsdl:input>
            <soap:body parts="parameters" use="literal"/>
          </wsdl:input>
          <wsdl:output>
            <soap:body use="literal"/>
          </wsdl:output>
        </wsdl:operation>
      </wsdl:binding>
      <wsdl:service name="HelloWorldEARBeanService">
        <wsdl:port name="HelloWorldEARBeanPort" binding="tns:HelloWorldEARBeanBinding">
          <soap:address xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" location="http://localhost:50000/HelloWorldEARBeanService/HelloWorldEARBean"/>
        </wsdl:port>
      </wsdl:service>
    </wsdl:definitions>
    3. the PHP script:
    see next post
    Thank you very much for your help.

  • How to use the same Entity EJB to access the same table in 2 syb databases

    We are trying to convert an application to J2EE. We have the following
    concern. The application requires the use of 10 sybase databases with
    identical tables. One database per branch. We would like to be able to use the same set of entity EJBs to access all databases.
    One solution we can think of is to use bmp entity beans and have a dispatcher session bean pass the database that the entity bean has to connect to.
    Would it work?
    Is there a more elegant way to do this?

    I don't know if there is a more elegant way to do it, but that will work. I have a similar scenario, one database per customer. You'll have to use BMP and get your connections based on the branch.
    Each one of my DAO methods requires that a customer ID be passed in for each method. The customer ID is part of the primary key for each entity bean; therefore, if I need to find a deposit (entity) for a customer, I pass the customer ID and deposit ID to my session facade, create the PK using these, do a findByPrimaryKey, etc. In the ejbLoad, I use the customer ID and the deposit ID to pass into the DAO. There, another class (ConnectionFactory) returns a proper connection based on the customer ID passed, which I use to do my queries.
    Paul

Maybe you are looking for

  • Did you know you can Edit Buttons??

    OK, who knew that you can EDIT the buttons on the bottom of the screen in You Tube and Music? Can rearrange or replace with different buttons. Is this New News, or was everyone aware of this already and I'm late for the party? Gunny

  • Computer crashed - how to copy files from ipod onto new computer

    Dear all, My computer crashed and I desperately need some tips on how to copy my music files from my ipod to the new hard disk. Any ideas? Thanks so much, Patrick HP notebook   Windows XP  

  • Issues with the Custom Filter in Datasheet View

    I'm seeing some odd, yet intermittent, behavior while trying to filter columns in datasheet view using a custom filter. After clicking to apply a filter to a column and choosing 'Custom Filter...' a pop-up with regular expressions should appear much

  • How to transfer purchased apps from iphone to the new itunes

    Hi, how do i transfer purchased apps from iphone to the new itunes? (11.0.2) thanks!

  • ORA-27102 in SUSE Linux 10.1 (64 bit)

    Hi all, We are migrating our Sun solaris OS to SUSE Linux 10.1 64 bit and database is oracle 9.2.0.6 In sun solaris server we are having 8GB physical memory but when are allocating 4gb to oracle memory, we are getting error at the time of nomount sta