Search in sources :

Example 11 with DecoderKey

use of org.n52.svalbard.decode.DecoderKey in project arctic-sea by 52North.

the class AbstractXmlBindingTest method test_GetCaps.

@Test
public void test_GetCaps() throws CodedException {
    DecoderKey decoderKey = binding.getDecoderKey(xmlStringGetCaps, characterEncoding);
    if (decoderKey instanceof OperationDecoderKey) {
        assertThat(((OperationDecoderKey) decoderKey).getService(), is("SOS"));
        assertThat(((OperationDecoderKey) decoderKey).getOperation(), is("GetCapabilities"));
    }
}
Also used : OperationDecoderKey(org.n52.svalbard.decode.OperationDecoderKey) XmlNamespaceOperationDecoderKey(org.n52.svalbard.decode.XmlNamespaceOperationDecoderKey) DecoderKey(org.n52.svalbard.decode.DecoderKey) OperationDecoderKey(org.n52.svalbard.decode.OperationDecoderKey) XmlNamespaceOperationDecoderKey(org.n52.svalbard.decode.XmlNamespaceOperationDecoderKey) Test(org.junit.Test)

Example 12 with DecoderKey

use of org.n52.svalbard.decode.DecoderKey in project arctic-sea by 52North.

the class AbstractXmlBindingTest method test_SoapPrefix.

@Test
public void test_SoapPrefix() throws CodedException {
    DecoderKey decoderKey = binding.getDecoderKey(xmlStringSoapPrefix, characterEncoding);
    assertTrue(decoderKey instanceof XmlNamespaceOperationDecoderKey);
    assertTrue(SoapConstants.NS_SOAP_12.equals(((XmlNamespaceOperationDecoderKey) decoderKey).getNamespace()));
}
Also used : XmlNamespaceOperationDecoderKey(org.n52.svalbard.decode.XmlNamespaceOperationDecoderKey) OperationDecoderKey(org.n52.svalbard.decode.OperationDecoderKey) XmlNamespaceOperationDecoderKey(org.n52.svalbard.decode.XmlNamespaceOperationDecoderKey) DecoderKey(org.n52.svalbard.decode.DecoderKey) Test(org.junit.Test)

Example 13 with DecoderKey

use of org.n52.svalbard.decode.DecoderKey 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

DecoderKey (org.n52.svalbard.decode.DecoderKey)9 OperationDecoderKey (org.n52.svalbard.decode.OperationDecoderKey)8 XmlStringOperationDecoderKey (org.n52.svalbard.decode.XmlStringOperationDecoderKey)6 Test (org.junit.Test)5 XmlNamespaceOperationDecoderKey (org.n52.svalbard.decode.XmlNamespaceOperationDecoderKey)5 HashSet (java.util.HashSet)4 XmlNamespaceDecoderKey (org.n52.svalbard.decode.XmlNamespaceDecoderKey)4 XmlObject (org.apache.xmlbeans.XmlObject)2 NoApplicableCodeException (org.n52.shetland.ogc.ows.exception.NoApplicableCodeException)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 OwsDecodingException (org.n52.iceland.coding.decode.OwsDecodingException)1 FeatureCollection (org.n52.shetland.ogc.om.features.FeatureCollection)1 InvalidParameterValueException (org.n52.shetland.ogc.ows.exception.InvalidParameterValueException)1 MissingParameterValueException (org.n52.shetland.ogc.ows.exception.MissingParameterValueException)1 OwsOperationKey (org.n52.shetland.ogc.ows.service.OwsOperationKey)1 OwsServiceCommunicationObject (org.n52.shetland.ogc.ows.service.OwsServiceCommunicationObject)1 GetFeatureOfInterestResponse (org.n52.shetland.ogc.sos.response.GetFeatureOfInterestResponse)1