org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
Ciao a tutti!
Ho un problema che mi sta bloccando: sto cercando di comunicare con un web service di un cliente utilizzando il JDK 1.5 e Axis 1.4.
Più sotto ci sono il WSDL del web service e il codice java col quale cerco di invocarlo.
Putroppo ottengo sempre lo stesso risultato: "org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize. "
Credo di aver capito che il SimpleDeserializer non riesce a deserializzare dei dati di input che non siano tipi primitivi... ma questo non mi risolve il problema ;-)
Qualcuno sa dirmi per favore dove sto sbagliando?!?!
Grazie mille!!!!!!!
Ciao,
Mirko
Codice JAVA:
codice:try { String nomeMetodo = "make"; Call call = (Call) new Service().createCall(); call.setTargetEndpointAddress(new URL ("http://www.meridiana.it/webservices/ws_search.asmx")); String XMLSecurityAccess = createXMLSecurityAccess(); // stringa in formato XML String XMLInputDataDetail = createXMLInputDataDetail(); // stringa in formato XML TWsInputData myTWsInputData = new TWsInputData(); // semplice oggetto con 2 proprietà String myTWsInputData.XMLSecurityAccess = XMLSecurityAccess; myTWsInputData.XMLInputDataDetail = XMLInputDataDetail; QName qn = new QName( "DsFlightSearch", "TWsInputData" ); call.registerTypeMapping(TWsInputData.class, qn, new org.apache.axis.encoding.ser.BeanSerializerFactory(TWsInputData.class, qn), new org.apache.axis.encoding.ser.BeanDeserializerFactory(TWsInputData.class, qn)); call.setSOAPActionURI("http://tempuri.org/" + nomeMetodo); call.setUseSOAPAction(true); call.setOperationName(nomeMetodo); messaggio = (String)call.invoke(nomeMetodo, new Object[]{myTWsInputData}); } catch (MalformedURLException ex) { messaggio = "errore: l'url non è esatta: " + ex; }catch (ServiceException ex) { messaggio = "errore: la creazione della chiamata è fallita: " + ex; }catch (AxisFault ex) { messaggio = "errore: l'invocazione del WS è fallita: " + ex; } finally{ System.out.println(messaggio); }
WSDL:
codice:<?xml version="1.0" encoding="utf8" ?> <wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:i0="http://tempuri.org/DsFlightSearch.xsd" xmlns:tns="http://tempuri.org/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> <wsdl:import namespace="http://tempuri.org/DsFlightSearch.xsd" location="http://www.meridiana.it/webservices/ws_search.asmx?schema=DsFlightSearch" /> <wsdl:types> <s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/"> <s:import namespace="http://tempuri.org/DsFlightSearch.xsd" /> <s:element name="make1"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="xxx" type="s:string" /> </s:sequence> </s:complexType> </s:element> <s:element name="make1Response"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="make1Result" type="tns:TWsOutputData" /> </s:sequence> </s:complexType> </s:element> <s:complexType name="TWsOutputData"> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="responseCode" type="tns:TWsResponseCode" /> <s:element minOccurs="0" maxOccurs="1" name="dsOut"> <s:complexType> <s:sequence> <s:any namespace="http://tempuri.org/DsFlightSearch.xsd" /> </s:sequence> </s:complexType> </s:element> </s:sequence> </s:complexType> <s:complexType name="TWsResponseCode"> <s:sequence> <s:element minOccurs="1" maxOccurs="1" name="code" type="s:int" /> <s:element minOccurs="0" maxOccurs="1" name="description" type="s:string" /> <s:element minOccurs="0" maxOccurs="1" name="stackTrace" type="s:string" /> <s:element minOccurs="0" maxOccurs="1" name="errorList" type="tns:ArrayOfTWsResponseError" /> </s:sequence> </s:complexType> <s:complexType name="ArrayOfTWsResponseError"> <s:sequence> <s:element minOccurs="0" maxOccurs="unbounded" name="TWsResponseError" nillable="true" type="tns:TWsResponseError" /> </s:sequence> </s:complexType> <s:complexType name="TWsResponseError"> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="errorSource" type="s:string" /> <s:element minOccurs="1" maxOccurs="1" name="errorCode" type="s:int" /> <s:element minOccurs="0" maxOccurs="1" name="errorMessage" type="s:string" /> <s:element minOccurs="0" maxOccurs="1" name="errorDescription" type="s:string" /> </s:sequence> </s:complexType> <s:element name="make"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="inData" type="tns:TWsInputData" /> </s:sequence> </s:complexType> </s:element> <s:complexType name="TWsInputData"> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="XMLSecurityAccess" type="s:string" /> <s:element minOccurs="0" maxOccurs="1" name="XMLInputDataDetail" type="s:string" /> </s:sequence> </s:complexType> <s:element name="makeResponse"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="makeResult" type="tns:TWsOutputData" /> </s:sequence> </s:complexType> </s:element> <s:element name="TWsOutputData" nillable="true" type="tns:TWsOutputData" /> </s:schema> </wsdl:types> <wsdl:message name="make1SoapIn"> <wsdl:part name="parameters" element="tns:make1" /> </wsdl:message> <wsdl:message name="make1SoapOut"> <wsdl:part name="parameters" element="tns:make1Response" /> </wsdl:message> <wsdl:message name="makeSoapIn"> <wsdl:part name="parameters" element="tns:make" /> </wsdl:message> <wsdl:message name="makeSoapOut"> <wsdl:part name="parameters" element="tns:makeResponse" /> </wsdl:message> <wsdl:message name="make1HttpGetIn"> <wsdl:part name="xxx" type="s:string" /> </wsdl:message> <wsdl:message name="make1HttpGetOut"> <wsdl:part name="Body" element="tns:TWsOutputData" /> </wsdl:message> <wsdl:message name="make1HttpPostIn"> <wsdl:part name="xxx" type="s:string" /> </wsdl:message> <wsdl:message name="make1HttpPostOut"> <wsdl:part name="Body" element="tns:TWsOutputData" /> </wsdl:message> <wsdl:portType name="wsSearchSoap"> <wsdl:operation name="make1"> <wsdl:input message="tns:make1SoapIn" /> <wsdl:output message="tns:make1SoapOut" /> </wsdl:operation> <wsdl:operation name="make"> <wsdl:input message="tns:makeSoapIn" /> <wsdl:output message="tns:makeSoapOut" /> </wsdl:operation> </wsdl:portType> <wsdl:portType name="wsSearchHttpGet"> <wsdl:operation name="make1"> <wsdl:input message="tns:make1HttpGetIn" /> <wsdl:output message="tns:make1HttpGetOut" /> </wsdl:operation> </wsdl:portType> <wsdl:portType name="wsSearchHttpPost"> <wsdl:operation name="make1"> <wsdl:input message="tns:make1HttpPostIn" /> <wsdl:output message="tns:make1HttpPostOut" /> </wsdl:operation> </wsdl:portType> <wsdl:binding name="wsSearchSoap" type="tns:wsSearchSoap"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> <wsdl:operation name="make1"> <soap:operation soapAction="http://tempuri.org/make1" style="document" /> <wsdl:input> <soap:body use="literal" /> </wsdl:input> <wsdl:output> <soap:body use="literal" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="make"> <soap:operation soapAction="http://tempuri.org/make" style="document" /> <wsdl:input> <soap:body use="literal" /> </wsdl:input> <wsdl:output> <soap:body use="literal" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:binding name="wsSearchHttpGet" type="tns:wsSearchHttpGet"> <http:binding verb="GET" /> <wsdl:operation name="make1"> <http:operation location="/make1" /> <wsdl:input> <http:urlEncoded /> </wsdl:input> <wsdl:output> <mime:mimeXml part="Body" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:binding name="wsSearchHttpPost" type="tns:wsSearchHttpPost"> <http:binding verb="POST" /> <wsdl:operation name="make1"> <http:operation location="/make1" /> <wsdl:input> <mime:content type="application/xwwwformurlencoded" /> </wsdl:input> <wsdl:output> <mime:mimeXml part="Body" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="wsSearch"> <wsdl:port name="wsSearchSoap" binding="tns:wsSearchSoap"> <soap:address location="http://www.meridiana.it/webservices/ws_search.asmx" /> </wsdl:port> <wsdl:port name="wsSearchHttpGet" binding="tns:wsSearchHttpGet"> <http:address location="http://www.meridiana.it/webservices/ws_search.asmx" /> </wsdl:port> <wsdl:port name="wsSearchHttpPost" binding="tns:wsSearchHttpPost"> <http:address location="http://www.meridiana.it/webservices/ws_search.asmx" /> </wsdl:port> </wsdl:service> </wsdl:definitions>

Rispondi quotando