Reputation: 305
I have created xsd for enumeration and complex type. My main request or .class is DeletionReq. Inside which i would like to pass Id and data. Data has enumeration type "allowedApplDataColumnNamesType" and data has other elements. I created xsd and created java class but when client try to send data it dont send all the values it only sends Ids.
could you please guide me about correct below xsd and how can i verify. I tried on line xsd validator it failed there.
I have provided update for issue and provided Error Message.
1)what can be easiest set up to send xsd data and unmarshal to check if it works on. I am working in a distributed environment and because of securities and other constraint cant send request from test project.
Error I am getting is :
Caused by: javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"DeletionReq"). Expected elements are <{http://abc.test.abc/delete/DeletionReq/DeletionReq-V1.0}DeletionReq>
Xsd code :
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://abc.test.abc/delete/DeletionReq/DeletionReq-V1.0"
targetNamespace="http://abc.test.abc/delete/DeletionReq/DeletionReq-V1.0"
elementFormDefault="qualified" attributeFormDefault="qualified" version="1.0">
<xs:element name="DeletionReq">
<xs:complexType>
<xs:sequence>
<xs:element name="Id" type="xs:long"/>
<xs:element name="data" type="tns:data" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:simpleType name="allowedApplDataColumnNamesType">
<xs:restriction base="xs:string">
<xs:enumeration value="code1" />
<xs:enumeration value="code2" />
<xs:enumeration value="code3" />
<xs:enumeration value="code4" />
<xs:enumeration value="code5" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="data">
<xs:sequence>
<xs:element name="dataColumnName" type="xs:string" minOccurs="0" />
<xs:element name="dataOldValue" type="xs:string" minOccurs="0"/>
<xs:element name="dataNewValue" type="xs:string" minOccurs="0"/>
<xs:element name="testRecord" type="xs:string" minOccurs="0"/>
<xs:element name="projId" type="xs:string" minOccurs="0"/>
<xs:element minOccurs="0" name="allowedApplDataColumnNames" type="tns:allowedApplDataColumnNamesType"/>
</xs:sequence>
</xs:complexType>
update1 : when Client jar sends request it is missing name space. when i try to send message from application it has namespace. because of missing namespace it throws exception. I am trying to figure out why request from client missing namespace. update 2: the issue is in complextype "Data". when java class is generated it dont have namespace in the @xmlType. I am not sure how to add namespace in complex type i tried few attributes but unsuccessful. Thank you
Upvotes: 0
Views: 55