Return custom object from Web services using JAX-WS












0















The question is a little bit long but I wanted to supply all the information in advance



I have the following class:



package test.api.soap.server;

public class TestClassA {

public TestClassA() {

}

public String doA() {
System.out.println("Start doA()");
return "In do A";
}
}


I want to expose it as web service but not directly so i created wrapper class:
package test.api.soap.server;



import javax.jws.WebMethod;
import javax.jws.WebService;

@WebService
public class MyClientApiV2_5 {

public MyClientApiV2_5() {

}

@WebMethod
public TestClassA getTestClassA() {
return new TestClassA();
}
}


I creating the server WSDL using standard wsgen in ant task:



<target name="Create-JAXWS-SOAP-Server">
<echo message="Generate SOAP server stubs" />
<exec executable="${wsgen-cmd}">
<arg value="-verbose" />
<arg value="-classpath" />
<arg value="${build}" />
<arg value="-wsdl" />
<arg value="-d" />
<arg value="${build}" />
<arg value="-r" />
<arg value="wsdl" />
<arg value="-s" />
<arg value="${src}" />
<arg value="-keep" />
<arg value="test.api.soap.server.MyClientApiV2_5" />
</exec>
</target>


The out come are 2 files:
MyClientApiV25Service.wsdl



<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.3-b01-. -->
<definitions targetNamespace="http://server.soap.api.test/" name="MyClientApiV2_5Service" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:tns="http://server.soap.api.test/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<types>
<xsd:schema>
<xsd:import namespace="http://server.soap.api.test/" schemaLocation="MyClientApiV25Service_schema1.xsd"/>
</xsd:schema>
</types>
<message name="getTestClassA">
<part name="parameters" element="tns:getTestClassA"/>
</message>
<message name="getTestClassAResponse">
<part name="parameters" element="tns:getTestClassAResponse"/>
</message>
<portType name="MyClientApiV2_5">
<operation name="getTestClassA">
<input wsam:Action="http://server.soap.api.test/MyClientApiV2_5/getTestClassARequest" message="tns:getTestClassA"/>
<output wsam:Action="http://server.soap.api.test/MyClientApiV2_5/getTestClassAResponse" message="tns:getTestClassAResponse"/>
</operation>
</portType>
<binding name="MyClientApiV2_5PortBinding" type="tns:MyClientApiV2_5">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="getTestClassA">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="MyClientApiV2_5Service">
<port name="MyClientApiV2_5Port" binding="tns:MyClientApiV2_5PortBinding">
<soap:address location="REPLACE_WITH_ACTUAL_URL"/>
</port>
</service>
</definitions>


MyClientApiV25Service_schema1.xsd



<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" targetNamespace="http://server.soap.api.test/" xmlns:tns="http://server.soap.api.test/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="getTestClassA" type="tns:getTestClassA"/>
<xs:element name="getTestClassAResponse" type="tns:getTestClassAResponse"/>
<xs:complexType name="getTestClassA">
<xs:sequence/>
</xs:complexType>
<xs:complexType name="getTestClassAResponse">
<xs:sequence>
<xs:element name="return" type="tns:testClassA" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="testClassA">
<xs:sequence/>
</xs:complexType>
</xs:schema>


I created the client stub:



<target name="Create-JAXWS-SOAP-Client" >
<echo message="Generate SOAP client stubs" />
<exec executable="${wsimport-cmd}">
<arg value="-verbose" />
<arg value="-keep" />
<arg value="-s" />
<arg value="${src}" />
<arg value="-d" />
<arg value="${build}" />
<arg value="-p" />
<arg value="test.api.soap.client.stubs" />
<arg value="wsdlMyClientApiV25Service.wsdl" />
</exec>
</target>


I then write simple client class to get the web service:



package test.api.soap.client;

import java.net.MalformedURLException;
import java.net.URL;

import javax.xml.namespace.QName;

import test.api.soap.client.stubs.MyClientApiV25;
import test.api.soap.client.stubs.MyClientApiV25Service;
import test.api.soap.client.stubs.TestClassA;

public class SampleClient {

private MyClientApiV25 api = null;
static MyClientApiV25Service service;

public SampleClient() throws MalformedURLException {
api = service.getMyClientApiV25Port();

TestClassA testClass = api.getTestClassA();
testClass.doA();
}
}


The problem is:
Writing testClass.doA(); returns:




The method doA() is undefined for the type TestClassA




Any suggestions?










