Bom dia,
estou novamente com problemas com Webservices. Agora o meu problema é como consumir um webService feito em .NET com tipo complexo que tem o seguinte wsdl
<s:element name="ListarMotivoSegundaVia">
<s:complexType/>
</s:element>
<s:element name="ListarMotivoSegundaViaResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="ListarMotivoSegundaViaResult">
<s:complexType mixed="true">
<s:sequence>
<s:any/>
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
a classe gerada pelo wsimport é a seguinte
package PortalTUI;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlMixed;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"listarMotivoSegundaViaResult"
})
@XmlRootElement(name = "ListarMotivoSegundaViaResponse")
public class ListarMotivoSegundaViaResponse {
@XmlElement(name = "ListarMotivoSegundaViaResult")
protected ListarMotivoSegundaViaResponse.ListarMotivoSegundaViaResult listarMotivoSegundaViaResult;
public ListarMotivoSegundaViaResponse.ListarMotivoSegundaViaResult getListarMotivoSegundaViaResult() {
return listarMotivoSegundaViaResult;
}
public void setListarMotivoSegundaViaResult(ListarMotivoSegundaViaResponse.ListarMotivoSegundaViaResult value) {
this.listarMotivoSegundaViaResult = value;
}
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"content"
})
public static class ListarMotivoSegundaViaResult {
@XmlMixed
@XmlAnyElement(lax = true)
protected List<Object> content;
public List<Object> getContent() {
if (content == null) {
content = new ArrayList<Object>();
}
return this.content;
}
}
}
a mensagem de retorno fica com a seguinte estrutura:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Header/>
<soap:Body>
<ListarMotivoSegundaViaResponse xmlns="http://tempuri.org/">
<ListarMotivoSegundaViaResult>
<motivos xmlns="">
<motivo>
<id_segunda_via_motivo>2</id_segunda_via_motivo>
<descricao_segunda_via_motivo>ATUALIZAÇÃO DE DADOS</descricao_segunda_via_motivo>
</motivo>
</motivos>
</ListarMotivoSegundaViaResult>
</ListarMotivoSegundaViaResponse>
</soap:Body>
</soap:Envelope>
porem quando vou tentar recuperar as informações ele não consegue pegar este resultado. quando pego o content de um List obtido ele simplesmente imprime [motivo: null]
alguem sabe o que pode estar acontecendo? é erro no WSDL ou o problema é na classe criada? Preciso de uma nova classe para fazer essa leitura?
desde já, agradeço a todos que tentarem ajudar.
Grato,
Fernando de Almeida