- This topic has 2 replies, 2 voices, and was last updated 17 years, 4 months ago by rkm258.
-
AuthorPosts
-
patel_123Memberhi
i am trying to return list of objects from my web sevice.I am using myeclipse 5.5M2 IDE.
This is my webservice code:
@WebMethod()
public List<CustomerInfo> getAccountList()
{
Query query=em.createQuery(“from CustomerInfo c”);
List<CustomerInfo>list=query.getResultList();return list;
}But the problem is at the client side.My eclipse provides wizard to create client automatically.
when i tried to access the above web method the return type is marked as void at the EndpointInterface.But actually it is retuning List..
could anybody tell me where i went wrong?
patel_123Memberwell this is generated WSDL file,
<definitions name=”CustomerRegisteration” targetNamespace=”http://wb1-329:8080″ xmlns=”http://schemas.xmlsoap.org/wsdl/” xmlns:ns1=”http://customer/jaws” xmlns:soap=”http://schemas.xmlsoap.org/wsdl/soap/” xmlns:tns=”http://wb1-329:8080″ xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>
– <types>
– <schema elementFormDefault=”qualified” targetNamespace=”http://wb1-329:8080″ xmlns=”http://www.w3.org/2001/XMLSchema” xmlns:ns2=”http://customer/jaws” xmlns:soap11-enc=”http://schemas.xmlsoap.org/soap/encoding/” xmlns:tns=”http://wb1-329:8080″ xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”>
<import namespace=”http://customer/jaws” />
– <complexType name=”check”>
<sequence />
</complexType>
– <complexType name=”checkResponse”>
<sequence />
</complexType>
– <complexType name=”getAccountInfo”>
– <sequence>
<element name=”int_1″ type=”int” />
</sequence>
</complexType>
– <complexType name=”getAccountInfoResponse”>
– <sequence>
<element name=”result” nillable=”true” type=”ns2:customerBean” />
</sequence>
</complexType>
– <complexType name=”getAccountList”>
<sequence />
</complexType>
– <complexType name=”getAccountListResponse”>
<sequence />
</complexType>
<element name=”check” type=”tns:check” />
<element name=”checkResponse” type=”tns:checkResponse” />
<element name=”getAccountInfo” type=”tns:getAccountInfo” />
<element name=”getAccountInfoResponse” type=”tns:getAccountInfoResponse” />
<element name=”getAccountList” type=”tns:getAccountList” />
<element name=”getAccountListResponse” type=”tns:getAccountListResponse” />
</schema>
– <schema elementFormDefault=”qualified” targetNamespace=”http://customer/jaws” xmlns=”http://www.w3.org/2001/XMLSchema” xmlns:ns1=”http://wb1-329:8080″ xmlns:soap11-enc=”http://schemas.xmlsoap.org/soap/encoding/” xmlns:tns=”http://customer/jaws” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”>
<import namespace=”http://wb1-329:8080″ />
– <complexType name=”customerBean”>
– <sequence>
<element name=”accountId” nillable=”true” type=”int” />
<element name=”activeDate” nillable=”true” type=”string” />
<element name=”address” nillable=”true” type=”string” />
<element name=”age” nillable=”true” type=”int” />
<element name=”annualIncome” nillable=”true” type=”int” />
<element name=”city” nillable=”true” type=”string” />
<element name=”createdDate” nillable=”true” type=”string” />
<element name=”emailId” nillable=”true” type=”string” />
<element name=”firstname” nillable=”true” type=”string” />
<element name=”greencardHolder” nillable=”true” type=”short” />
<element name=”lastname” nillable=”true” type=”string” />
<element name=”occupation” nillable=”true” type=”string” />
<element name=”phoneNumber” nillable=”true” type=”string” />
<element name=”state” nillable=”true” type=”string” />
<element name=”status” nillable=”true” type=”string” />
<element name=”zip” nillable=”true” type=”int” />
</sequence>
</complexType>
</schema>
</types>
– <message name=”EndpointInterface_getAccountList”>
<part element=”tns:getAccountList” name=”parameters” />
</message>
– <message name=”EndpointInterface_getAccountInfo”>
<part element=”tns:getAccountInfo” name=”parameters” />
</message>
– <message name=”EndpointInterface_check”>
<part element=”tns:check” name=”parameters” />
</message>
– <message name=”EndpointInterface_checkResponse”>
<part element=”tns:checkResponse” name=”result” />
</message>
– <message name=”EndpointInterface_getAccountListResponse”>
<part element=”tns:getAccountListResponse” name=”result” />
</message>
– <message name=”EndpointInterface_getAccountInfoResponse”>
<part element=”tns:getAccountInfoResponse” name=”result” />
</message>
– <portType name=”EndpointInterface”>
– <operation name=”check”>
<input message=”tns:EndpointInterface_check” />
<output message=”tns:EndpointInterface_checkResponse” />
</operation>
– <operation name=”getAccountInfo”>
<input message=”tns:EndpointInterface_getAccountInfo” />
<output message=”tns:EndpointInterface_getAccountInfoResponse” />
</operation>
– <operation name=”getAccountList”>
<input message=”tns:EndpointInterface_getAccountList” />
<output message=”tns:EndpointInterface_getAccountListResponse” />
</operation>
</portType>
– <binding name=”EndpointInterfaceBinding” type=”tns:EndpointInterface”>
<soap:binding style=”document” transport=”http://schemas.xmlsoap.org/soap/http” />
– <operation name=”check”>
<soap:operation soapAction=”” />
– <input>
<soap:body use=”literal” />
</input>
– <output>
<soap:body use=”literal” />
</output>
</operation>
– <operation name=”getAccountInfo”>
<soap:operation soapAction=”” />
– <input>
<soap:body use=”literal” />
</input>
– <output>
<soap:body use=”literal” />
</output>
</operation>
– <operation name=”getAccountList”>
<soap:operation soapAction=”” />
– <input>
<soap:body use=”literal” />
</input>
– <output>
<soap:body use=”literal” />
</output>
</operation>
</binding>
– <service name=”CustomerRegisteration”>
– <port binding=”tns:EndpointInterfaceBinding” name=”EndpointInterfacePort”>
<soap:address location=”http://wb1-329:8080/CustomerRegistrationEJB” />
</port>
</service>
</definitions>
rkm258MemberIf u sees the <sequence> for the type of getAccountListResponse in <types> it is empty that’a the reason the client side will not understand what type of result is this.
Have u used the class as a setter and getter with properties then ur result will be like
<xsd:element name=”getExtendedSearchResponse”>
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs=”1″ minOccurs=”1″ name=”OfficeTypeList” nillable=”true” type=”tns:ArrayOfSearchByOffcType”/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>where array is another type with it’s own type. In this case it is returning a list with objects of type SearchByOffcType.
reply for any concerns
-
AuthorPosts