我有一個工作的Web服務與軸1發,而且我將其遷移到JAXWSJAXWS不填充結果
我創建從我的工作WSDL文件我用的wsimport和Maven的客戶端類。
我的問題是,我可以看到我的記錄器中的數據,我的SOAP響應消息,但對象不填充此數據。
我WSDL看起來像這樣(我張貼僅1服務,使其更短,刪除了一些元素,所以請忽略,如果有一些缺少像ResultadoProcesamiento):
<wsdl:definitions targetNamespace="http://ws.test" xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://ws.test"
xmlns:intf="http://ws.test"
xmlns:tns1="http://pojo.test"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<schema elementFormDefault="qualified" targetNamespace="http://ws.test" xmlns="http://www.w3.org/2001/XMLSchema" >
<import namespace="http://pojo.test"/>
<element name="validarCertificado">
<complexType>
<sequence>
<element name="cert" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="validarCertificadoResponse">
<complexType>
<sequence>
<element name="validarCertificadoReturn" type="tns1:MensajeSalida"/>
</sequence>
</complexType>
</element>
</schema>
<schema elementFormDefault="qualified" targetNamespace="http://pojo.test" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://ws.test"/>
<complexType name="Respuesta">
<sequence>
<element name="excepcion" nillable="true" type="tns1:Excepcion"/>
<element name="resultadoProcesamiento" nillable="true" type="tns1:ResultadoProcesamiento"/>
</sequence>
</complexType>
<complexType name="MensajeSalida">
<sequence>
<element name="peticion" nillable="true" type="xsd:string"/>
<element name="respuesta" nillable="true" type="tns1:Respuesta"/>
<element name="versionMsg" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
</schema>
</wsdl:types>
<wsdl:message name="validarCertificadoRequest">
<wsdl:part element="impl:validarCertificado" name="parameters"/>
</wsdl:message>
<wsdl:message name="validarCertificadoResponse">
<wsdl:part element="impl:validarCertificadoResponse" name="parameters"/>
</wsdl:message>
<wsdl:portType name="WsTest">
<wsdl:operation name="validarCertificado">
<wsdl:input message="impl:validarCertificadoRequest" name="validarCertificadoRequest"/>
<wsdl:output message="impl:validarCertificadoResponse" name="validarCertificadoResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="WsTestSoapBinding" type="impl:WsTest">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="validarCertificado">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="validarCertificadoRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="validarCertificadoResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="WsTestService">
</wsdl:service>
</wsdl:definitions>
我被迫創建2個包,因爲我有一些具有相同名稱但來自不同架構的元素。
第一包:
package-info.java
@XmlSchema(namespace = "http://ws.test", elementFormDefault = XmlNsForm.QUALIFIED)
package test.ws;
ValidarCertificadoResponse.java
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = { "validarCertificadoReturn" })
@XmlRootElement(name = "validarCertificadoResponse")
public class ValidarCertificadoResponse {
@XmlElement(required = true)
protected MensajeSalida validarCertificadoReturn;
第二封裝:
package-info.java
@XmlSchema(namespace = "http://pojo.test", elementFormDefault = XmlNsForm.QUALIFIED)
package pojo.ws;
MensajeSalida.java
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "MensajeSalida", propOrder = { "peticion", "respuesta", "versionMsg" })
public class MensajeSalida {
@XmlElement(required = true, nillable = true)
protected String peticion;
@XmlElement(required = true, nillable = true)
protected Respuesta respuesta;
@XmlElement(required = true, nillable = true)
protected String versionMsg;
我的響應SOAP消息(它僅包括一些標籤):
<soapenv:Body>
<validarCertificadoResponse xmlns="http://ws.test">
<validarCertificadoReturn>
<peticion>value1</peticion>
<respuesta>
datas
<respuesta/>
<resultadoProcesamiento>
more datas
</resultadoProcesamiento>
執行客戶端之後由jaxws-maven-plugin生成:2.3我的ValidarCertificadoResponse具有下列屬性:
ValidarCertificadoResponse.java
validarCertificadoReturn
peticion = null;
respuesta = null;
resultadoProcesamiento = null;
您是否找不對?我猜WSDL中有錯誤,或者插件沒有正確創建頭文件?
謝謝。