XSD to Jaxb does not generate package-info.java - maven-2

I have this sample XSD - I am trying to generate Java classess using Jaxb. Java classes are getting generated but we do not see package-info.java class getting generated, because the package-info.java is not getting generated marshalling fails with QName error. Please help.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified">
<xs:element name="Parent">
<xs:complexType>
<xs:sequence>
<xs:element ref="testuser"/>
<xs:element ref="testpassword"/>
<xs:element minOccurs="0" ref="testname"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="testuser">
<xs:complexType>
<xs:attribute name="myname" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="testpassword">
<xs:complexType>
<xs:attribute name="mytestpassword" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="testname">
<xs:complexType>
<xs:attribute name="mytestname" use="required"/>
</xs:complexType>
</xs:element>
</xs:schema>
My POM.xml:
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.8.3</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<extension>true</extension>
<args>
<arg>-Xannotate</arg>
</args>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>0.6.4</version>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics-annotate</artifactId>
<version>0.6.0</version>
</plugin>
</plugins>
<bindingIncludes>
<include>sample/test_binding.xml</include>
</bindingIncludes>
<schemaIncludes>
<include>sample.xsd</include>
</schemaIncludes>
<generatePackage>com.test</generatePackage>
</configuration>
</plugin>
</plugins>
binding file entry:
<bindings xmlns="http://java.sun.com/xml/ns/jaxb" version="2.1" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:a="http://abc.dev.java.net">
</bindings>

Related

BizTalk 2010 - Unable to Import WSDL created in ASP.Net Core 2.1 (Failed to get metadata)

