[jboss-user] [JBossWS] - Return value for Java bean always empty

lowecg2004 do-not-reply at jboss.com
Fri Oct 20 04:54:58 EDT 2006


Hello,

I'm trying to set up a simple web service that returns a StockData object that has 4 properties.  From my client, I can invoke the service and I can step through the method in the debugger and see that an object is created and populated.  However, when the method returns at the client the object is null.

The endpoint in a JSR 181 EJB3:

Interface:
  | 
  | @Remote
  | public interface WeatherService {
  |   public StockData getStockData(String title);
  | }
  | 
  | Implementation:
  | 
  | @WebService(name = "WeatherService", targetNamespace = "http://org.test", serviceName = "WeatherService")
  | @SOAPBinding(style = SOAPBinding.Style.RPC)
  | @Stateless
  | @Remote(WeatherService.class)
  | @RemoteBinding(jndiBinding = "/ejb3/EJB3EndpointInterface")
  | public class WeatherServiceBean implements WeatherService {
  |   @WebMethod
  |   public StockData getStockData(final String title) {
  |     StockData stockData = new StockData(title, 1, 234, true);
  |     return stockData;
  |   }
  | }
  | 
  | 
  | SOAP Request:
  | 
  | <soapenv:Envelope
  |     xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  |    <soapenv:Body>
  |       <s0:getStockData
  |           xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
  |           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  |           xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  |           xmlns:s0="http://org.test">
  |          <String_1>SomeTitle</String_1>
  |       </s0:getStockData>
  |    </soapenv:Body>
  | </soapenv:Envelope>
  | 
  | SOAP Respose:
  | 
  | <env:Envelope
  |     xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
  |    <env:Header />
  |    <env:Body>
  |       <ns1:getStockDataResponse xmlns:ns1="http://org.test">
  |          <result xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
  |       </ns1:getStockDataResponse>
  |    </env:Body>
  | </env:Envelope>
  | 
  | 
  | The generated WSDL from calling http://dfvgm71j:8080/WebServiceEJB/WeatherServiceBean?WSDL:
  | 
  | <definitions name="WeatherService"
  |                   targetNamespace="http://org.test" 
  |                   xmlns="http://schemas.xmlsoap.org/wsdl/" 
  |                   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
  |                   xmlns:tns="http://org.test" 
  |                   xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  |  <types>
  |   <schema elementFormDefault="qualified"
  |                  targetNamespace="http://org.test" 
  |                  xmlns="http://www.w3.org/2001/XMLSchema" 
  |                  xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/" 
  |                  xmlns:tns="http://org.test" 
  |                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  |    <complexType name="StockData">
  |     <sequence/>
  |    </complexType>
  |   </schema>
  |  </types>
  |  <message name="WeatherService_getStockDataResponse">
  |   <part name="result" type="tns:StockData"/>
  |  </message>
  |  <message name="WeatherService_getStockData">
  |   <part name="String_1" type="xsd:string"/>
  |  </message>
  |  <portType name="WeatherService">
  |   <operation name="getStockData" parameterOrder="String_1">
  |    <input message="tns:WeatherService_getStockData"/>
  |    <output message="tns:WeatherService_getStockDataResponse"/>
  |   </operation>
  |  </portType>
  |  <binding name="WeatherServiceBinding" type="tns:WeatherService">
  |   <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
  |   <operation name="getStockData">
  |    <soap:operation soapAction=""/>
  |    <input>
  |     <soap:body namespace="http://org.test" use="literal"/>
  |    </input>
  |    <output>
  |     <soap:body namespace="http://org.test" use="literal"/>
  |    </output>
  |   </operation>
  |  </binding>
  |  <service name="WeatherService">
  |   <port binding="tns:WeatherServiceBinding" name="WeatherServicePort">
  |    <soap:address location="http://DFVGM71J:8080/WebServiceEJB/WeatherServiceBean"/>
  |   </port>
  |  </service>
  | </definitions>


I can't work this out.  If I change the return type to a String then my client gets the value.  What am I doing wrong?

Chris.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3979588#3979588

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3979588



More information about the jboss-user mailing list