All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.codecentric.cxf.soaprawclient.SoapRawClientResponse Maven / Gradle / Ivy

Go to download

Boot starter for SOAP-Webservices with Apache CXF using JAX-WS & JAXB with Annotations only

There is a newer version: 2.7.0
Show newest version
package de.codecentric.cxf.soaprawclient;

import org.w3c.dom.Document;
import org.w3c.dom.Node;

import de.codecentric.cxf.common.BootStarterCxfException;
import de.codecentric.cxf.common.XmlUtils;

public class SoapRawClientResponse {

	private int httpStatusCode;
	private Document httpResponseBody;
		
	public int getHttpStatusCode() {
		return httpStatusCode;
	}
	public void setHttpStatusCode(int httpStatusCode) {
		this.httpStatusCode = httpStatusCode;
	}
	public Document getHttpResponseBody() {
		return httpResponseBody;
	}
	public void setHttpResponseBody(Document httpResponseBody) {
		this.httpResponseBody = httpResponseBody;
	}
	
	public Node getElementByNameWithNamespace(String namespaceUrl, String elementName) {
		return httpResponseBody.getElementsByTagNameNS(namespaceUrl, elementName).item(0);
	}
	
	public String getElementValueByName(String elementName) {
		Node node = httpResponseBody.getElementsByTagName(elementName).item(0);
		return node.getNodeValue();
	}
	
	public String getFaultstringValue() {
		Node fault = getElementByNameWithNamespace("http://schemas.xmlsoap.org/soap/envelope/", "Fault");
		// The second Node (with List-Nr. 1) is the 
		Node faultstring = fault.getChildNodes().item(1);
		return faultstring.getTextContent();
	}
	
	public  T getUnmarshalledObjectFromSoapMessage(Class jaxbClass) throws BootStarterCxfException {
		return XmlUtils.getUnmarshalledObjectFromSoapMessage(httpResponseBody, jaxbClass);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy