2 Replies Latest reply on Dec 13, 2006 4:55 PM by Brian Bailey

    Stateless EJB web service and nested elements

    Brian Bailey Newbie

      JBoss 4.0.3SP1

      I have created a simple Java bean where one bean is nested inside the other, e.g., a Sale bean contains a Product bean, among other fields.

      I have created an EJB with a Remote interface. I have exposed this interface as a web service. It uses RPC/Literal style. The method signature is:

      public Sale getSale() throws RemoteException;

      The EJB deploys just fine with no errors; I can also see the wsdl via a browser. But I get an error when I call this web service:

      SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.


      I have read in the Axis API that SimpleDeserializer cannot handle nested elements. I'm not certain whether this is really my problem, though.

      I have also found that this exception is associated with Doc/Literal wsdl's where a method uses an array, which is clearly not my case.

      Can anyone recommend a course of action to help me debug this issue? Thank you in advance.

        • 1. Re: Stateless EJB web service and nested elements
          Brian Bailey Newbie

          A quick update...I used TcpMon to sniff the soap envelope. Here's what I get back:

          <?xml version="1.0" encoding="UTF-8"?>
          <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
           <soapenv:Body>
           <ns1:getSaleResponse xmlns:ns1="http://sample.myco.com/hibernate">
           <getSaleReturn>
           <customerName>Brian</customerName>
           <id>11</id>
           <product>
           <id>5</id>
           <name>CD</name>
           <price>14.95</price>
           </product>
           <quantity>3</quantity>
           </getSaleReturn>
           </ns1:getSaleResponse>
           </soapenv:Body>
          </soapenv:Envelope>


          This seems to be correct; however, as I researched before, the SimpleDeserializer cannot handle child elements, and the tag above does have child elements.

          • 2. Re: Stateless EJB web service and nested elements
            Brian Bailey Newbie

            Okay, my apologies on this thread...it looks like the issue was on the web service client-side. I was using dynamic service invokation, and JBoss's implementation of the rpc interfaces was choking. This is not the proper forum for resolving that.