WSDL service was created using ASP.Net Core 2.1
When I add reference to WCF service I get error message:
Metadata not available
Failed to get metadata from "http://xxx.xxx.xxx.xxx:port/somewsdl?wsdl".
(Microsoft.BizTalk.Adapter.Wcf.Consuming.MetadataExchange.MetadataExchangeException) Unable to download metadata from "http://xxx.xxx.xxx.xxx:port/somewsdl??wsdl" using WS-Metadata Exchange.
(System.InvalidOperationException) Metadata contains a reference that cannot be resolved: 'http://xxx.xxx.xxx.xxx:port/somewsdl??wsdl'. (System.ServiceModel.CommunicationException)
The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.
web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\somedll.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</location>
</configuration>
When I tested wsdl from SoapUI, it works. Can you help me please?
VS 2010 Ultimate version 10.0.30319.1
BizTalk Server 2010 version 3.9.469.0
I did a test to make sure it wasn't a problem with the old VS / BizTalk:
VS 2015 Professional
BizTalk Server 2016
-------------- Edited ---------------------
I am adding a reference by using:
When I am using "Metadata files" in "BizTalk WCF service consuming wizard" then I get error:
wsdl file:
<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:http="http://schemas.microsoft.com/ws/06/2004/policy/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://tempuri.org/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" targetNamespace="http://tempuri.org/" name="ISomeImport" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<xs:import namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
<xs:import namespace="http://schemas.datacontract.org/2004/07/System"/>
<xs:element name="InputData">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="template" type="tns:FormTemplateType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="InputDataResponse">
<xs:element minOccurs="0" maxOccurs="1" name="InputDataResult" type="tns:FormTemplateResponseType"/>
</xs:element>
<xs:complexType name="FormTemplateType">
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="1" name="Changed" type="xs:dateTime"/>
<xs:element minOccurs="0" maxOccurs="1" name="Data" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="1" name="Gestor" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="1" name="Identifier" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="1" name="Publisher" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="1" name="Status" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="1" name="Version" type="tns:FormTemplteVersion"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="FormTemplateResponseType">
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="1" name="Code" type="xs:int"/>
<xs:element minOccurs="0" maxOccurs="1" name="Message" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="1" name="TimestampStart" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="1" name="TimestampEnd" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="FormTemplteVersion">
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="1" name="Major" type="xs:int"/>
<xs:element minOccurs="1" maxOccurs="1" name="Minor" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="ISomeImport_InputData_InputMessage">
<wsdl:part name="parameters" element="tns:InputData"/>
</wsdl:message>
<wsdl:message name="ISomeImport_InputData_OutputMessage">
<wsdl:part name="parameters" element="tns:FormTemplateResponseType"/>
</wsdl:message>
<wsdl:portType name="ISomeImport">
<wsdl:operation name="InputData">
<wsdl:input message="tns:ISomeImport_InputData_InputMessage"/>
<wsdl:output message="tns:ISomeImport_InputData_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="BasicHttpBinding" type="tns:ISomeImport">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="InputData">
<soap:operation soapAction="http://tempuri.org/ISomeImport/InputData" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ISomeImport">
<wsdl:port name="BasicHttpBinding" binding="tns:BasicHttpBinding">
<soap:address location="http://xxx.xxx.xxx.xxx:port/someImport"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Try to browse you WSDL file from the browser, save it locally.And on the WCF Service Consuming Wizard choose the downloaded wsdl file. It should works.
have a lConsume web service using Wcf-basichttp adapter
Problem was in wsdl.
New wsdl:
<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:http="http://schemas.microsoft.com/ws/06/2004/policy/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://tempuri.org/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://tempuri.org/" name="IsomeImport">
<script/>
<script/>
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/" elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<xs:import namespace="http://schemas.datacontract.org/2004/07/someeFormFiller.Models.Interfaces"/>
<xs:element name="InputData">
<xs:complexType>
<xs:sequence>
<xs:element xmlns:q1="http://schemas.datacontract.org/2004/07/someeFormFiller.Models.Interfaces" minOccurs="0" name="template" nillable="true" type="q1:EFormTemplateType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="InputDataResponse">
<xs:complexType>
<xs:sequence>
<xs:element xmlns:q2="http://schemas.datacontract.org/2004/07/someeFormFiller.Models.Interfaces" minOccurs="0" name="InputDataResult" nillable="true" type="q2:EFormTemplateResponseType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/">
<xs:element name="anyType" nillable="true" type="xs:anyType"/>
<xs:element name="anyURI" nillable="true" type="xs:anyURI"/>
<xs:element name="base64Binary" nillable="true" type="xs:base64Binary"/>
<xs:element name="boolean" nillable="true" type="xs:boolean"/>
<xs:element name="byte" nillable="true" type="xs:byte"/>
<xs:element name="dateTime" nillable="true" type="xs:dateTime"/>
<xs:element name="decimal" nillable="true" type="xs:decimal"/>
<xs:element name="double" nillable="true" type="xs:double"/>
<xs:element name="float" nillable="true" type="xs:float"/>
<xs:element name="int" nillable="true" type="xs:int"/>
<xs:element name="long" nillable="true" type="xs:long"/>
<xs:element name="QName" nillable="true" type="xs:QName"/>
<xs:element name="short" nillable="true" type="xs:short"/>
<xs:element name="string" nillable="true" type="xs:string"/>
<xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte"/>
<xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt"/>
<xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong"/>
<xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort"/>
<xs:element name="char" nillable="true" type="tns:char"/>
<xs:simpleType name="char">
<xs:restriction base="xs:int"/>
</xs:simpleType>
<xs:element name="duration" nillable="true" type="tns:duration"/>
<xs:simpleType name="duration">
<xs:restriction base="xs:duration">
<xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?"/>
<xs:minInclusive value="-P10675199DT2H48M5.4775808S"/>
<xs:maxInclusive value="P10675199DT2H48M5.4775807S"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="guid" nillable="true" type="tns:guid"/>
<xs:simpleType name="guid">
<xs:restriction base="xs:string">
<xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}"/>
</xs:restriction>
</xs:simpleType>
<xs:attribute name="FactoryType" type="xs:QName"/>
<xs:attribute name="Id" type="xs:ID"/>
<xs:attribute name="Ref" type="xs:IDREF"/>
</xs:schema>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.datacontract.org/2004/07/someeFormFiller.Models.Interfaces" xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/" elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/someeFormFiller.Models.Interfaces">
<xs:import namespace="http://schemas.datacontract.org/2004/07/System"/>
<xs:import namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
<xs:complexType xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/" name="EFormTemplateType">
<xs:sequence>
<xs:element minOccurs="0" name="Changed" type="xs:dateTime"/>
<xs:element minOccurs="0" name="Data" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="Gestor" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="Identifier" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="Publisher" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="Status" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="Version" nillable="true" type="tns:EFormTemplateVersion"/>
</xs:sequence>
</xs:complexType>
<xs:element name="EFormTemplateType" nillable="true" type="tns:EFormTemplateType"/>
<xs:complexType xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/" name="EFormTemplateVersion">
<xs:sequence>
<xs:element minOccurs="0" name="Major" type="xs:int"/>
<xs:element minOccurs="0" name="Minor" type="xs:int"/>
</xs:sequence>
</xs:complexType>
<xs:element name="EFormTemplateVersion" nillable="true" type="tns:EFormTemplateVersion"/>
<xs:complexType xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/" name="EFormTemplateResponseType">
<xs:sequence>
<xs:element minOccurs="0" name="Code" type="xs:int"/>
<xs:element minOccurs="0" name="Message" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="TimestampEnd" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="TimestampStart" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:element name="EFormTemplateResponseType" nillable="true" type="tns:EFormTemplateResponseType"/>
</xs:schema>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<xs:import namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
</xs:schema>
</wsdl:types>
<wsdl:message name="IsomeImport_InputData_InputMessage">
<wsdl:part name="parameters" element="tns:InputData"/>
</wsdl:message>
<wsdl:message name="IsomeImport_InputData_OutputMessage">
<wsdl:part name="parameters" element="tns:InputDataResponse"/>
</wsdl:message>
<wsdl:portType name="IsomeImport">
<wsdl:operation name="InputData">
<wsdl:input wsam:Action="http://tempuri.org/IsomeImport/InputData" message="tns:IsomeImport_InputData_InputMessage"/>
<wsdl:output wsam:Action="http://tempuri.org/IsomeImport/InputDataResponse" message="tns:IsomeImport_InputData_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="BasicHttpBinding" type="tns:IsomeImport">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="InputData">
<soap:operation soapAction="http://tempuri.org/IsomeImport/InputData" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="IsomeImport">
<wsdl:port name="BasicHttpBinding" binding="tns:BasicHttpBinding">
<soap:address location="http://xxx.xxx.xxx.xxx:port/someImport.svc"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