share|improve this question























  • It looks like you are trying to make TestClassA a "remote" object like in RMI. This isn't how jaxws works (or webservices in general). The objects returned from a jax-ws service call are simple DTO's.

    – jtahlborn
    Jul 30 '14 at 13:53













  • Thsnks for your answer. Do you know a good way to do that in Web Service. I want that MyClientApiV2_5 will be entry point to different APIs. I don't want to expose all the method s in one class and also not to have several entry points.

    – Sagi S
    Jul 30 '14 at 15:28











  • i don't think there is a way to "link" services in jax-ws. you basically need to have separate entry-points to the separate services. you could have a top-level "service" which has methods which return Strings which are the urls of the other sub-services.

    – jtahlborn
    Jul 30 '14 at 15:36
















0















The question is a little bit long but I wanted to supply all the information in advance



I have the following class:



package test.api.soap.server;

public class TestClassA {

public TestClassA() {

}

public String doA() {
System.out.println("Start doA()");
return "In do A";
}
}


I want to expose it as web service but not directly so i created wrapper class:
package test.api.soap.server;



import javax.jws.WebMethod;
import javax.jws.WebService;

@WebService
public class MyClientApiV2_5 {

public MyClientApiV2_5() {

}

@WebMethod
public TestClassA getTestClassA() {
return new TestClassA();
}
}


I creating the server WSDL using standard wsgen in ant task:



<target name="Create-JAXWS-SOAP-Server">
<echo message="Generate SOAP server stubs" />
<exec executable="${wsgen-cmd}">
<arg value="-verbose" />
<arg value="-classpath" />
<arg value="${build}" />
<arg value="-wsdl" />
<arg value="-d" />
<arg value="${build}" />
<arg value="-r" />
<arg value="wsdl" />
<arg value="-s" />
<arg value="${src}" />
<arg value="-keep" />
<arg value="test.api.soap.server.MyClientApiV2_5" />
</exec>
</target>


The out come are 2 files:
MyClientApiV25Service.wsdl



<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.3-b01-. -->
<definitions targetNamespace="http://server.soap.api.test/" name="MyClientApiV2_5Service" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:tns="http://server.soap.api.test/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<types>
<xsd:schema>
<xsd:import namespace="http://server.soap.api.test/" schemaLocation="MyClientApiV25Service_schema1.xsd"/>
</xsd:schema>
</types>
<message name="getTestClassA">
<part name="parameters" element="tns:getTestClassA"/>
</message>
<message name="getTestClassAResponse">
<part name="parameters" element="tns:getTestClassAResponse"/>
</message>
<portType name="MyClientApiV2_5">
<operation name="getTestClassA">
<input wsam:Action="http://server.soap.api.test/MyClientApiV2_5/getTestClassARequest" message="tns:getTestClassA"/>
<output wsam:Action="http://server.soap.api.test/MyClientApiV2_5/getTestClassAResponse" message="tns:getTestClassAResponse"/>
</operation>
</portType>
<binding name="MyClientApiV2_5PortBinding" type="tns:MyClientApiV2_5">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="getTestClassA">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="MyClientApiV2_5Service">
<port name="MyClientApiV2_5Port" binding="tns:MyClientApiV2_5PortBinding">
<soap:address location="REPLACE_WITH_ACTUAL_URL"/>
</port>
</service>
</definitions>


MyClientApiV25Service_schema1.xsd



<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" targetNamespace="http://server.soap.api.test/" xmlns:tns="http://server.soap.api.test/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="getTestClassA" type="tns:getTestClassA"/>
<xs:element name="getTestClassAResponse" type="tns:getTestClassAResponse"/>
<xs:complexType name="getTestClassA">
<xs:sequence/>
</xs:complexType>
<xs:complexType name="getTestClassAResponse">
<xs:sequence>
<xs:element name="return" type="tns:testClassA" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="testClassA">
<xs:sequence/>
</xs:complexType>
</xs:schema>


I created the client stub:



<target name="Create-JAXWS-SOAP-Client" >
<echo message="Generate SOAP client stubs" />
<exec executable="${wsimport-cmd}">
<arg value="-verbose" />
<arg value="-keep" />
<arg value="-s" />
<arg value="${src}" />
<arg value="-d" />
<arg value="${build}" />
<arg value="-p" />
<arg value="test.api.soap.client.stubs" />
<arg value="wsdlMyClientApiV25Service.wsdl" />
</exec>
</target>


