use of org.n52.shetland.w3c.SchemaLocation in project arctic-sea by 52North.
the class EReportingHeaderEncoder method write.
@Override
public void write() throws XMLStreamException, EncodingException {
EReportingHeader h = getElement();
start(AqdConstants.QN_AQD_REPORTING_HEADER);
namespace(AqdConstants.NS_AD_PREFIX, AqdConstants.NS_AD);
namespace(AqdConstants.NS_AQD_PREFIX, AqdConstants.NS_AQD);
namespace(AqdConstants.NS_BASE_PREFIX, AqdConstants.NS_BASE);
namespace(AqdConstants.NS_BASE2_PREFIX, AqdConstants.NS_BASE2);
namespace(AqdConstants.NS_GN_PREFIX, AqdConstants.NS_GN);
namespace(GmlConstants.NS_GML_PREFIX, GmlConstants.NS_GML_32);
namespace(W3CConstants.NS_XLINK_PREFIX, W3CConstants.NS_XLINK);
namespace(W3CConstants.NS_XSI_PREFIX, W3CConstants.NS_XSI);
namespace(GcoConstants.NS_GCO_PREFIX, GcoConstants.NS_GCO);
if (isAddSchemaLocation()) {
schemaLocation(Collections.singleton(AqdConstants.NS_AQD_SCHEMA_LOCATION));
}
attr(GmlConstants.QN_ID_32, getGMLId(h));
encodeChange(h.getChange());
encodeInpireID(h.getInspireID());
encodeReportingAuthority(h.getReportingAuthority());
encodeReportingPeriod(h.getReportingPeriod());
if (h.isSetContent()) {
encodeContent(h.getContent());
}
end(AqdConstants.QN_AQD_REPORTING_HEADER);
}
use of org.n52.shetland.w3c.SchemaLocation in project arctic-sea by 52North.
the class GetDataAvailabilityStreamWriter method writeGetDataAvailabilityResponse.
@Override
protected void writeGetDataAvailabilityResponse() throws XMLStreamException, EncodingException {
start(GetDataAvailabilityConstants.GDA_GET_DATA_AVAILABILITY_RESPONSE);
namespace(GetDataAvailabilityConstants.NS_GDA_PREFIX, GetDataAvailabilityConstants.NS_GDA);
namespace(GmlConstants.NS_GML_PREFIX, GmlConstants.NS_GML_32);
namespace(SweConstants.NS_SWE_PREFIX, SweConstants.NS_SWE_20);
namespace(W3CConstants.NS_XLINK_PREFIX, W3CConstants.NS_XLINK);
schemaLocation(Sets.newHashSet(GetDataAvailabilityConstants.GET_DATA_AVAILABILITY_SCHEMA_LOCATION));
for (DataAvailability da : getElement()) {
wirteDataAvailabilityMember(da);
}
end(GetDataAvailabilityConstants.GDA_GET_DATA_AVAILABILITY_RESPONSE);
}
use of org.n52.shetland.w3c.SchemaLocation in project arctic-sea by 52North.
the class Soap12XmlStreamWriter method getSchemaLocation.
protected Set<SchemaLocation> getSchemaLocation() throws EncodingException, XMLStreamException {
SoapResponse response = getElement();
Set<SchemaLocation> schemaLocations = Sets.newHashSet();
schemaLocations.add(SoapConstants.SOAP_12_SCHEMA_LOCATION);
if (response.isSetBodyContent()) {
Encoder<Object, OwsServiceResponse> encoder = getEncoder(response.getBodyContent());
if (encoder != null && encoder instanceof SchemaAwareEncoder) {
schemaLocations.addAll(((SchemaAwareEncoder<?, ?>) encoder).getSchemaLocations());
}
}
return schemaLocations;
}
use of org.n52.shetland.w3c.SchemaLocation in project arctic-sea by 52North.
the class Soap12Encoder method createSOAP12Envelope.
private XmlObject createSOAP12Envelope(SoapResponse response, EncodingContext additionalValues) throws EncodingException {
String action = null;
final EnvelopeDocument envelopeDoc = EnvelopeDocument.Factory.newInstance();
final Envelope envelope = envelopeDoc.addNewEnvelope();
final Body body = envelope.addNewBody();
if (response.getSoapFault() != null) {
body.set(createSOAP12Fault(response.getSoapFault()));
} else {
if (response.getException() != null) {
if (!response.getException().getExceptions().isEmpty()) {
final CodedException firstException = response.getException().getExceptions().get(0);
action = getExceptionActionURI(firstException.getCode());
}
body.set(createSOAP12FaultFromExceptionResponse(response.getException()));
N52XmlHelper.setSchemaLocationsToDocument(envelopeDoc, Sets.newHashSet(N52XmlHelper.getSchemaLocationForSOAP12(), N52XmlHelper.getSchemaLocationForOWS110Exception()));
} else {
action = response.getSoapAction();
final XmlObject bodyContent = getBodyContent(response);
String value = null;
Node nodeToRemove = null;
final NamedNodeMap attributeMap = bodyContent.getDomNode().getFirstChild().getAttributes();
for (int i = 0; i < attributeMap.getLength(); i++) {
final Node node = attributeMap.item(i);
if (node.getLocalName().equals(W3CConstants.AN_SCHEMA_LOCATION)) {
value = node.getNodeValue();
nodeToRemove = node;
}
}
if (nodeToRemove != null) {
attributeMap.removeNamedItem(nodeToRemove.getNodeName());
}
final Set<SchemaLocation> schemaLocations = Sets.newHashSet();
schemaLocations.add(N52XmlHelper.getSchemaLocationForSOAP12());
if (value != null && !value.isEmpty()) {
String[] split = value.split(" ");
for (int i = 0; i < split.length; i += 2) {
schemaLocations.add(new SchemaLocation(split[i], split[i + 1]));
}
}
N52XmlHelper.setSchemaLocationsToDocument(envelopeDoc, schemaLocations);
body.set(bodyContent);
}
}
if (response.getHeader() != null) {
createSOAP12Header(envelope, response.getHeader(), action);
} else {
envelope.addNewHeader();
}
// checkAndValidateSoapMessage(envelopeDoc);
return envelopeDoc;
}
use of org.n52.shetland.w3c.SchemaLocation in project arctic-sea by 52North.
the class DescribeSensorResponseEncoderTest method should_return_correct_schema_location.
@Test
public void should_return_correct_schema_location() {
assertThat(new DescribeSensorResponseEncoder().getSchemaLocations().size(), is(1));
SchemaLocation schemLoc = new DescribeSensorResponseEncoder().getSchemaLocations().iterator().next();
assertThat(schemLoc.getNamespace(), is("http://www.opengis.net/swes/2.0"));
assertThat(schemLoc.getSchemaFileUrl(), is("http://schemas.opengis.net/swes/2.0/swes.xsd"));
}
Aggregations