users@glassfish.java.net

How to test Entity using Webservice

From: <glassfish_at_javadesktop.org>
Date: Mon, 13 Oct 2008 16:37:45 PDT

If anyone can help me with this puzzle:
I have a session facade that I have exposed as webservice. I am trying to write a test java client for this webservice. From my test cleint when I call my operation name, I am getting the followings:
Exception in thread "main" javax.xml.ws.WebServiceException: javax.xml.bind.MarshalException
     [java] - with linked exception:
     [java] [javax.xml.bind.JAXBException: class com.pedigree.service.message.vo.Customer nor any of its super class is known to this context.]
     [java] at com.sun.xml.ws.message.jaxb.JAXBMessage.writePayloadTo(JAXBMessage.java:322)
     [java] at com.sun.xml.ws.message.AbstractMessageImpl.writeTo(AbstractMessageImpl.java:142)
     [java] at com.sun.xml.ws.encoding.StreamSOAPCodec.encode(StreamSOAPCodec.java:108)
     [java] at com.sun.xml.ws.encoding.SOAPBindingCodec.encode(SOAPBindingCodec.java:258)
     [java] at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:142)
     [java] at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:86)
     [java] at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:595)
     [java] at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:554)
     [java] at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:539)
     [java] at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:436)
     [java] at com.sun.xml.ws.client.Stub.process(Stub.java:248)
     [java] at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:135)
     [java] at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:109)
     [java] at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:89)
     [java] at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:118)
    [b] [java] at $Proxy36.insertObj(Unknown Source)[/b]
     [java] at samples.Tester.runTests(Tester.java:53)
     [java] at samples.Client.doStaticService(Client.java:68)
     [java] at samples.Client.main(Client.java:48)
     [java] Caused by: javax.xml.bind.MarshalException
     [java] - with linked exception:
     [java] [javax.xml.bind.JAXBException: class com.pedigree.service

   Note: I have highlighted my operation method. It is actuall taking List<Object>. in this case I have build the following object:
      public List<Object> buildObj()
    {
        List<Object> customers = new ArrayList<Object>();
        Customer cus = new Customer();
        cus.setId(12322);
        cus.setName("Dummy");
        customers.add(cus);
        return customers;
    }

where : ] [java] at $Proxy36.insertObj(Unknown Source)= ] [java] at $Proxy36.insertObj(buildObj())
   Also note that Customer is an Entity.
[u]Couple of things I am not sure about:
     1> Do I have to also expose my Customer Entity? Doesn't make quiet sense.
     2> I am not sure that If I am allowed to use Entity like that, because I am running a standalone client, whereas Customer Entity is in the container. Then, How do i populate a Customer bean to test it?[/u]
Any help will be appreciated.
[Message sent by forum member 's1ahosan2002' (s1ahosan2002)]

http://forums.java.net/jive/thread.jspa?messageID=306363