Spring + SOAP Generate XSD from XML with custom type objects

755 views Asked by At

I'm working in SOAP WS using SPRING and could you please help me to generate XSD for the below required response soap xml.

Below is the current XSD

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"       xmlns="http://com/myws/webservices/accountservice" xmlns:account="http://myws.accessws.com/myWS"   targetNamespace="http://com/myws/webservices/accountservice" elementFormDefault="qualified">
<xsd:import namespace="http://webservice.com/myWS"  schemaLocation="AccountDetails.xsd"/>
<xsd:element name="AccountDetailsRequest">
    <xsd:complexType>
        <xsd:sequence>
            <xsd:element name="accountNumber" type="xsd:string"/>
            <xsd:element name="accountName" type="xsd:string"/>
            <xsd:element name="address" type="xsd:string"/>
            <xsd:element name="phone" type="xsd:string"/>
        </xsd:sequence>
    </xsd:complexType>
</xsd:element>
<xsd:element name="AccountDetailsResponse">
    <xsd:complexType>
        <xsd:sequence>
            <xsd:element name="AccountDetails" type="account:Account"/>
        </xsd:sequence>
    </xsd:complexType>
</xsd:element>

In the above xsd the response is set to Account object but i need to form a response xml in the below format and set it to the account object, as IN,VN,TYPE,LAST are all members of Account class (getters and setters).

<PERSON>
<IN>
<VN>1234567</VN>
<TYPE>A</TYPE>
<LAST>20150603</LAST>
</IN>
</PERSON>

I'm using the below code to set on the response for the current XSD

  AccountDetailsResponse response = new AccountDetailsResponse();
    /* call Spring injected service implementation to retrieve account data */
    Account account= accountService_i.getAccountDetails(request.getAccountNumber());
    response.setAccountDetails(account);
    return response;

Any help on this will be much appreciated

Thanks

0

There are 0 answers