<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
Web Services class not known in context
</h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/teakins">Tim Eakins</a> in <i>JBoss Web Services</i> - <a href="http://community.jboss.org/message/535672#535672">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>This is probably a simple one, but I'm stuck.  I call a new Web Service, queryByObject, which could return several different objects.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I have the below test case to return a User object.  If I change the method signature to return a User, it works.  If I leave it as an Object, I get '<span style="font-family: courier new,courier;">javax.xml.bind.JAXBException: class pfcommon.data.User nor any of its super class is known to this context.</span>'  Even with the XmlSeeAlso, it just won't add User into the schema.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Any help really appreciated!  I put in all the components that I felt were relevant.  JBoss 5.1.0.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Also, if there's anything else wrong in my style, happy to take comments, this is my first attempt at expanding my working EJBs to also be Web Services.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Thanks,<br/>Tim</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><br/><strong>//Interface</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: courier new,courier;">@WebService<br/>@SOAPBinding(style = SOAPBinding.Style.DOCUMENT)<br/>@XmlSeeAlso({pfcommon.data.User.class})<br/>public interface TestConnectionInterface {<br/>...<br/>    /**<br/>     * Select back one value<br/>     */<br/>    @WebMethod<br/>    public Object queryForObject(String queryName, HashMap<String, Object> criteria);<br/>...<br/>}</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><strong>//Remote</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: courier new,courier;">@Remote<br/>public interface TestConnectionInterfaceRemote extends TestConnectionInterface { }</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><strong>//Implementation</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: courier new,courier;">@Stateless<br/>@WebService(endpointInterface="pfcommon.ejb.library.connect.TestConnectionInterface")<br/>@XmlSeeAlso({pfcommon.data.User.class})<br/>public class TestConnection implements TestConnectionInterfaceRemote, TestConnectionInterfaceLocal, TestConnectionInterface {<br/>...<br/>    @Override<br/>    public Object queryForObject(String queryName, HashMap<String, Object> criteria) {<br/>        l.info("queryName=" + queryName);</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: courier new,courier;">        //Simplified sample of something that could happen here<br/>        User ret = new User();</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: courier new,courier;">        l.info("queryForObject ret="+ret);<br/>        return ret;<br/>    }<br/>...<br/>}</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><strong>//Client</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: courier new,courier;">    public void testWebServiceTestConnectionQuery() throws Exception {<br/>        boolean successfulTest = true;</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: courier new,courier;"><span>        String endpointURI = "</span><a class="jive-link-external-small" href="http://192.168.1.7:6881/PersonalFinancier-PersonalFinancier/TestConnection?wsdl" target="_blank">http://192.168.1.7:6881/PersonalFinancier-PersonalFinancier/TestConnection?wsdl</a><span>";</span></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: courier new,courier;">        try {<br/>            URL wsdlURL = new URL(endpointURI);<br/><span>            QName serviceName = new QName("</span><a class="jive-link-external-small" href="http://connect.ejb.pf/" target="_blank">http://connect.ejb.pf/</a><span>", "TestConnectionService");</span></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: courier new,courier;">            Service service = Service.create(wsdlURL, serviceName);<br/>            TestConnectionInterface tc = service.getPort(TestConnectionInterface.class);<br/>            assertNotNull(tc);</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: courier new,courier;">            HashMap<String, Object> filterCriteria = new HashMap<String, Object>();<br/>            filterCriteria.put("username", "bob");</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: courier new,courier;">            l.info("Attempting to call dummy queryForObject method");<br/>            User ret = (User) tc.queryForObject(PFConsts.SELECT_USER_BY_ACTIVE, filterCriteria);<br/>            l.info("User = ["+ret+"]");<br/>        } catch (Exception e) {<br/>            e.printStackTrace();<br/>            successfulTest = false;<br/>        }<br/>        assertTrue(successfulTest);<br/>    }</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><br/><span style="text-decoration: underline;"><a class="jive-link-external-small" href="http://192.168.1.7:6881/jbossws/services" target="_blank">http://192.168.1.7:6881/jbossws/services</a></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Registered Service Endpoints<br/>Endpoint Name     jboss.ws:context=PersonalFinancier-PersonalFinancier,endpoint=TestConnection<br/><span>Endpoint Address     </span><a class="jive-link-external-small" href="http://192.168.1.7:6881/PersonalFinancier-PersonalFinancier/TestConnection?wsdl" target="_blank">http://192.168.1.7:6881/PersonalFinancier-PersonalFinancier/TestConnection?wsdl</a><br/>    <br/><span style="text-decoration: underline;"><a class="jive-link-external-small" href="http://192.168.1.7:6881/PersonalFinancier-PersonalFinancier/TestConnection?wsdl" target="_blank">http://192.168.1.7:6881/PersonalFinancier-PersonalFinancier/TestConnection?wsdl</a></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: courier new,courier;"><span><definitions name="TestConnectionService" targetNamespace="</span><a class="jive-link-external-small" href="http://connect.ejb.pf/" target="_blank">http://connect.ejb.pf/</a><span>"></span><br/><span>  <import location="</span><a class="jive-link-external-small" href="http://192.168.1.7:6881/PersonalFinancier-PersonalFinancier/TestConnection?wsdl&resource=TestConnectionInterface_PortType2174988315873883329.wsdl" target="_blank">http://192.168.1.7:6881/PersonalFinancier-PersonalFinancier/TestConnection?wsdl&resource=TestConnectionInterface_PortType2174988315873883329.wsdl</a><span>" namespace="</span><a class="jive-link-external-small" href="http://connect.library.ejb.pfcommon/" target="_blank">http://connect.library.ejb.pfcommon/</a><span>"/></span></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: courier new,courier;">  <service name="TestConnectionService"></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: courier new,courier;">    <port binding="ns1:TestConnectionInterfaceBinding" name="TestConnectionPort"><br/><span>      <soap:address location="</span><a class="jive-link-external-small" href="http://192.168.1.7:6881/PersonalFinancier-PersonalFinancier/TestConnection" target="_blank">http://192.168.1.7:6881/PersonalFinancier-PersonalFinancier/TestConnection</a><span>"/></span><br/>    </port><br/>  </service><br/></definitions></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><strong>//Server Exception</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: courier new,courier;">...<br/>00:40:14,236 INFO  [EJB3EndpointDeployer] Deploy AbstractBeanMetaData@33435a77{name=jboss.j2ee:ear=PersonalFinancier.ear,jar=PersonalFinancier.jar,name=TestConnection,service=EJB3_endpoint bean=org.jboss.ejb3.endpoint.deployers.impl.EndpointImpl properties=[container] constructor=null autowireCandidate=true}<br/>00:40:14,329 INFO  [SessionSpecContainer] Starting jboss.j2ee:ear=PersonalFinancier.ear,jar=PersonalFinancier.jar,name=TestConnection,service=EJB3<br/>00:40:14,329 INFO  [EJBContainer] STARTED EJB: pf.ejb.connect.TestConnection ejbName: TestConnection<br/>00:40:14,365 INFO  [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: courier new,courier;">        PersonalFinancier/TestConnection/remote - EJB3.x Default Remote Business Interface<br/>        PersonalFinancier/TestConnection/remote-pfcommon.ejb.library.connect.TestConnectionInterfaceRemote - EJB3.x Remote Business Interface<br/>        PersonalFinancier/TestConnection/local - EJB3.x Default Local Business Interface<br/>        PersonalFinancier/TestConnection/local-pfcommon.ejb.library.connect.TestConnectionInterfaceLocal - EJB3.x Local Business Interface</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: courier new,courier;">...<br/>00:40:14,670 INFO  [DefaultEndpointRegistry] register: jboss.ws:context=PersonalFinancier-PersonalFinancier,endpoint=TestConnection<br/>00:40:16,225 INFO  [WSDLFilePublisher] WSDL published to: file:/usr/java/jboss-5.1.0.GA-dev/server/pfdev/data/wsdl/PersonalFinancier.ear/PersonalFinancier.jar/TestConnectionService1705653235957235278.wsdl<br/>...<br/>00:40:20,905 WARN  [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected<br/>00:40:20,905 INFO  [STDOUT] Parameter constructor!<br/>00:40:20,905 INFO  [TestConnection] Successful basic connection.  Now returning value [id=null fieldValue=Remote Simple Test].<br/>00:40:20,905 WARN  [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected<br/>00:40:26,754 WARN  [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected<br/>00:40:26,755 INFO  [TestConnection] queryName=selectUserByActive<br/>00:40:26,770 INFO  [TestConnection] queryForObject ret=<br/>00:40:26,770 WARN  [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected<br/>00:40:26,776 ERROR [RequestHandlerImpl] Error processing web service request<br/>org.jboss.ws.WSException: javax.xml.ws.WebServiceException: javax.xml.bind.MarshalException<br/> - with linked exception:<br/>[javax.xml.bind.JAXBException: class pfcommon.data.User nor any of its super class is known to this context.]<br/>        at org.jboss.ws.WSException.rethrow(WSException.java:68)<br/>        at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:336)<br/>        at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:205)<br/>        at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:131)<br/>        at org.jboss.wsf.common.servlet.AbstractEndpointServlet.service(AbstractEndpointServlet.java:85)<br/>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)<br/>        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)<br/>        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)<br/>        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)<br/>        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)<br/>        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)<br/>        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)<br/>        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)<br/>        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)<br/>        ...</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Thanks again!</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/535672#535672">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Web Services at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>