[JBossWS] - Writing WS client returning complex object
by andrea.le
Hi this is my problem, i hope someone help me...
i'm trying to deploy a simple web service that returns a complex Object.
The class that I want to return is:
package esempio;
|
| public class TestClass {
| private String name;
| public TestClass() {
| }
|
| public String getName() {
| return name;
| }
| public void setName(String name) {
| System.out.println("settato il nome: "+name);
| this.name = name;
| }
| }
|
and this is the service class I wrote:
package esempio;
|
| import javax.ejb.Stateless;
| import javax.jws.WebMethod;
| import javax.jws.WebParam;
| import javax.jws.WebResult;
| import javax.jws.WebService;
| import javax.jws.soap.SOAPBinding;
|
| @WebService(targetNamespace="urn:testws")
| @SOAPBinding(style= SOAPBinding.Style.DOCUMENT)
| @Stateless(name="provaServizio")
| public class ProvaServizioImpl {
| @WebMethod
| @WebResult(name="testClassResult")
| public TestClass getTestClass(
| @WebParam(name = "nome") String name) {
| TestClass ritorno = new TestClass();
| ritorno.setName(name);
| return ritorno;
| }
| }
|
I packaged this two classe in a jar that I named "ws2.jar" and copied this jar in jboss 4.05GA server/default/deploy folder.
The service seems deployed, because if put the address "localhost:8080/ws2/provaServizio?wsdl" on a browser it returns this WSDL:
<definitions name="ProvaServizioImplService" targetNamespace="urn:testws">
| <types>
| <schema elementFormDefault="qualified" targetNamespace="http://esempio/jaws">
| <import namespace="urn:testws"/>
| <complexType name="TestClass">
| <sequence>
| <element name="name" nillable="true" type="string"/>
| </sequence>
| </complexType>
| </schema>
| <schema elementFormDefault="qualified" targetNamespace="urn:testws">
| <import namespace="http://esempio/jaws"/>
| <complexType name="getTestClass">
| <sequence>
| <element name="nome" nillable="true" type="string"/>
| </sequence>
| </complexType>
| <complexType name="getTestClassResponse">
| <sequence>
| <element name="testClassResult" nillable="true" type="ns2:TestClass"/>
| </sequence>
| </complexType>
| <element name="getTestClass" type="tns:getTestClass"/>
| <element name="getTestClassResponse" type="tns:getTestClassResponse"/>
| </schema>
| </types>
| <message name="ProvaServizioImpl_getTestClass">
| <part element="tns:getTestClass" name="parameters"/>
| </message>
| <message name="ProvaServizioImpl_getTestClassResponse">
| <part element="tns:getTestClassResponse" name="result"/>
| </message>
| <portType name="ProvaServizioImpl">
| <operation name="getTestClass">
| <input message="tns:ProvaServizioImpl_getTestClass"/>
| <output message="tns:ProvaServizioImpl_getTestClassResponse"/>
| </operation>
| </portType>
| <binding name="ProvaServizioImplBinding" type="tns:ProvaServizioImpl">
| <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
| <operation name="getTestClass">
| <soap:operation soapAction=""/>
| <input>
| <soap:body use="literal"/>
| </input>
| <output>
| <soap:body use="literal"/>
| </output>
| </operation>
| </binding>
| <service name="ProvaServizioImplService">
| <port binding="tns:ProvaServizioImplBinding" name="ProvaServizioImplPort">
| <soap:address location="http://sviluppo-012:8080/ws2/provaServizio"/>
| </port>
| </service>
| </definitions>
|
So I think the service is working.
Then I wrote this simple Client, including in its classpath the jar containing the TestClass file:
import java.net.URL;
|
| import javax.naming.Context;
| import javax.xml.namespace.QName;
| import javax.xml.rpc.Service;
| import javax.xml.rpc.ServiceFactory;
| import esempio.ProvaServizioImpl;
| import esempio.TestClass;
|
| public class Client {
| public static void main(String[] args) throws Exception {
|
| System.out.println("Start");
|
| ServiceFactory factory= ServiceFactory.newInstance();
|
| Service factoryTest = factory.createService(new URL("http://localhost:8080/ws2/provaServizio?wsdl"),
| new QName("http://esempio/jaws", "ProvaServizioImplService"));
| ProvaServizioImpl proxyTest = (ProvaServizioImpl)factoryTest.getPort(ProvaServizioImpl.class);
|
| TestClass ritorno = (TestClass)proxyTest.getTestClass("test");
|
| System.out.println("ritorno del secondo servizio "+ritorno.getName());
| }
| }
|
Running the Client it returns this error:
"
Exception in thread "main" org.jboss.ws.WSException: Cannot obtain java type mapping for: {urn:testws}getTestClass
at org.jboss.ws.deployment.JSR109MetaDataBuilder.buildParameterMetaDataDoc(JSR109MetaDataBuilder.java:451)
at org.jboss.ws.deployment.JSR109MetaDataBuilder.setupOperationsFromWSDL(JSR109MetaDataBuilder.java:200)
at org.jboss.ws.deployment.JSR109ClientMetaDataBuilder.buildMetaDataInternal(JSR109ClientMetaDataBuilder.java:208)
at org.jboss.ws.deployment.JSR109ClientMetaDataBuilder.buildMetaData(JSR109ClientMetaDataBuilder.java:126)
at org.jboss.ws.deployment.JSR109ClientMetaDataBuilder.buildMetaData(JSR109ClientMetaDataBuilder.java:82)
at org.jboss.ws.jaxrpc.ServiceImpl.(ServiceImpl.java:96)
at org.jboss.ws.jaxrpc.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:157)
at org.jboss.ws.jaxrpc.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:128)
at Client.main(Client.java:19)
"
Now i know that there is error in mapping but i dont know if i wrong something in client or if i need some kind of configuration file(xml).
I read thousands over thousands of examples about WS and clients, but I'm confused... using EJB3 i must generate some mapping file?
In which way?
I read examples that just return primitives types, but never complex Object types...
Can u help me pls?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4059850#4059850
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4059850
18Â years, 9Â months
[JBoss Messaging] - PingTimerTask broken pipe
by bob_walker99
I just upgraded to 4.2.0/1.3.0GA and left the server running overnight, wth a couple of relatively heavy clients sending messages (approx 10,000 messages per client), and one receiver with a listener registered on my queue.
When I looked this morning, my client has nearly 300 "Timer-nnn" threads running, and the JBoss server.log is full of these:
2007-07-03 00:29:32,971 DEBUG [org.jboss.remoting.transport.bisocket.BisocketClientInvoker] Unable to send ping: trying again
4936 2007-07-03 00:29:32,971 DEBUG [org.jboss.remoting.transport.bisocket.BisocketClientInvoker] Unable to send ping: trying again
4937 2007-07-03 00:29:32,971 DEBUG [org.jboss.remoting.transport.bisocket.BisocketClientInvoker] Unable to send ping: trying again
4938 2007-07-03 00:29:32,971 DEBUG [org.jboss.remoting.transport.bisocket.BisocketClientInvoker] Unable to send ping: trying again
4939 2007-07-03 00:29:32,971 DEBUG [org.jboss.remoting.transport.bisocket.BisocketClientInvoker] Unable to send ping: trying again
4940 2007-07-03 00:29:32,971 DEBUG [org.jboss.remoting.transport.bisocket.BisocketClientInvoker] Unable to send ping: trying again
4941 2007-07-03 00:29:32,971 DEBUG [org.jboss.remoting.transport.bisocket.BisocketClientInvoker] Unable to send ping: trying again
4942 2007-07-03 00:29:33,032 DEBUG [org.jboss.remoting.transport.bisocket.BisocketClientInvoker] Unable to send ping: trying again
4943 2007-07-03 00:29:33,032 DEBUG [org.jboss.remoting.transport.bisocket.BisocketClientInvoker] Unable to send ping: trying again
4944 2007-07-03 00:29:33,032 DEBUG [org.jboss.remoting.transport.bisocket.BisocketClientInvoker] Unable to send ping: trying again
4945 2007-07-03 00:29:33,032 WARN [org.jboss.remoting.transport.bisocket.BisocketClientInvoker] Unable to send ping: shutting down PingTimerTask
4946 java.net.SocketException: Write failed: Broken pipe
4947 at jrockit.net.SocketNativeIO.writeBytesPinned(Native Method)
4948 at jrockit.net.SocketNativeIO.socketWrite(Unknown Source)
4949 at java.net.SocketOutputStream.socketWrite0(SocketOutputStream.java)
4950 at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
4951 at java.net.SocketOutputStream.write(SocketOutputStream.java:115)
4952 at org.jboss.remoting.transport.bisocket.BisocketClientInvoker$PingTimerTask.run(BisocketClientInvoker.java:497)
4953 at java.util.TimerThread.mainLoop(Timer.java:512)
4954 at java.util.TimerThread.run(Timer.java:462)
Presumably the server is using the ping to test the health of the registered client - but if this ping fails, it shouldn't leave an open thread in my client?
It looks like I'm going to have to roll back to 1.0.1 again, which is what I had to do when I tried 1.2.0 (for a different reason). This is really disappointing for me. I'm not using clustering at this stage - should I just be happy sticking with 1.0.1? I was of the impression that the newer releases offered efficiencies and performance gains, but if this is negligible, I'm happy to stick with what works for me.
I'm on an x86_64 box with 4Gb RAM running Suse SLES 9, with JBoss running on JRockit 6.0 - R27.2.0-131-78843-1.6.0-20070320-1507-linux-x86_64.
Any help greatly appreciated.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4059847#4059847
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4059847
18Â years, 9Â months