Search in sources :

Example 6 with SoapChain

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));
        }
    }
}
Also used : CommunicationObjectWithSoapHeader(org.n52.iceland.service.CommunicationObjectWithSoapHeader) CommunicationObjectWithSoapHeader(org.n52.iceland.service.CommunicationObjectWithSoapHeader) SoapHeader(org.n52.shetland.w3c.soap.SoapHeader)

Example 7 with SoapChain

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);
}
Also used : NoEncoderForKeyException(org.n52.svalbard.encode.exception.NoEncoderForKeyException) SoapResponse(org.n52.shetland.w3c.soap.SoapResponse) EncoderKey(org.n52.svalbard.encode.EncoderKey)

Example 8 with SoapChain

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);
}
Also used : SoapRequest(org.n52.shetland.w3c.soap.SoapRequest)

Example 9 with SoapChain

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);
}
Also used : SoapResponse(org.n52.shetland.w3c.soap.SoapResponse)

Aggregations

SoapResponse (org.n52.shetland.w3c.soap.SoapResponse)3 NoEncoderForKeyException (org.n52.svalbard.encode.exception.NoEncoderForKeyException)3 OwsExceptionReport (org.n52.shetland.ogc.ows.exception.OwsExceptionReport)2 EncoderKey (org.n52.svalbard.encode.EncoderKey)2 OwsEncodingException (org.n52.iceland.coding.encode.OwsEncodingException)1 ExceptionEvent (org.n52.iceland.event.events.ExceptionEvent)1 HTTPException (org.n52.iceland.exception.HTTPException)1 CommunicationObjectWithSoapHeader (org.n52.iceland.service.CommunicationObjectWithSoapHeader)1 MediaType (org.n52.janmayen.http.MediaType)1 NoApplicableCodeException (org.n52.shetland.ogc.ows.exception.NoApplicableCodeException)1 OwsServiceRequest (org.n52.shetland.ogc.ows.service.OwsServiceRequest)1 SoapChain (org.n52.shetland.w3c.soap.SoapChain)1 SoapHeader (org.n52.shetland.w3c.soap.SoapHeader)1 SoapRequest (org.n52.shetland.w3c.soap.SoapRequest)1 XmlEncoderKey (org.n52.svalbard.encode.XmlEncoderKey)1 EncodingException (org.n52.svalbard.encode.exception.EncodingException)1