Extract value from column (xmltype)

We are using an ERP system. I'm newbie in XML.
In our system, we have a column XML_DATA which TYPE is xmltype(2000)
Schema:
<?xml version="1.0" ?>
- <xs:schema xmlns:xs=" " attributeFormDefault="qualified" elementFormDefault="qualified">
- <xs:element name="XK6">
- <xs:complexType>
- <xs:choice maxOccurs="unbounded">
- <xs:element name="Product">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="Product_row" minOccurs="0" maxOccurs="unbounded">
- <xs:complexType>
- <xs:sequence>
<xs:element name="DETAIL" type="Product_DETAIL" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
- <xs:simpleType name="Product_DETAIL">
- <xs:restriction base="xs:string">
<xs:maxLength value="1000" />
</xs:restriction>
</xs:simpleType>
</xs:schema>
EDIT:
The XML:
<?xml version="1.0" encoding="utf-8" ?>
- <XP6>
+<collapsed_node>
+<collapsed_node>
+<collapsed_node>
- <Product>
- <Product_row>
<DETAIL>sometext </DETAIL>
</Product_row>
</Product>
</XP6>
How can i extract the column ?
Or need more data to do it ?
I want to get the Product_Detail value.
Use the "XMLTABLE" function (see https://docs.oracle.com/cd/B19306_01/server.102/b14200/functions228.htm):
with d as (
select xmltype('
<XK6>
<Product>
<Product_row>
<DETAIL>First product detail</DETAIL>
</Product_row>
<Product_row>
<DETAIL>Second product detail</DETAIL>
</Product_row>
</Product>
</XK6>'
) as thexml from dual)
select detail from d,
xmltable('/XK6/Product/Product_row'
passing d.thexml
columns detail varchar2(100) path 'DETAIL')

UnmarshalException : camel soap unmarshaling error unexpected element

[com.sun.istack.SAXParseException2; lineNumber: 1; columnNumber: 1; unexpected element (uri:"http://service.example.com/", local:"custDetails"). Expected elements are <{http://schemas.xmlsoap.org/soap/envelope/}Body>,<{}Customer>,<{http://schemas.xmlsoap.org/soap/envelope/}Envelope>,<{http://schemas.xmlsoap.org/soap/envelope/}Fault>,<{http://schemas.xmlsoap.org/soap/envelope/}Header>]
Problem statement: Camel is not expecting to receive the custDetails (webmethod) and the namespace.
Expectation : to use camel-soap to unmarshal the payload to soapJaxb out of the box.
Generated JAXB classes using maven-jaxb2-plugin for the xsd below. Results produced three classes with annotations - Customer.java, ObjectFactory,java , Order.java.
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
>
<xs:element name="Customer">
<xs:complexType >
<xs:sequence>
<xs:element name="Id" type="xs:string"/>
<xs:element name="Address" type="xs:string"/>
<xs:element name="ListOfOrders" type="order" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="order">
<xs:sequence>
<xs:element name="Id" type="xs:string"/>
<xs:element name="ProductName" type="xs:string"/>
<xs:element name="ListOfDevice" minOccurs="0" >
<xs:complexType>
<xs:sequence>
<xs:element name="DeviceName" type="xs:string"/>
<xs:element name="ManufactureDate" type="xs:date"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>
Expose webservice custDetails(..) as follows using cxf endpoint with DataFormat set to PAYLOAD. [UPDATED with #Configuration]
#Configuration
public class WebServiceConfig {
#Autowired
private Bus bus;
#Bean
public CxfEndpoint getCustomerDetails() {
CxfEndpoint cxfEndpoint = new CxfEndpoint();
cxfEndpoint.setAddress("/customerProvide");
cxfEndpoint.setServiceClass(CustomerSvc.class);
cxfEndpoint.setBus(bus);
cxfEndpoint.setDataFormat(DataFormat.PAYLOAD);return cxfEndpoint ;}
#Webservice
public interface CustomerSvc {
#WebMethod
Customer custDetails ( #WebParam(name="Customer")Customer Customer ) ;}
// Simple route in Route class.
#Component
public class CustomerRoute extends RouteBuilder {
public void configure (){
SoapJaxbDataFormat soapDF
= new SoapJaxbDataFormat("com.example.service", new TypeNameStrategy());
from("cxf:bean:getCustomerDetails").unmarshal(soapDF)
.log("receive : ${body}")
}
Wsdl generated and imported to soapUI. sample SOAPUI request to test is as follows.
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ser="http://service.example.com/">
<soapenv:Header/>
<soapenv:Body>
<ser:custDetails>
<ser:Customer>
<Id>1-abc</Id>
<Address>23 Sydney Oxley road</Address>
<ListOfOrders>
<Id>P1344</Id>
<ProductName>DRAM</ProductName>
<ListOfDevice>
<DeviceName>20nm</DeviceName>
<ManufactureDate>15-8-2017</ManufactureDate>
</ListOfDevice>
</ListOfOrders>
</ser:Customer>
</ser:custDetails>
</soapenv:Body>
</soapenv:Envelope>
When I try to unmarshal PAYLOAD with soap dataformat, camel is throwing an error. It is the hitting namespace error. I am not sure why package-info class is not generated. Any help is greatly appreciated. Thank you.
UPDATE, wsdl given below.
<?xml version='1.0' encoding='UTF-8'?><wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://service.example.com/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="CustomerSvcService" targetNamespace="http://service.example.com/">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://service.example.com/" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://service.example.com/">
<xs:element name="Customer">
<xs:complexType>
<xs:sequence>
<xs:element name="Id" type="xs:string"/>
<xs:element name="Address" type="xs:string"/>
<xs:element minOccurs="0" name="ListOfOrders" type="tns:order"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="order">
<xs:sequence>
<xs:element name="Id" type="xs:string"/>
<xs:element name="ProductName" type="xs:string"/>
<xs:element minOccurs="0" name="ListOfDevice">
<xs:complexType>
<xs:sequence>
<xs:element name="DeviceName" type="xs:string"/>
<xs:element name="ManufactureDate" type="xs:date"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:element name="custDetails" type="tns:custDetails"/>
<xs:complexType name="custDetails">
<xs:sequence>
<xs:element minOccurs="0" ref="tns:Customer"/>
</xs:sequence>
</xs:complexType>
<xs:element name="custDetailsResponse" type="tns:custDetailsResponse"/>
<xs:complexType name="custDetailsResponse">
<xs:sequence>
<xs:element minOccurs="0" ref="tns:Customer"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="custDetails">
<wsdl:part element="tns:custDetails" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="custDetailsResponse">
<wsdl:part element="tns:custDetailsResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="CustomerSvc">
<wsdl:operation name="custDetails">
<wsdl:input message="tns:custDetails" name="custDetails">
</wsdl:input>
<wsdl:output message="tns:custDetailsResponse" name="custDetailsResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="CustomerSvcServiceSoapBinding" type="tns:CustomerSvc">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="custDetails">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="custDetails">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="custDetailsResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="CustomerSvcService">
<wsdl:port binding="tns:CustomerSvcServiceSoapBinding" name="CustomerSvcPort">
<soap:address location="http://localhost:12000/services/customerProvide"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
EDIT due to updated question
You try to unmarshal the request payload with Jax-B based on the XML schema you posted at the top of your question.
But in this schema the element custDetails does not exist. It exists in the schema part of your WSDL, but not in the schema?!? Therefore the error unexpected element.

XML validation using XSD assertion condition

I have below XML and XSD and I am getting some error while validation.
My XML
<parent>
<child1>Y</child1>
<child2>Y</child2>
</parent>
My XSD
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="parent">
<xs:complexType>
<xs:sequence>
<xs:element name="child1" type="xs:string" />
<xs:element name="child2" type="xs:string" />
</xs:sequence>
<xs:assertion test="child1 != 'N' and child2 != 'N'" />
</xs:complexType>
</xs:element>
</xs:schema>`
The error I'm getting
s4s-elt-invalid-content.1: The content of '#AnonType_parent' is invalid. Element 'assertion' is invalid, misplaced, or occurs too often.
I want to pass the XML validation If I get other than 'N' value for child elements.
Can anyone suggest what I am doing wrong?

Can we add new attribute or change type of existing attribute to a "Referenced Element"?

In my XML schema I have an element being referenced tens of times by other elements but with different enumerated values for one of its attribute.
For now, instead of creating this element in global space and referencing it later, I am creating a new instance wherever it is needed. This approach has increased my schema size enormously because of repeated creation of almost same element many times. It also may have adverse effect on efficiency of the schema.
The only way that I see is to create element once and then reference it many times but my problem is: one of the attribute of this referenced element is required to have a different set of enumerations for each referencing element.
My question is:
Is it possible to to add an attribute to a "Referenced Element" in XML Schema?
Something like this:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.myDomain.com" xmlns="http://www.myDomain.com" elementFormDefault="qualified">
<xs:simpleType name="myValues1">
<xs:restriction base="xs:string">
<xs:enumeration value="value1" />
<xs:enumeration value="value2" />
</xs:restriction>
</xs:simpleType>
<xs:element name="myElement">
<xs:complexType mixed="true">
<xs:attribute name="attr1" type="xs:string" />
<xs:attribute name="attr2" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="MainElement1">
<xs:complexType>
<xs:sequence>
<xs:element ref="myElement">
<xs:complexType>
<xs:attribute name="myAtt" type="myValues1" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="mainAtt1" />
</xs:complexType>
</xs:element>
</xs:schema>
Or can we change type of an existing attribute of a "Referenced Element" in XML Schema?
something like this:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.myDomain.com" xmlns="http://www.myDomain.com" elementFormDefault="qualified">
<xs:simpleType name="myValues1">
<xs:restriction base="xs:string">
<xs:enumeration value="value1" />
<xs:enumeration value="value2" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="myValues2">
<xs:restriction base="xs:string">
<xs:enumeration value="value3" />
<xs:enumeration value="value4" />
</xs:restriction>
</xs:simpleType>
<xs:element name="myElement">
<xs:complexType mixed="true">
<xs:attribute name="attr1" type="xs:string" />
<xs:attribute name="attr2" type="xs:string" />
<xs:attribute name="myAtt" type="myValues1" />
</xs:complexType>
</xs:element>
<xs:element name="MainElement1">
<xs:complexType>
<xs:sequence>
<xs:element ref="myElement">
<xs:complexType>
<xs:attribute name="myAtt" type="myValues2" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="mainAtt1" />
</xs:complexType>
</xs:element>
</xs:schema>
You cannot override the content model of a referenced element. The point of the reference is that it points to exactly the same element every time.
If you really want the element to have different content, you are better off defining multiple global complex types and using them, rather than using an element reference:
<xs:complexType name="Type1" mixed="true">
<xs:attribute name="attr1" type="xs:string" />
<xs:attribute name="attr2" type="xs:string" />
<xs:attribute name="myAtt" type="myValues1" />
</xs:complexType>
<xs:complexType name="Type2" mixed="true">
<xs:complexContent>
<xs:extension base="Type1">
<xs:attribute name="myAtt2" type="myValues2" />
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="MainElement1">
<xs:complexType>
<xs:sequence>
<xs:element name="myElement" type="Type1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
I would not worry too much about performance. The reference to the global types will be resolved only once at schema load time.