I then write simple client class to get the web service:



package test.api.soap.client;

import java.net.MalformedURLException;
import java.net.URL;

import javax.xml.namespace.QName;

import test.api.soap.client.stubs.MyClientApiV25;
import test.api.soap.client.stubs.MyClientApiV25Service;
import test.api.soap.client.stubs.TestClassA;

public class SampleClient {

private MyClientApiV25 api = null;
static MyClientApiV25Service service;

public SampleClient() throws MalformedURLException {
api = service.getMyClientApiV25Port();

TestClassA testClass = api.getTestClassA();
testClass.doA();
}
}


The problem is:
Writing testClass.doA(); returns:




The method doA() is undefined for the type TestClassA




Any suggestions?










share|improve this question























  • It looks like you are trying to make TestClassA a "remote" object like in RMI. This isn't how jaxws works (or webservices in general). The objects returned from a jax-ws service call are simple DTO's.

    – jtahlborn
    Jul 30 '14 at 13:53













  • Thsnks for your answer. Do you know a good way to do that in Web Service. I want that MyClientApiV2_5 will be entry point to different APIs. I don't want to expose all the method s in one class and also not to have several entry points.

    – Sagi S
    Jul 30 '14 at 15:28











  • i don't think there is a way to "link" services in jax-ws. you basically need to have separate entry-points to the separate services. you could have a top-level "service" which has methods which return Strings which are the urls of the other sub-services.

    – jtahlborn
    Jul 30 '14 at 15:36














0












0








0








The question is a little bit long but I wanted to supply all the information in advance



I have the following class:



package test.api.soap.server;

public class TestClassA {

public TestClassA() {

}

public String doA() {
System.out.println("Start doA()");
return "In do A";
}
}


I want to expose it as web service but not directly so i created wrapper class:
package test.api.soap.server;



import javax.jws.WebMethod;
import javax.jws.WebService;

@WebService
public class MyClientApiV2_5 {

public MyClientApiV2_5() {

}

@WebMethod
public TestClassA getTestClassA() {
return new TestClassA();
}
}


I creating the server WSDL using standard wsgen in ant task:



<target name="Create-JAXWS-SOAP-Server">
<echo message="Generate SOAP server stubs" />
<exec executable="${wsgen-cmd}">
<arg value="-verbose" />
<arg value="-classpath" />
<arg value="${build}" />
<arg value="-wsdl" />
<arg value="-d" />
<arg value="${build}" />
<arg value="-r" />
<arg value="wsdl" />
<arg value="-s" />
<arg value="${src}" />
<arg value="-keep" />
<arg value="test.api.soap.server.MyClientApiV2_5" />
</exec>
</target>


The out come are 2 files:
MyClientApiV25Service.wsdl



<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.3-b01-. -->
<definitions targetNamespace="http://server.soap.api.test/" name="MyClientApiV2_5Service" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:tns="http://server.soap.api.test/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<types>
<xsd:schema>
<xsd:import namespace="http://server.soap.api.test/" schemaLocation="MyClientApiV25Service_schema1.xsd"/>
</xsd:schema>
</types>
<message name="getTestClassA">
<part name="parameters" element="tns:getTestClassA"/>
</message>
<message name="getTestClassAResponse">
<part name="parameters" element="tns:getTestClassAResponse"/>
</message>
<portType name="MyClientApiV2_5">
<operation name="getTestClassA">
<input wsam:Action="http://server.soap.api.test/MyClientApiV2_5/getTestClassARequest" message="tns:getTestClassA"/>
<output wsam:Action="http://server.soap.api.test/MyClientApiV2_5/getTestClassAResponse" message="tns:getTestClassAResponse"/>
</operation>
</portType>
<binding name="MyClientApiV2_5PortBinding" type="tns:MyClientApiV2_5">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="getTestClassA">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="MyClientApiV2_5Service">
<port name="MyClientApiV2_5Port" binding="tns:MyClientApiV2_5PortBinding">
<soap:address location="REPLACE_WITH_ACTUAL_URL"/>
</port>
</service>
</definitions>


MyClientApiV25Service_schema1.xsd



<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" targetNamespace="http://server.soap.api.test/" xmlns:tns="http://server.soap.api.test/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="getTestClassA" type="tns:getTestClassA"/>
<xs:element name="getTestClassAResponse" type="tns:getTestClassAResponse"/>
<xs:complexType name="getTestClassA">
<xs:sequence/>
</xs:complexType>
<xs:complexType name="getTestClassAResponse">
<xs:sequence>
<xs:element name="return" type="tns:testClassA" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="testClassA">
<xs:sequence/>
</xs:complexType>
</xs:schema>


