facebook

Reg: Web Service Operations using or returning complex types

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MyEclipse Archived
  2.  > 
  3. Web Services
Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #271693 Reply

    rkm258
    Member

    Hi,

    Developing web services was made really easy here when compared to what i did using weblogic ant tasks.
    My problem is regarding the use of COMPLEX TYPES LIKE OBJECTS OF A CLASS FOR SERVICE OPERATIONS, FOR USING THEM OR RETURNING THEM. Is there any thing more needed to be done other than what has been specified at
    http://myeclipseide.com/enterpriseworkbench/help/index.jsp for web services development from bottum up.

    I’am getting validation errors on using objects of a class as return type.

    PLEASE HELP ME FOR SOME DOCUMENTATION IN THIS REGARD.

    thanks ram

    #271729

    Riyad Kalla
    Member

    Ram,
    Unfortunately i don’t understand the question… do you have some concrete examples of the issue?

    #271733

    rkm258
    Member

    Hi,

    I have a Class say Office that has all the properties filled up by the service operation and returned by it like below

    The Class object returned by the Service Operation is

    public class Office
    {
    public int contact;
    public String deptname;
    }

    The service Impl is like

    public class OfficeSetupHierServiceImpl implements IOfficeSetupHierService {
    public Office getDetails(int deptid)
    {
    //get the office details populated in the Office object and return it.
    }
    }

    Where the OfficeSetupHierServiceImp is the service implementation and IOfficeSetupHierService is the service interface.

    I did this following the simple webservice development from bottum up approach as given in the help http://myeclipseide.com/enterpriseworkbench/help/index.jsp but there is validation error on using it with web service explorer.

    Since i’am not using any collections and other complex types i did not put any aegis mapping files, assuming that defauls bidings will be used.

    Also help me regarding documentation for using complex types,lists,collections and class objects in service operations as parameter or return types, in the same way as this sample code does.

    I’am not sure if any thing else has to be done when using types other than the basic types.

    Thanks for reply
    looking forward
    ram

    #271754

    Riyad Kalla
    Member

    Ram,
    What are the validation errors you get?

    #271765

    rkm258
    Member

    Hi,

    Below is the error I’am getting:

    Error resolving component ‘ns1:Office’. It was detected that ‘ns1:Office’ is in
    namespace ‘http://office.hr.com’, but components from this namespace are not
    referenceable from schema document ‘http://localhost:8080/ELMSServ/services/OfficeSet’

    The WSDL is

    <?xml version=”1.0″ encoding=”UTF-8″?>
    <wsdl:definitions targetNamespace=”http://service.hr.com&#8221; xmlns:tns=”http://service.hr.com&#8221; xmlns:wsdlsoap=”http://schemas.xmlsoap.org/wsdl/soap/&#8221; xmlns:soap12=”http://www.w3.org/2003/05/soap-envelope&#8221; xmlns:ns1=”http://office.hr.com&#8221; xmlns:xsd=”http://www.w3.org/2001/XMLSchema&#8221; xmlns:soapenc11=”http://schemas.xmlsoap.org/soap/encoding/&#8221; xmlns:soapenc12=”http://www.w3.org/2003/05/soap-encoding&#8221; xmlns:soap11=”http://schemas.xmlsoap.org/soap/envelope/&#8221; xmlns:wsdl=”http://schemas.xmlsoap.org/wsdl/”&gt;
    <wsdl:types>
    <xsd:schema xmlns:xsd=”http://www.w3.org/2001/XMLSchema&#8221; attributeFormDefault=”qualified” elementFormDefault=”qualified” targetNamespace=”http://service.hr.com”&gt;
    <xsd:element name=”getDetails”>
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element maxOccurs=”1″ minOccurs=”1″ name=”in0″ type=”xsd:int”/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name=”getDetailsResponse”>
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element maxOccurs=”1″ minOccurs=”1″ name=”out” nillable=”true” type=”ns1:Office”/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>
    <xsd:schema xmlns:xsd=”http://www.w3.org/2001/XMLSchema&#8221; attributeFormDefault=”qualified” elementFormDefault=”qualified” targetNamespace=”http://office.hr.com”&gt;
    <xsd:complexType name=”Office”/>
    </xsd:schema>
    </wsdl:types>
    <wsdl:message name=”getDetailsResponse”>
    <wsdl:part name=”parameters” element=”tns:getDetailsResponse”>
    </wsdl:part>
    </wsdl:message>
    <wsdl:message name=”getDetailsRequest”>
    <wsdl:part name=”parameters” element=”tns:getDetails”>
    </wsdl:part>
    </wsdl:message>
    <wsdl:portType name=”OfficeSetupHierServicePortType”>
    <wsdl:operation name=”getDetails”>
    <wsdl:input name=”getDetailsRequest” message=”tns:getDetailsRequest”>
    </wsdl:input>
    <wsdl:output name=”getDetailsResponse” message=”tns:getDetailsResponse”>
    </wsdl:output>
    </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name=”OfficeSetupHierServiceHttpBinding” type=”tns:OfficeSetupHierServicePortType”>
    <wsdlsoap:binding style=”document” transport=”http://schemas.xmlsoap.org/soap/http”/&gt;
    <wsdl:operation name=”getDetails”>
    <wsdlsoap:operation soapAction=””/>
    <wsdl:input name=”getDetailsRequest”>
    <wsdlsoap:body use=”literal”/>
    </wsdl:input>
    <wsdl:output name=”getDetailsResponse”>
    <wsdlsoap:body use=”literal”/>
    </wsdl:output>
    </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name=”OfficeSetupHierService”>
    <wsdl:port name=”OfficeSetupHierServiceHttpPort” binding=”tns:OfficeSetupHierServiceHttpBinding”>
    <wsdlsoap:address location=”http://localhost:8080/ELMSServ/services/OfficeSetupHierService”/&gt;
    </wsdl:port>
    </wsdl:service>
    </wsdl:definitions>

    ALSO HERE ARE THE OFFICE CLASS, SERVICE IMPL AND SERVICE INTERFACE

    package com.hr.office;
    public class Office {
    public int deptid;
    public String ownership;
    }

    ————————————————————————————–
    package com.hr.service;
    //Generated by MyEclipse

    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import com.hr.office.Office;

    public class OfficeSetupHierServiceImpl implements IOfficeSetupHierService {

    private Connection con;
    private Statement stm;

    public OfficeSetupHierServiceImpl()
    {
    try
    {
    con=DriverManager.getConnection(“jdbc:microsoft:sqlserver://10.10.60.50:1433;DatabaseName=OfficeSetup”,”WebTrans_App”,”ChangeMe”);
    stm=con.createStatement();
    }
    catch(Exception e)
    {
    e.printStackTrace();
    }
    }
    public Office getDetails(int deptid)
    {
    ResultSet rs;
    try
    {
    rs=stm.executeQuery(“SELECT office_gl_Dep_id,orgz_ownership_desc_txt FROM dbo.vw_office_setup_hier WHERE office_gl_Dep_id=”+deptid);
    rs.next();
    //return(rs.getString(“orgz_ownership_desc_txt”));
    Office o=new Office();
    o.deptid=rs.getInt(“office_gl_Dep_id”);
    o.ownership=rs.getString(“orgz_ownership_desc_txt”);
    return o;
    }
    catch(Exception e)
    {
    e.printStackTrace();
    return null;
    }

    }
    /*public String getService(int deptid)
    {

    }*/

    }

    —————————————————————————
    package com.hr.service;
    //Generated by MyEclipse
    import com.hr.office.Office;

    public interface IOfficeSetupHierService {

    public Office getDetails(int deptid);
    //public String getService(int deptid);
    }

    ———————————————————————————————————
    I HAD EVEN PUT THE MAPPING AEGIS XML FOR SERVICE INTERFACE AS I WAS NOT SURE WHERE THE PROBLEM WAS

    <?xml version=”1.0″ encoding=”UTF-8″?>
    <mappings>
    <mapping>
    <method name=”getDetails”>
    <return-type componentType=”com.hr.office.Office”/>
    <parameter index=”0″ class=”int”/>
    </method>
    </mapping>
    </mappings>

    #271772

    rkm258
    Member

    Above are the WSDL,Service Interface,Service Impl and a bean Office that i used.

    I tried generating the web service client using the web service client generation option but there seems to be these validation errors
    are making the Office class to be empty.
    —————————————————————————————————
    I also tried running the service using the client code within the service project and not using the Web service client generation
    like below, where the Service Interface and the Office bean class are in the classpath

    public static void main(String[] args) {
    // TODO Auto-generated method stub
    Service srvcModel = new
    ObjectServiceFactory().create(IOfficeSetupHierService.class);
    XFireProxyFactory factory =
    new XFireProxyFactory(XFireFactory.newInstance().getXFire());
    String helloWorldURL =
    http://localhost:8080/ELMSServ/services/OfficeSetupHierService&#8221;;
    try {
    IOfficeSetupHierService srvc = (IOfficeSetupHierService)factory.create(srvcModel, helloWorldURL);
    //String result = srvc.example(“hello world”);
    Office o=srvc.getDetails(1008);
    System.out.println(o.deptid);
    System.out.println(o.ownership);
    //System.out.print(result);
    } catch (Exception e) {
    e.printStackTrace();
    }

    }
    In this case the service is getting executed but the client is not receiving the values of the properties.

    #271773

    rkm258
    Member

    I’AM SORRY I MISSED A PORTION OF THE VALIDATION ERROR.

    THE EXACT VALIDATION ERROR IS AS BELOW

    Error resolving component ‘ns1:Office’. It was detected that ‘ns1:Office’ is in
    namespace ‘http://office.hr.com&#8217;, but components from this namespace are not
    referenceable from schema document ‘http://localhost:8080/ELMSServ/services/OfficeSetHierService?WSDL.
    If this is the incorrect namespace, perhaps the prefix of ‘ns1:Office’ needs to be changed.
    If this is the correct namespace then an appropriate import tag should be added to
    http://localhost:8080/ELMSServ/services/OfficeSetHierService?WSDL.

    #271775

    rkm258
    Member

    Well after putting the Office under same namespace as tns:Office, i.e putting the Office in the same package as the service, below is the
    error i’am getting for validation.

    WS-I: A problem occured while running the WS-I WSDL conformance check: org.eclipse.wst.wsi.internal.analyzer.WSIAnalyzerException:
    The WS-I Test Assertion Document(TAD) document was either not found or could not be processed.
    The WSDL Analyzer was unable to validate the given WSDL File.

    AS A NOTE I WOULD LIKE TO REMIND THAT WHEN THE CLIENT IS RUN IN THE SAME PROJECT WORKSPACE AS THE SERVICE I.E WITHOUT USING THE WEB SERVICE CLIENT GENERATION THE SERVER WEB SERVICE SEEMS TO BE RUNNING BUT THE OBJECT OBTAINED AT THE CLIENT IS NOT CONTAINING ANY PROPERTY VALUES IN IT.

    Waiting for ur help
    Thanks

    #271778

    rkm258
    Member

    Let me know if u need anything else. I need to solve this problem to move ahead in my work.

    Thanks for your help in advance

    #271783

    Riyad Kalla
    Member

    Ram,
    This is a bit over my head, I’ve sent your issue ot someone on the dev team to take a look at when they had a chance.

    #271784

    Brian Fernandes
    Moderator

    Ram,

    A few questions:

    1) What version of MyEclipse are you using?

    2) Can you please paste your services.xml file here?

    3) You mentioned that you were generating a bottom up webservice (code first). Later you pasted a WSDL file – where did you get this file? Just so that we are on the same page, could you please restate your current approach for generating the services; are you generating them from a WSDL or from a java classes? If the former is true, then could you please paste the latest version of the WSDL file here?

    Sorry for the inconvenience caused, but it is hard to get a grip your current position with so many posts.

    #271806

    rkm258
    Member

    Hi Brain,

    Donot be sorry, I will restate everything i have done again clearly.
    ——————————————————————
    Requirement
    My requirement is to return a Class Object (Office in my case) whose properties (varaibles) are filled with some values and returned by the service operation.
    ——————————————————————
    Version
    Below are the installation details of the my eclipse
    *** Date:
    Wednesday, June 20, 2007 8:56:35 AM CDT

    ** System properties:
    OS=Windows2003
    OS version=5.2
    Java version=1.5.0_12

    *** MyEclipse details:
    MyEclipse Enterprise Workbench
    Version: 5.5.1 GA
    Build id: 20070521-5.5.1-GA

    *** Eclipse details:
    Eclipse SDK

    Version: 3.2.2
    Build id: M20070212-1330

    Eclipse Platform

    Version: 3.2.2.r322_v20070119-RQghndJN8IM0MsK
    Build id: M20070212-1330

    Eclipse Java Development Tools

    Version: 3.2.2.r322_v20070104-R4CR0Znkvtfjv9-
    Build id: M20070212-1330

    Eclipse Graphical Editing Framework

    Version: 3.2.0.v20060626
    Build id: 20070208-1315

    Eclipse RCP

    Version: 3.2.2.r322_v20070104-8pcviKVqd8J7C1U
    Build id: M20070212-1330

    Eclipse Plug-in Development Environment

    Version: 3.2.1.r321_v20060823-6vYLLdQ3Nk8DrFG
    Build id: M20070212-1330

    Eclipse Project SDK

    Version: 3.2.2.r322_v20070104-dCGKm0Ln38lm-8s
    Build id: M20070212-1330

    Eclipse Graphical Editing Framework

    Version: 3.2.2.v20070208
    Build id: 20070208-1315

    Eclipse startup command=-os
    win32
    -ws
    win32
    -arch
    x86
    -launcher
    E:\eclipse\eclipse\eclipse.exe
    -name
    Eclipse
    -showsplash
    600
    -exitdata
    1210_6c
    -vm
    C:\Program Files\Java\jdk1.5.0_12\bin\javaw.exe

    ———————————————————————-

    Procedure For developing the services by bottum up approach:
    1. First i created the web service project.
    2. Created a Web service with Service Interface and Service Impl as below
    //The Service Interface
    package com.hr.service;
    //Generated by MyEclipse
    import com.hr.service.Office;

    public interface IOfficeSetupHierService {
    public Office getDetails(int deptid);
    }

    //The service Implementation

    package com.hr.service;
    //Generated by MyEclipse

    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import com.hr.service.Office;

    public class OfficeSetupHierServiceImpl implements IOfficeSetupHierService {
    private Connection con;
    private Statement stm;
    public OfficeSetupHierServiceImpl()
    {
    try
    {
    con=DriverManager.getConnection(“URL”);
    stm=con.createStatement();
    }
    catch(Exception e)
    {
    e.printStackTrace();
    }
    }
    public Office getDetails(int deptid)
    {
    ResultSet rs;
    try
    {
    rs=stm.executeQuery(“SELECT office_gl_Dep_id,orgz_ownership_desc_txt FROM dbo.vw_office_setup_hier WHERE office_gl_Dep_id=”+deptid);
    rs.next();
    //return(rs.getString(“orgz_ownership_desc_txt”));
    Office o=new Office();
    o.deptid=rs.getInt(“office_gl_Dep_id”);
    o.ownership=rs.getString(“orgz_ownership_desc_txt”);

    System.out.println(“GOT INTO OFFICE “+o.deptid+” “+o.ownership);
    return o;
    }
    catch(Exception e)
    {
    // System.out.println(“ERROR”);
    e.printStackTrace();
    return null;
    }

    }
    }

    ——————————————————————————

    The Office Class that i returned from the service Implemation class is as below

    package com.hr.service;
    public class Office {
    public int deptid;
    public String ownership;
    }

    ———————————————————————————-
    The Wsdl that was generated is as below. I cannot see the WSDL file as it might have been auto generated on the fly but by browsing
    to http://localhost:8080/ELMSServ/services/OfficeSetupHierService?wsdl, below is the WSDL generated

    <?xml version=”1.0″ encoding=”UTF-8″?>
    <wsdl:definitions targetNamespace=”http://service.hr.com&#8221; xmlns:tns=”http://service.hr.com&#8221; xmlns:wsdlsoap=”http://schemas.xmlsoap.org/wsdl/soap/&#8221; xmlns:soap12=”http://www.w3.org/2003/05/soap-envelope&#8221; xmlns:xsd=”http://www.w3.org/2001/XMLSchema&#8221; xmlns:soapenc11=”http://schemas.xmlsoap.org/soap/encoding/&#8221; xmlns:soapenc12=”http://www.w3.org/2003/05/soap-encoding&#8221; xmlns:soap11=”http://schemas.xmlsoap.org/soap/envelope/&#8221; xmlns:wsdl=”http://schemas.xmlsoap.org/wsdl/”&gt;
    <wsdl:types>
    <xsd:schema xmlns:xsd=”http://www.w3.org/2001/XMLSchema&#8221; attributeFormDefault=”qualified” elementFormDefault=”qualified” targetNamespace=”http://service.hr.com”&gt;
    <xsd:element name=”getDetails”>
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element maxOccurs=”1″ minOccurs=”1″ name=”in0″ type=”xsd:int”/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:complexType name=”Office”/>
    <xsd:element name=”getDetailsResponse”>
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element maxOccurs=”1″ minOccurs=”1″ name=”out” nillable=”true” type=”tns:Office”/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>
    </wsdl:types>
    <wsdl:message name=”getDetailsResponse”>
    <wsdl:part name=”parameters” element=”tns:getDetailsResponse”>
    </wsdl:part>
    </wsdl:message>
    <wsdl:message name=”getDetailsRequest”>
    <wsdl:part name=”parameters” element=”tns:getDetails”>
    </wsdl:part>
    </wsdl:message>
    <wsdl:portType name=”OfficeSetupHierServicePortType”>
    <wsdl:operation name=”getDetails”>
    <wsdl:input name=”getDetailsRequest” message=”tns:getDetailsRequest”>
    </wsdl:input>
    <wsdl:output name=”getDetailsResponse” message=”tns:getDetailsResponse”>
    </wsdl:output>
    </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name=”OfficeSetupHierServiceHttpBinding” type=”tns:OfficeSetupHierServicePortType”>
    <wsdlsoap:binding style=”document” transport=”http://schemas.xmlsoap.org/soap/http”/&gt;
    <wsdl:operation name=”getDetails”>
    <wsdlsoap:operation soapAction=””/>
    <wsdl:input name=”getDetailsRequest”>
    <wsdlsoap:body use=”literal”/>
    </wsdl:input>
    <wsdl:output name=”getDetailsResponse”>
    <wsdlsoap:body use=”literal”/>
    </wsdl:output>
    </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name=”OfficeSetupHierService”>
    <wsdl:port name=”OfficeSetupHierServiceHttpPort” binding=”tns:OfficeSetupHierServiceHttpBinding”>
    <wsdlsoap:address location=”http://localhost:8080/ELMSServ/services/OfficeSetupHierService”/&gt;
    </wsdl:port>
    </wsdl:service>
    </wsdl:definitions>

    ——————————————————————————————–

    Client code : I used two ways to write the client

    1. Test Client within the same project as the service and thus without using the web service client generator.

    IN THIS CASE WHAT I OBSERVED WAS THAT THE SERVICE WAS RUNNING BUT THE OFFICE OBJECT I RETURNED AND OBTAINED AT THE CLIENT WAS NOT CONTAINING ANY PROPERTY (VARIABLE) VALUES IN IT.

    THE PROBLEM IS I THINK IN REGARD TO THE MAPPING FOR THIS OFFICE TYPE CLASS. IS THERE A WAY I CAN SEE THE SOAP MESSAGES GOING UNDER.

    package com.client;

    import org.codehaus.xfire.service.Service;
    import org.codehaus.xfire.service.binding.ObjectServiceFactory;
    import org.codehaus.xfire.client.XFireProxyFactory;
    import org.codehaus.xfire.XFireFactory;
    import com.hr.service.IOfficeSetupHierService;
    import com.hr.service.Office;
    public class Client {

    /**
    * @param args
    */
    public static void main(String[] args) {
    // TODO Auto-generated method stub
    Service srvcModel = new
    ObjectServiceFactory().create(IOfficeSetupHierService.class);
    XFireProxyFactory factory =
    new XFireProxyFactory(XFireFactory.newInstance().getXFire());
    String helloWorldURL =
    http://localhost:8080/ELMSServ/services/OfficeSetupHierService&#8221;;
    try {
    IOfficeSetupHierService srvc = (IOfficeSetupHierService)factory.create(srvcModel, helloWorldURL);
    //String result = srvc.example(“hello world”);
    Office o=srvc.getDetails(1008);
    System.out.println(o.deptid);
    System.out.println(o.ownership);
    //System.out.print(result);
    } catch (Exception e) {
    e.printStackTrace();
    }

    2. The second approach i used was regarding the web service client genrator option
    In this case the client classes are not created properly due to the below validation error.

    WS-I: A problem occured while running the WS-I WSDL conformance check: org.eclipse.wst.wsi.internal.analyzer.WSIAnalyzerException:
    The WS-I Test Assertion Document(TAD) document was either not found or could not be processed.
    The WSDL Analyzer was unable to validate the given WSDL File.

    ——————————————————————————

    I even wrote the aegis mapping files as below for the service interface and my Office bean and put them in the same folder as the classes

    //mapping for the Office class
    <?xml version=”1.0″ encoding=”UTF-8″?>
    <mappings>
    <mapping>
    <property name=”deptid” class=”int”/>
    <property name=”ownership” componentType=”java.lang.String”/>
    </mapping>
    </mappings>

    //Mapping for the service interface

    <?xml version=”1.0″ encoding=”UTF-8″?>
    <mappings xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221;
    xsi:schemaLocation=”http://xfire.codehaus.org/schemas/1.0/mapping.xsd”&gt;
    <mapping>
    <method name=”getDetails”>
    <return-type componentType=”com.hr.service.Office”/>
    <parameter index=”0″ class=”int”/>
    </method>
    </mapping>
    </mappings>
    ——————————————————————————-

    The services.xml file is below

    <?xml version=”1.0″ encoding=”UTF-8″?>
    <beans xmlns=”http://xfire.codehaus.org/config/1.0″&gt;

    <service>
    <name>OfficeSetupHierService</name>
    <serviceClass>
    com.hr.service.IOfficeSetupHierService
    </serviceClass>
    <implementationClass>
    com.hr.service.OfficeSetupHierServiceImpl
    </implementationClass>
    <style>wrapped</style>
    <use>literal</use>
    <scope>application</scope>
    </service></beans>

    ——————————————————————————-
    My concern:

    The client that i have written without using the web service client genrator, that is within the same project space as the service
    should atleast run correctly as the service is running and returning the object. I’am not sure if the mapping for this Office type was good enough.

    ALSO LET ME KNOW IF THERE IS ANY DOCUMENTATION ON USING OR RETURNING CLASS OBJECTS,COLLECTIONS,LISTS AND MAP FROM SERVICE OPERATIONS THAT I CAN LOOK AT.
    ——————————————————————–

    Looking forward for your reply

    Thanks
    Ram

    #271813

    rkm258
    Member

    Hi,

    IT SEEMS I SOLVED THE PROBLEM.

    Anyway can you let me know what to do when a Collection,Hashmap or some other complex types are used.
    If exists, can anyone give me the links to these resoureces.

    Thanks.
    Ram

    #271840

    Riyad Kalla
    Member

    Ram,
    Please let us know how you solved the issue incase others run into the same problem.

    Also I don’t have any tips for you when working with Collection types… try checking the XFire docs or forums for specifics (we are outside the realm of my understanding of Web Services unfortunately)

    #271971

    rkm258
    Member

    Hi,

    I’am sorry i did not post the solution. Having not been through the XFire entirely,I did a small mistake in understading the usage of it’s default binding.

    The XFire uses default binding of Aegis that maps XML to POJO. So having used a Class object in the Service operation, the Class should be in POJO style like that of Hibernate, that is setters and getters.

    Also on using Arrays,Array of objects and objects in general the aegis.xml file need not be defined. But on using Collections like Map the aegis.xml file has to be defined as below for the corresponding class or service, where componenttype is the package path to the Class.

    <mappings xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221;
    xsi:schemaLocation=”http://xfire.codehaus.org/schemas/1.0/mapping.xsd”&gt;
    <mapping>
    <method name=”getMap”>
    <return-type mappedName=”OfficeMap” keyType=”java.lang.String” componentType=”com.hr.service.Office”/>
    </method>
    </mapping>
    </mappings>

    This aegis.xml file should be named as <Classname>.aegis.xml and placed in the same folder as the class.Also it has to be defined for the Service Interface and any other Supporting Classses that might have been used for some complex types like collections.

    Several other controlling features of the mappings thus the SOAP messages can be seen at the XFire site.

    At last i would like to say that using myeclipse has really helped me in reducing my coding time and it is very useful as well.
    The only problem is the amount of memory it requires. I get out of heap in using it some times.

    Thanks
    Ram

Viewing 15 posts - 1 through 15 (of 17 total)
Reply To: Reg: Web Service Operations using or returning complex types

You must be logged in to post in the forum log in