use of org.n52.shetland.w3c.soap.SoapChain in project arctic-sea by 52North.
the class SoapBinding method checkSoapInjection.
/**
* Check if SoapHeader information is contained in the body response and add the header information to the
* {@link SoapResponse}
*
* @param chain SoapChain to check
*/
private void checkSoapInjection(SoapChain chain) {
if (chain.getBodyResponse() instanceof CommunicationObjectWithSoapHeader) {
CommunicationObjectWithSoapHeader soapHeaderObject = (CommunicationObjectWithSoapHeader) chain.getBodyResponse();
if (soapHeaderObject.isSetSoapHeader()) {
List<SoapHeader> headers = ((CommunicationObjectWithSoapHeader) chain.getSoapRequest()).getSoapHeader();
// TODO do things
chain.getSoapResponse().setHeader(checkSoapHeaders(headers));
}
}
}
use of org.n52.shetland.w3c.soap.SoapChain in project arctic-sea by 52North.
the class SoapChainResponseWriter method write.
private void write(SoapChain chain, OutputStream out) throws EncodingException, IOException {
String namespace = chain.getSoapResponse().getSoapNamespace();
EncoderKey key = CodingHelper.getEncoderKey(namespace, chain.getSoapResponse());
Encoder<?, SoapResponse> encoder = getEncoder(key);
if (encoder == null) {
throw new NoEncoderForKeyException(key);
}
write(encoder, chain, out);
}
use of org.n52.shetland.w3c.soap.SoapChain in project arctic-sea by 52North.
the class SoapBinding method parseSoapRequest.
private void parseSoapRequest(SoapChain soapChain) throws OwsExceptionReport {
String soapAction = SoapHelper.checkSoapHeader(soapChain.getHttpRequest());
SoapRequest soapRequest = decode(soapChain.getHttpRequest());
if (soapRequest.getSoapAction() == null && soapAction != null) {
soapRequest.setAction(soapAction);
}
soapChain.setSoapRequest(soapRequest);
}
use of org.n52.shetland.w3c.soap.SoapChain in project arctic-sea by 52North.
the class SoapBinding method createSoapResponse.
// private void parseBodyRequest(SoapChain chain) throws OwsExceptionReport,
// OwsExceptionReport {
//
// final XmlObject xmlObject = chain.getSoapRequest().getSoapBodyContent();
// DecoderKey key = CodingHelper.getDecoderKey(xmlObject);
// final Decoder<?, XmlObject> bodyDecoder = getDecoder(key);
// if (bodyDecoder == null) {
// throw new NoDecoderForKeyException(key).setStatus(BAD_REQUEST);
// }
// final Object aBodyRequest = bodyDecoder.decode(xmlObject);
// if (!(aBodyRequest instanceof AbstractServiceRequest)) {
// throw new NoApplicableCodeException().withMessage(
// "The returned object is not an AbstractServiceRequest implementation").setStatus(BAD_REQUEST);
// }
// AbstractServiceRequest bodyRequest = (AbstractServiceRequest)
// aBodyRequest;
// bodyRequest.setRequestContext(getRequestContext(chain.getHttpRequest()));
// if (bodyRequest instanceof CommunicationObjectWithSoapHeader) {
// ((CommunicationObjectWithSoapHeader)
// bodyRequest).setSoapHeader(chain.getSoapRequest().getSoapHeader());
// }
// chain.setBodyRequest(bodyRequest);
// }
private void createSoapResponse(SoapChain chain) {
SoapResponse soapResponse = new SoapResponse();
soapResponse.setSoapVersion(chain.getSoapRequest().getSoapVersion());
soapResponse.setSoapNamespace(chain.getSoapRequest().getSoapNamespace());
soapResponse.setHeader(checkSoapHeaders(chain.getSoapRequest().getSoapHeader()));
chain.setSoapResponse(soapResponse);
}
Aggregations