Java JAXB带来的XML SOAP信封为空

Java JAXB带来的XML SOAP信封为空,java,xml,soap,jaxb,unmarshalling,Java,Xml,Soap,Jaxb,Unmarshalling,我试图用JAXB解组XML以将其转换为对象,但是SOAPPArt、SOAPEnvelope和SOAPBody将为空,我不知道为什么 我也尝试过在没有SOAPMessage的情况下解包,但没有成功 以下是我试图解组的XML: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:x

我试图用JAXB解组XML以将其转换为对象,但是SOAPPArt、SOAPEnvelope和SOAPBody将为空,我不知道为什么

我也尝试过在没有SOAPMessage的情况下解包,但没有成功

以下是我试图解组的XML:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
        <ObjectXmlResponse
            xmlns="http://tempuri.org/testing">
            <ResultadoXml xmlns="www.site.com.br">
                <CodigoOperacao>dsadsdas</CodigoOperacao>
                <OperacoesObjetoAnalise />
                <Respostas>
                    <Resposta Final="true">
                        <Sistema>dsadfd</Sistema>
                        <Criterio>fdsfdsf</Criterio>
                        <Resposta>.</Resposta>
                    </Resposta>
                </Respostas>
            </ResultadoXml>
        </ObjectXmlResponse>
    </soap:Body>
</soap:Envelope> 
public static void main(String[] args) {        

        JAXBContext jaxbContext;        

        try {

            String relatorio = <the xml>;

            InputStream is = new ByteArrayInputStream(relatorio.getBytes());

            SOAPMessage message = MessageFactory.newInstance().createMessage(null, is);

            SOAPPart sp = message.getSOAPPart();
            SOAPEnvelope env = sp.getEnvelope();
            SOAPBody bdy = env.getBody();

            jaxbContext = JAXBContext.newInstance(ObjectXmlResponse.class);

            Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();

            ObjectXmlResponse response = (ObjectXmlResponse) jaxbUnmarshaller.unmarshal(new StringReader(relatorio));

            System.out.println(response);


        } catch(Exception ex) {
            ex.printStackTrace();
        }   

        System.exit(0);

    }
这里是解组:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
        <ObjectXmlResponse
            xmlns="http://tempuri.org/testing">
            <ResultadoXml xmlns="www.site.com.br">
                <CodigoOperacao>dsadsdas</CodigoOperacao>
                <OperacoesObjetoAnalise />
                <Respostas>
                    <Resposta Final="true">
                        <Sistema>dsadfd</Sistema>
                        <Criterio>fdsfdsf</Criterio>
                        <Resposta>.</Resposta>
                    </Resposta>
                </Respostas>
            </ResultadoXml>
        </ObjectXmlResponse>
    </soap:Body>
</soap:Envelope> 
public static void main(String[] args) {        

        JAXBContext jaxbContext;        

        try {

            String relatorio = <the xml>;

            InputStream is = new ByteArrayInputStream(relatorio.getBytes());

            SOAPMessage message = MessageFactory.newInstance().createMessage(null, is);

            SOAPPart sp = message.getSOAPPart();
            SOAPEnvelope env = sp.getEnvelope();
            SOAPBody bdy = env.getBody();

            jaxbContext = JAXBContext.newInstance(ObjectXmlResponse.class);

            Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();

            ObjectXmlResponse response = (ObjectXmlResponse) jaxbUnmarshaller.unmarshal(new StringReader(relatorio));

            System.out.println(response);


        } catch(Exception ex) {
            ex.printStackTrace();
        }   

        System.exit(0);

    }
publicstaticvoidmain(字符串[]args){
JAXBContext JAXBContext;
试一试{
字符串relatorio=;
InputStream is=newbytearrayinputstream(relatorio.getBytes());
SOAPMessage message=MessageFactory.newInstance().createMessage(null,is);
SOAPPart sp=message.getSOAPPart();
SOAPEnvelope env=sp.getEnvelope();
SOAPBody bdy=env.getBody();
jaxbContext=jaxbContext.newInstance(ObjectXmlResponse.class);
解组器jaxbUnmarshaller=jaxbContext.createUnmarshaller();
ObjectXmlResponse-response=(ObjectXmlResponse)jaxbUnmarshaller.unmarshal(新StringReader(relatorio));
System.out.println(响应);
}捕获(例外情况除外){
例如printStackTrace();
}   
系统出口(0);
}

我需要填充ObjectXmlResponse对象及其属性,如ResultadoXml。

在所有元素上指定名称空间(或在包上使用@XmlSchema),并使用

ObjectXmlResponse response = (ObjectXmlResponse) jaxbUnmarshaller.unmarshal(bdy.extractContentAsDocument());