I created the client stub:



<target name="Create-JAXWS-SOAP-Client" >
<echo message="Generate SOAP client stubs" />
<exec executable="${wsimport-cmd}">
<arg value="-verbose" />
<arg value="-keep" />
<arg value="-s" />
<arg value="${src}" />
<arg value="-d" />
<arg value="${build}" />
<arg value="-p" />
<arg value="test.api.soap.client.stubs" />
<arg value="wsdlMyClientApiV25Service.wsdl" />
</exec>
</target>


I then write simple client class to get the web service:



package test.api.soap.client;

import java.net.MalformedURLException;
import java.net.URL;

import javax.xml.namespace.QName;

import test.api.soap.client.stubs.MyClientApiV25;
import test.api.soap.client.stubs.MyClientApiV25Service;
import test.api.soap.client.stubs.TestClassA;

public class SampleClient {

private MyClientApiV25 api = null;
static MyClientApiV25Service service;

public SampleClient() throws MalformedURLException {
api = service.getMyClientApiV25Port();

TestClassA testClass = api.getTestClassA();
testClass.doA();
}
}


The problem is:
Writing testClass.doA(); returns:




The method doA() is undefined for the type TestClassA




Any suggestions?










share|improve this question














The question is a little bit long but I wanted to supply all the information in advance



I have the following class:



package test.api.soap.server;

public class TestClassA {

public TestClassA() {

}

public String doA() {
System.out.println("Start doA()");
return "In do A";
}
}


I want to expose it as web service but not directly so i created wrapper class:
package test.api.soap.server;



import javax.jws.WebMethod;
import javax.jws.WebService;

@WebService
public class MyClientApiV2_5 {

public MyClientApiV2_5() {

}

@WebMethod
public TestClassA getTestClassA() {
return new TestClassA();
}
}


I creating the server WSDL using standard wsgen in ant task:



<target name="Create-JAXWS-SOAP-Server">
<echo message="Generate SOAP server stubs" />
<exec executable="${wsgen-cmd}">
<arg value="-verbose" />
<arg value="-classpath" />
<arg value="${build}" />
<arg value="-wsdl" />
<arg value="-d" />
<arg value="${build}" />
<arg value="-r" />
<arg value="wsdl" />
<arg value="-s" />
<arg value="${src}" />
<arg value="-keep" />
<arg value="test.api.soap.server.MyClientApiV2_5" />
</exec>
</target>


The out come are 2 files:
MyClientApiV25Service.wsdl



<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.3-b01-. -->
<definitions targetNamespace="http://server.soap.api.test/" name="MyClientApiV2_5Service" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:tns="http://server.soap.api.test/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<types>
<xsd:schema>
<xsd:import namespace="http://server.soap.api.test/" schemaLocation="MyClientApiV25Service_schema1.xsd"/>
</xsd:schema>
</types>
<message name="getTestClassA">
<part name="parameters" element="tns:getTestClassA"/>
</message>
<message name="getTestClassAResponse">
<part name="parameters" element="tns:getTestClassAResponse"/>
</message>
<portType name="MyClientApiV2_5">
<operation name="getTestClassA">
<input wsam:Action="http://server.soap.api.test/MyClientApiV2_5/getTestClassARequest" message="tns:getTestClassA"/>
<output wsam:Action="http://server.soap.api.test/MyClientApiV2_5/getTestClassAResponse" message="tns:getTestClassAResponse"/>
</operation>
</portType>
<binding name="MyClientApiV2_5PortBinding" type="tns:MyClientApiV2_5">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="getTestClassA">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="MyClientApiV2_5Service">
<port name="MyClientApiV2_5Port" binding="tns:MyClientApiV2_5PortBinding">
<soap:address location="REPLACE_WITH_ACTUAL_URL"/>
</port>
</service>
</definitions>


MyClientApiV25Service_schema1.xsd



<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" targetNamespace="http://server.soap.api.test/" xmlns:tns="http://server.soap.api.test/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="getTestClassA" type="tns:getTestClassA"/>
<xs:element name="getTestClassAResponse" type="tns:getTestClassAResponse"/>
<xs:complexType name="getTestClassA">
<xs:sequence/>
</xs:complexType>
<xs:complexType name="getTestClassAResponse">
<xs:sequence>
<xs:element name="return" type="tns:testClassA" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="testClassA">
<xs:sequence/>
</xs:complexType>
</xs:schema>


