Hi,
I am reporting a peculiar issue which i am facing since yesterday working with
AXIS2 1.2. Addition of an extra simple element to an existing complex type of
an xsd throws an "Un Expected Element" error. Following is the brief.
The current set up : Working Fine.
The complext type part of my xsd
<xsd:complexType name="GEM_Ln_LoanRequestDetails">
<xsd:sequence>
<xsd:element name="LoanPreference"
type="GEM_Ln_LoanPreference"/>
<xsd:element name="CustomerDetails"
type="GEM_Ln_CustomerDetails"/>
<xsd:element name="CustomerAddr"
type="GEM_Ln_CustomerAddr"/>
<xsd:element name="EmployerDetails"
type="GEM_Ln_EmployerDetails"/>
<xsd:element name="CustomerFinances"
type="GEM_Ln_CustomerFinances"/>
<xsd:element name="CardDetails"
type="GEM_Ln_CardDetails" minOccurs="0"/>
<xsd:element name="LoanDetails"
type="GEM_Ln_LoanDetails" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
I used a wsdl, generated binding ( ADB ) classes using WSDL to Java tool on
Axis2 1.2. Using the build.xml, running the jar.server task i created the
services.aar and deployed on tomcat. Created a sample java class, which reads a
sample loan request xml ( formed using IDE based on the xsd ) and submits a
request to the service.
Every thing works fine, i get the response as i coded within the skeleton
method. This looks fine end to end.
Change to the existing schema: : Not Working
<xsd:complexType name="GEM_Ln_LoanRequestDetails">
<xsd:sequence>
<xsd:element name="ProductId" type="xsd:string"/>
<xsd:element name="LoanPreference"
type="GEM_Ln_LoanPreference"/>
<xsd:element name="CustomerDetails"
type="GEM_Ln_CustomerDetails"/>
<xsd:element name="CustomerAddr"
type="GEM_Ln_CustomerAddr"/>
<xsd:element name="EmployerDetails"
type="GEM_Ln_EmployerDetails"/>
<xsd:element name="CustomerFinances"
type="GEM_Ln_CustomerFinances"/>
<xsd:element name="CardDetails"
type="GEM_Ln_CardDetails" minOccurs="0"/>
<xsd:element name="LoanDetails"
type="GEM_Ln_LoanDetails" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
I have a need to add new field to hold a product id. after this, i generated
the binding classes again ( to make sure, i deleted all the existing classes,
and re generated every thing ). Then did the same procedure as above to
generated the services.aar, then created the sample java class callling the
stub. Changed the sample xml file to add a product id tag and then executed the
program. This time un expectedley i get the "Un expected sub element Product
Id" error repeatedly.
Not sure what is the problem, this looks to be simple. I tried various
combinations adding a test tag, then making product id a simple type etc etc.
Any idea why this occurs. I made sure, i replaced the correct services.aar on
the server. The new resource folder generated second time, properly refers to
the product id which was included.
Just as a work around, i tested with some sample test and test simple tags,
observed the xml input on TCP Monitor. For your reference attached is the
request and response xmls from the monitory. Observe for the "test" and
"testsimple" tags. The actual loan request xml read by my program is also
attached for reference.
<<Response.txt>> <<Request.txt>> <<LnRq.xml>>
Cheers
-Natraj.
HTTP/1.1 500 Internal Server Error
Content-Type: text/xml;charset=UTF-8
Transfer-Encoding: chunked
Date: Tue, 09 Oct 2007 08:55:18 GMT
Server: Apache-Coyote/1.1
Connection: close
147
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Client</faultcode>
<faultstring>java.lang.RuntimeException: Unexpected subelement
testsimple</faultstring>
<detail />
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
0
POST /axis/services/LoanOriginationService HTTP/1.1
Content-Type: text/xml; charset=UTF-8
SOAPAction: "LoanOrigination"
User-Agent: Axis2
Host: 127.0.0.1:1111
Transfer-Encoding: chunked
bce
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns3:LoanRequest xmlns:ns3="GEMoney:XMLI:LoanReq">
<HeaderInfo>
<Header>
<field-name>User-Agent</field-name>
<field-value>IE/5.0 libwww/2.17b3</field-value>
</Header>
<Header>
<field-name>Date</field-name>
<field-value>Tue, Aug 21 2007 15:46:00 GMT</field-value>
</Header>
<Header>
<field-name>ClientIP</field-name>
<field-value>3.22.234.12</field-value>
</Header>
</HeaderInfo>
<PartyAuthentication>
<ClientID>Client1234</ClientID>
<ReqID>ABCXYZ</ReqID>
<ReqPasswd>PASWDXYZ</ReqPasswd>
</PartyAuthentication>
<LRBase xmlns="GEMoney:XMLI">
<testsimple>Test Simple</testsimple>
<test>Test</test>
<LoanPreference xmlns="">
<LoanAmt>34546.78</LoanAmt>
<LoanTerm>1</LoanTerm>
<PaymentProtection>02</PaymentProtection>
<PaymentBreak>0</PaymentBreak>
<Purpose>01</Purpose>
</LoanPreference>
<CustomerDetails xmlns="">
<CustTitle>Mr</CustTitle>
<CustFirstName>John</CustFirstName>
<CustMiddleInitial>M</CustMiddleInitial>
<CustSurName>S</CustSurName>
<CustDOB>2001-01-01Z</CustDOB>
<MaritalStatus>M</MaritalStatus>
<CustNumOfDepedants>2</CustNumOfDepedants>
</CustomerDetails>
<CustomerAddr xmlns="">
<AddrType>U</AddrType>
<HomePhoneNum>0113218977</HomePhoneNum>
<MobileNum>07899723300</MobileNum>
<WorkPhoneNum>07899723300</WorkPhoneNum>
<Email>[EMAIL PROTECTED]</Email>
<FltNum>11</FltNum>
<HouseName>Peel Mills</HouseName>
<HouseNum>23</HouseNum>
<Street>Commercial Street</Street>
<Locality>Commercial Street</Locality>
<Town>Morley</Town>
<County>Yorkshire</County>
<PstCd>Ls278az</PstCd>
<ResStatus>O</ResStatus>
<TimeDuration>14</TimeDuration>
<PrvAddr>
<AddrType>O</AddrType>
<FltNum>11</FltNum>
<HouseName>Peel Mills</HouseName>
<HouseNum>23</HouseNum>
<Street>Commercial Street</Street>
<Locality>Commercial Street1</Locality>
<Town>Morley</Town>
<County>Yorkshire</County>
<PstCd>Ls278az</PstCd>
<TimeDuration>25</TimeDuration>
</PrvAddr>
</CustomerAddr>
<EmployerDetails xmlns="">
<EmpStatus>F</EmpStatus>
<Occupation>Professional</Occupation>
<EmployerName>Halifax</EmployerName>
<EmployeraAddr>Bank Street</EmployeraAddr>
<Town>Leeds</Town>
<TimeWithEmployer>12</TimeWithEmployer>
<PstCd>Ls278az</PstCd>
</EmployerDetails>
<CustomerFinances xmlns="">
<MthlyTakeHome>2400.0</MthlyTakeHome>
<MthlyMrtgRent>200.0</MthlyMrtgRent>
<BankSrtCd>65412389</BankSrtCd>
<BankAcctNum>456789023</BankAcctNum>
<TimeWithBk>40</TimeWithBk>
</CustomerFinances>
<CardDetails xmlns="">
<NumOfCrds>2</NumOfCrds>
<Card>
<CardCompany>CitiBank</CardCompany>
<CardBalance>2000.0</CardBalance>
<MonthlyPay>400.0</MonthlyPay>
</Card>
<Card>
<CardCompany>HSBC</CardCompany>
<CardBalance>2300.23</CardBalance>
<MonthlyPay>400.12</MonthlyPay>
</Card>
</CardDetails>
<LoanDetails xmlns="">
<ExstgLoans>2</ExstgLoans>
<Loan>
<CardCompany>GEMoney</CardCompany>
<CardBalance>2012.34</CardBalance>
<MonthlyPay>400.0</MonthlyPay>
</Loan>
<Loan>
<CardCompany>HSBC</CardCompany>
<CardBalance>2300.23</CardBalance>
<MonthlyPay>400.12</MonthlyPay>
</Loan>
</LoanDetails>
</LRBase>
</ns3:LoanRequest>
</soapenv:Body>
</soapenv:Envelope>0<tns:LoanRequest
xmlns:p="GEMoney:XMLI"
xmlns:tns="GEMoney:XMLI:LoanReq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="GEMoney:XMLI:LoanReq LoanRequest.xsd ">
<HeaderInfo>
<Header>
<field-name>User-Agent</field-name>
<field-value>IE/5.0 libwww/2.17b3</field-value>
</Header>
<Header>
<field-name>Date</field-name>
<field-value>Tue, Aug 21 2007 15:46:00 GMT</field-value>
</Header>
<Header>
<field-name>ClientIP</field-name>
<field-value>3.22.234.12</field-value>
</Header>
</HeaderInfo>
<PartyAuthentication>
<ClientID>Client1234</ClientID>
<ReqID>ABCXYZ</ReqID>
<ReqPasswd>PASWDXYZ</ReqPasswd>
</PartyAuthentication>
<p:LRBase>
<testsimple>Test Simple</testsimple>
<test>Test</test>
<LoanPreference>
<LoanAmt>34546.78</LoanAmt>
<LoanTerm>1</LoanTerm>
<PaymentProtection>02</PaymentProtection>
<PaymentBreak>0</PaymentBreak>
<Purpose>01</Purpose>
</LoanPreference>
<CustomerDetails>
<CustTitle>Mr</CustTitle>
<CustFirstName>John</CustFirstName>
<CustMiddleInitial>M</CustMiddleInitial>
<CustSurName>S</CustSurName>
<CustDOB>2001-01-01</CustDOB>
<MaritalStatus>M</MaritalStatus>
<CustNumOfDepedants>2</CustNumOfDepedants>
</CustomerDetails>
<CustomerAddr>
<AddrType>U</AddrType>
<HomePhoneNum>0113218977</HomePhoneNum>
<MobileNum>07899723300</MobileNum>
<WorkPhoneNum>07899723300</WorkPhoneNum>
<Email>[EMAIL PROTECTED]</Email>
<FltNum>11</FltNum>
<HouseName>Peel Mills</HouseName>
<HouseNum>23</HouseNum>
<Street>Commercial Street</Street>
<Locality>Commercial Street</Locality>
<Town>Morley</Town>
<County>Yorkshire</County>
<PstCd>Ls278az</PstCd>
<ResStatus>O</ResStatus>
<TimeDuration>14</TimeDuration>
<PrvAddr>
<AddrType>O</AddrType>
<FltNum>11</FltNum>
<HouseName>Peel Mills</HouseName>
<HouseNum>23</HouseNum>
<Street>Commercial Street</Street>
<Locality>Commercial Street1</Locality>
<Town>Morley</Town>
<County>Yorkshire</County>
<PstCd>Ls278az</PstCd>
<TimeDuration>25</TimeDuration>
</PrvAddr>
</CustomerAddr>
<EmployerDetails>
<EmpStatus>F</EmpStatus>
<Occupation>Professional</Occupation>
<EmployerName>Halifax</EmployerName>
<EmployeraAddr>Bank Street</EmployeraAddr>
<Town>Leeds</Town>
<TimeWithEmployer>12</TimeWithEmployer>
<PstCd>Ls278az</PstCd>
</EmployerDetails>
<CustomerFinances>
<MthlyTakeHome>2400</MthlyTakeHome>
<MthlyMrtgRent>200</MthlyMrtgRent>
<BankSrtCd>65412389</BankSrtCd>
<BankAcctNum>456789023</BankAcctNum>
<TimeWithBk>40</TimeWithBk>
</CustomerFinances>
<CardDetails>
<NumOfCrds>2</NumOfCrds>
<Card>
<CardCompany>CitiBank</CardCompany>
<CardBalance>2000</CardBalance>
<MonthlyPay>400</MonthlyPay>
</Card>
<Card>
<CardCompany>HSBC</CardCompany>
<CardBalance>2300.23</CardBalance>
<MonthlyPay>400.12</MonthlyPay>
</Card>
</CardDetails>
<LoanDetails>
<ExstgLoans>2</ExstgLoans>
<Loan>
<CardCompany>GEMoney</CardCompany>
<CardBalance>2012.34</CardBalance>
<MonthlyPay>400</MonthlyPay>
</Loan>
<Loan>
<CardCompany>HSBC</CardCompany>
<CardBalance>2300.23</CardBalance>
<MonthlyPay>400.12</MonthlyPay>
</Loan>
</LoanDetails>
</p:LRBase>
</tns:LoanRequest>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]