java - Unmarshalling Error CXF -
i use intellij latest version, jdk 1.7 , cxf 3.1 used these generate java client code wsdl.
here wsdl
<?xml version="1.0" encoding="utf-8"?> <wsdl:definitions targetnamespace="http://myserver/definitions" xmlns:tns="http://myserver/definitions" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xs="http://www.w3.org/2001/xmlschema" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:icd="http://myserver/schemas/globalid"> <!-- schema imports + elements --> <wsdl:types> <xs:schema targetnamespace="http://myserver/definitions"> <xs:import namespace="http://myserver/schemas/globalid" schemalocation="http://myserver/schemas/globalid.xsd" /> </xs:schema> </wsdl:types> <!-- message definitions --> <wsdl:message name="addressingrequest"> <wsdl:part name="body" element="icd:addressing" /> </wsdl:message> <wsdl:message name="addressingresponse"> <wsdl:part name="body" element="icd:addressingresponse" /> </wsdl:message> <!-- ports --> <wsdl:porttype name="webserviceporttype"> <wsdl:operation name="addressingrequest"> <wsdl:input message="tns:addressingrequest" /> <wsdl:output message="tns:addressingresponse" /> </wsdl:operation> </wsdl:porttype> <!-- service bindings --> <wsdl:binding name="webservicebinding" type="tns:webserviceporttype"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="addressingrequest"> <soap:operation soapaction="addressing" /> <wsdl:input> <soap:body use="literal" /> </wsdl:input> <wsdl:output> <soap:body use="literal" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <!-- service --> <wsdl:service name="globalidwebservice"> <wsdl:port name="webserviceport" binding="tns:webservicebinding"> <soap:address location="${soap.address.location}"/> </wsdl:port> </wsdl:service> <wsdl:service name="globalidwebservicesecure"> <wsdl:port name="securewebserviceport" binding="tns:webservicebinding"> <soap:address location="${soap.address.location.secure}"/> </wsdl:port> </wsdl:service> </wsdl:definitions>
and xsd definitions required :
<?xml version="1.0" encoding="utf-8"?> <xs:schema elementformdefault="unqualified" attributeformdefault="unqualified" xmlns:xs="http://www.w3.org/2001/xmlschema" targetnamespace="http://myserver/schemas/globalid" xmlns:globalid="http://myserver/schemas/globalid" xmlns:common="http://myserver/schemas/common"> <xs:import namespace="http://myserver/schemas/common" schemalocation="http://myserver/schemas/common.xsd"/> <xs:element name="addressing" type="globalid:addressingsearchtype"/> <xs:complextype name="addressingsearchtype"> <xs:sequence> <xs:element name="authentication" type="common:authenticationtype" minoccurs="1" maxoccurs="1"/> <xs:choice> <xs:element name="address" type="common:addresstype" minoccurs="1" maxoccurs="1"/> <xs:element name="componentaddress" type="globalid:addressingrecordtype" minoccurs="1" maxoccurs="1"/> <xs:sequence> <xs:element name="fulladdress" type="xs:string" minoccurs="1" maxoccurs="1"/> <xs:element name="countrycode" type="common:countrycodetype" minoccurs="1" maxoccurs="1"/> </xs:sequence> </xs:choice> </xs:sequence> <xs:attribute name="maxrows" type="xs:integer"/> </xs:complextype> <xs:element name="addressingresponse" type="globalid:addressingresponsetype"/> <xs:complextype name="addressingresponsetype"> <xs:sequence> <xs:element name="result" type="globalid:addressingrecordtype" minoccurs="0" maxoccurs="unbounded"/> </xs:sequence> <xs:attribute name="recordcount" type="xs:integer"/> </xs:complextype> <xs:complextype name="addressingrecordtype"> <xs:group ref="globalid:addressingrecordgroup"/> </xs:complextype> <xs:group name="addressingrecordgroup"> <xs:all> <xs:element name="addressline1" type="xs:string" minoccurs="0" maxoccurs="1"/> <xs:element name="addressline2" type="xs:string" minoccurs="0" maxoccurs="1"/> <xs:element name="addressline3" type="xs:string" minoccurs="0" maxoccurs="1"/> <xs:element name="addressline4" type="xs:string" minoccurs="0" maxoccurs="1"/> <xs:element name="addressline5" type="xs:string" minoccurs="0" maxoccurs="1"/> <xs:element name="addressline6" type="xs:string" minoccurs="0" maxoccurs="1"/> <xs:element name="addressline7" type="xs:string" minoccurs="0" maxoccurs="1"/> <xs:element name="addressline8" type="xs:string" minoccurs="0" maxoccurs="1"/> <xs:element name="countrycode" type="common:countrycodetype" minoccurs="1" maxoccurs="1"/> </xs:all> </xs:group> </xs:schema>
and error
org.apache.cxf.interceptor.fault: unmarshalling error: unexpected element (uri:"http://myserver/schemas/globalid", local:"result"). expected elements <{}result>
i tried many different approaches, adding , removing namespaces in pojos... no effect. similar solutions problem searched on web didn't help... :(
it seems needed define namespace in annotation in pojos... dunno why cxf didn't generate properly.
Comments
Post a Comment