I created the client stub:



<target name="Create-JAXWS-SOAP-Client" >
<echo message="Generate SOAP client stubs" />
<exec executable="${wsimport-cmd}">
<arg value="-verbose" />
<arg value="-keep" />
<arg value="-s" />
<arg value="${src}" />
<arg value="-d" />
<arg value="${build}" />
<arg value="-p" />
<arg value="test.api.soap.client.stubs" />
<arg value="wsdlMyClientApiV25Service.wsdl" />
</exec>
</target>


I then write simple client class to get the web service:



package test.api.soap.client;

import java.net.MalformedURLException;
import java.net.URL;

import javax.xml.namespace.QName;

import test.api.soap.client.stubs.MyClientApiV25;
import test.api.soap.client.stubs.MyClientApiV25Service;
import test.api.soap.client.stubs.TestClassA;

public class SampleClient {

private MyClientApiV25 api = null;
static MyClientApiV25Service service;

public SampleClient() throws MalformedURLException {
api = service.getMyClientApiV25Port();

TestClassA testClass = api.getTestClassA();
testClass.doA();
}
}


The problem is:
Writing testClass.doA(); returns:




The method doA() is undefined for the type TestClassA




Any suggestions?







java web-services soap wsdl jax-ws






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jul 30 '14 at 13:39









Sagi SSagi S

112




112













  • It looks like you are trying to make TestClassA a "remote" object like in RMI. This isn't how jaxws works (or webservices in general). The objects returned from a jax-ws service call are simple DTO's.

    – jtahlborn
    Jul 30 '14 at 13:53













  • Thsnks for your answer. Do you know a good way to do that in Web Service. I want that MyClientApiV2_5 will be entry point to different APIs. I don't want to expose all the method s in one class and also not to have several entry points.

    – Sagi S
    Jul 30 '14 at 15:28











  • i don't think there is a way to "link" services in jax-ws. you basically need to have separate entry-points to the separate services. you could have a top-level "service" which has methods which return Strings which are the urls of the other sub-services.

    – jtahlborn
    Jul 30 '14 at 15:36



















  • It looks like you are trying to make TestClassA a "remote" object like in RMI. This isn't how jaxws works (or webservices in general). The objects returned from a jax-ws service call are simple DTO's.

    – jtahlborn
    Jul 30 '14 at 13:53













  • Thsnks for your answer. Do you know a good way to do that in Web Service. I want that MyClientApiV2_5 will be entry point to different APIs. I don't want to expose all the method s in one class and also not to have several entry points.

    – Sagi S
    Jul 30 '14 at 15:28











  • i don't think there is a way to "link" services in jax-ws. you basically need to have separate entry-points to the separate services. you could have a top-level "service" which has methods which return Strings which are the urls of the other sub-services.

    – jtahlborn
    Jul 30 '14 at 15:36

















It looks like you are trying to make TestClassA a "remote" object like in RMI. This isn't how jaxws works (or webservices in general). The objects returned from a jax-ws service call are simple DTO's.

– jtahlborn
Jul 30 '14 at 13:53







It looks like you are trying to make TestClassA a "remote" object like in RMI. This isn't how jaxws works (or webservices in general). The objects returned from a jax-ws service call are simple DTO's.

– jtahlborn
Jul 30 '14 at 13:53















Thsnks for your answer. Do you know a good way to do that in Web Service. I want that MyClientApiV2_5 will be entry point to different APIs. I don't want to expose all the method s in one class and also not to have several entry points.

– Sagi S
Jul 30 '14 at 15:28





Thsnks for your answer. Do you know a good way to do that in Web Service. I want that MyClientApiV2_5 will be entry point to different APIs. I don't want to expose all the method s in one class and also not to have several entry points.

– Sagi S
Jul 30 '14 at 15:28













i don't think there is a way to "link" services in jax-ws. you basically need to have separate entry-points to the separate services. you could have a top-level "service" which has methods which return Strings which are the urls of the other sub-services.

– jtahlborn
Jul 30 '14 at 15:36





i don't think there is a way to "link" services in jax-ws. you basically need to have separate entry-points to the separate services. you could have a top-level "service" which has methods which return Strings which are the urls of the other sub-services.

– jtahlborn
Jul 30 '14 at 15:36












