ОТВЕТ:
<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>
<VPMCSResponse xmlns="http://test.com/webservices">
<VPMCSResult>
<root xmlns="">
<Response>
<Errors/>
<SiteList>
<Type siteid="444444" pcmid="45645645" url="s.test.com" status="ARCHIVED"/>
<Type siteid="444446" pcmid="45664564" url="s.test.com" status="ARCHIVED"/>
<Type siteid="676767" pcmid="45645446" url="s.test.com" status="ACTIVE"/>
</SiteList>
</Response>
</root>
</VPMCSResult>
</VPMCSResponse>
</soap:Body>
</soap:Envelope>
КОД КОНВЕРСИИ:
String responseXmlString = response.getBody().asString();
SOAPMessage message = MessageFactory.newInstance().createMessage(
null,
new ByteArrayInputStream(responseXmlString.getBytes()));
Unmarshaller unmarshaller = JAXBContext.newInstance(Body.class).createUnmarshaller();
Body body = (.Body) unmarshaller.unmarshal(message.getSOAPBody().extractContentAsDocument());
}
**BODY.java**
@Data
@AllArgsConstructor
@NoArgsConstructor
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"vPMCSResponse"
})
@XmlRootElement(name = "Body")
public class Body {
@XmlElement(name = "VPMCSResponse", namespace = "http://test.com/webservices")
private VPMCSResponse vPMCSResponse;
}
ОШИБКА: javax. xml .bind.UnmarshalException: непредвиденный элемент (uri: "http://test.com/webservices", локальный: "VPMCSiteResponse"). Ожидаемые элементы: <{} Body>, <{} Response>, <{} Root>, <{} SiteList>, <{} Type>, <{} VPMCSResponse>, <{} VPMCSResult>