1 Answer
1






active

oldest

votes


















0














Add the @XmlRootElement annotation. JaxB will then handle marshalling/unmarshalling your complex types. By default, public fields will be bound automatically, but you can also annotate them yourself with @XmlElement.



package test.api.soap.server;

@XmlRootElement
public class TestClassA {

public TestClassA() {

}

public String doA() {
System.out.println("Start doA()");
return "In do A";
}
}





share|improve this answer


























  • Thanks, I will check it tomorrow

    – Sagi S
    Jul 30 '14 at 17:42











  • Sorry :( not working

    – Sagi S
    Jul 30 '14 at 19:01











  • Thanks, I understand that I need to change approach.

    – Sagi S
    Jul 31 '14 at 13:07











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f25038393%2freturn-custom-object-from-web-services-using-jax-ws%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Add the @XmlRootElement annotation. JaxB will then handle marshalling/unmarshalling your complex types. By default, public fields will be bound automatically, but you can also annotate them yourself with @XmlElement.



package test.api.soap.server;

@XmlRootElement
public class TestClassA {

public TestClassA() {

}

public String doA() {
System.out.println("Start doA()");
return "In do A";
}
}





share|improve this answer


























  • Thanks, I will check it tomorrow

    – Sagi S
    Jul 30 '14 at 17:42











  • Sorry :( not working

    – Sagi S
    Jul 30 '14 at 19:01











  • Thanks, I understand that I need to change approach.

    – Sagi S
    Jul 31 '14 at 13:07
















0














Add the @XmlRootElement annotation. JaxB will then handle marshalling/unmarshalling your complex types. By default, public fields will be bound automatically, but you can also annotate them yourself with @XmlElement.



package test.api.soap.server;

@XmlRootElement
public class TestClassA {

public TestClassA() {

}

public String doA() {
System.out.println("Start doA()");
return "In do A";
}
}





share|improve this answer


























  • Thanks, I will check it tomorrow

    – Sagi S
    Jul 30 '14 at 17:42











  • Sorry :( not working

    – Sagi S
    Jul 30 '14 at 19:01











  • Thanks, I understand that I need to change approach.

    – Sagi S
    Jul 31 '14 at 13:07














0












0








0







Add the @XmlRootElement annotation. JaxB will then handle marshalling/unmarshalling your complex types. By default, public fields will be bound automatically, but you can also annotate them yourself with @XmlElement.



package test.api.soap.server;

@XmlRootElement
public class TestClassA {

public TestClassA() {

}

public String doA() {
System.out.println("Start doA()");
return "In do A";
}
}





share|improve this answer















Add the @XmlRootElement annotation. JaxB will then handle marshalling/unmarshalling your complex types. By default, public fields will be bound automatically, but you can also annotate them yourself with @XmlElement.



package test.api.soap.server;

@XmlRootElement
public class TestClassA {

public TestClassA() {

}

public String doA() {
System.out.println("Start doA()");
return "In do A";
}
}






share|improve this answer














share|improve this answer



share|improve this answer








edited Jul 30 '14 at 16:37

























answered Jul 30 '14 at 16:32









mt523mt523

8317




8317













  • Thanks, I will check it tomorrow

    – Sagi S
    Jul 30 '14 at 17:42











  • Sorry :( not working

    – Sagi S
    Jul 30 '14 at 19:01











  • Thanks, I understand that I need to change approach.

    – Sagi S
    Jul 31 '14 at 13:07



















  • Thanks, I will check it tomorrow

    – Sagi S
    Jul 30 '14 at 17:42











  • Sorry :( not working

    – Sagi S
    Jul 30 '14 at 19:01











  • Thanks, I understand that I need to change approach.

    – Sagi S
    Jul 31 '14 at 13:07

















Thanks, I will check it tomorrow

– Sagi S
Jul 30 '14 at 17:42





Thanks, I will check it tomorrow

– Sagi S
Jul 30 '14 at 17:42













Sorry :( not working

– Sagi S
Jul 30 '14 at 19:01





Sorry :( not working

– Sagi S
Jul 30 '14 at 19:01













Thanks, I understand that I need to change approach.

– Sagi S
Jul 31 '14 at 13:07





Thanks, I understand that I need to change approach.

– Sagi S
Jul 31 '14 at 13:07




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f25038393%2freturn-custom-object-from-web-services-using-jax-ws%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

List item for chat from Array inside array React Native

Jo Brand

Thiostrepton