use of org.n52.shetland.w3c.soap.SoapRequest in project arctic-sea by 52North.
the class Soap11Decoder method createFault.
@Override
protected SoapRequest createFault(DecodingException de) {
SoapFault fault = new SoapFault();
fault.setFaultCode(QN_CLIENT);
fault.setLocale(Locale.ENGLISH);
fault.setFaultReason(de.getMessage());
SoapRequest r = new SoapRequest(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE, SOAPConstants.SOAP_1_1_PROTOCOL);
r.setSoapFault(fault);
return r;
}
use of org.n52.shetland.w3c.soap.SoapRequest in project arctic-sea by 52North.
the class Soap12Decoder method createFault.
@Override
protected SoapRequest createFault(DecodingException de) {
SoapFault fault = new SoapFault();
fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
fault.setLocale(Locale.ENGLISH);
fault.setFaultReason(de.getMessage());
SoapRequest r = new SoapRequest(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE, SOAPConstants.SOAP_1_2_PROTOCOL);
r.setSoapFault(fault);
return r;
}
use of org.n52.shetland.w3c.soap.SoapRequest 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.SoapRequest in project arctic-sea by 52North.
the class Soap11Decoder method createEnvelope.
/**
* Parses SOAP 1.1 Envelope to a SOS internal SOAP request.
*
* @param doc Request as xml representation
*
* @return SOS internal SOAP request
*
* @throws DecodingException if an error occurs.
*/
@Override
protected SoapRequest createEnvelope(XmlObject doc) throws DecodingException {
SoapRequest soapRequest = new SoapRequest(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE, SOAPConstants.SOAP_1_1_PROTOCOL);
String soapAction = "";
try {
SOAPMessage soapMessageRequest;
try {
soapMessageRequest = SoapHelper.getSoapMessageForProtocol(SOAPConstants.SOAP_1_1_PROTOCOL, doc.newInputStream());
} catch (IOException | SOAPException ioe) {
throw new NoApplicableCodeException().causedBy(ioe).withMessage("Error while parsing SOAPMessage from request string!");
}
// if SOAPAction is not spec conform, create SOAPFault
if (soapAction.isEmpty() || !soapAction.startsWith(SOAP_ACTION)) {
SoapFault fault = new SoapFault();
fault.setFaultCode(QN_CLIENT);
fault.setFaultReason("The SOAPAction parameter in the HTTP-Header is missing or not valid!");
fault.setLocale(Locale.ENGLISH);
soapRequest.setSoapFault(fault);
soapRequest.setSoapFault(fault);
} else {
// trim SOAPAction value
soapAction = soapAction.replace("\"", "").replace(" ", "").replace(SOAP_ACTION, "").trim();
}
try {
if (soapMessageRequest.getSOAPHeader() != null) {
soapRequest.setSoapHeader(getSoapHeader(soapMessageRequest.getSOAPHeader()));
}
soapRequest.setAction(checkSoapAction(soapAction, soapRequest.getSoapHeader()));
soapRequest.setSoapBodyContent(getSOAPBodyContent(soapMessageRequest));
} catch (SOAPException | DecodingException soape) {
throw new NoApplicableCodeException().causedBy(soape).withMessage("Error while parsing SOAPMessage!");
}
} catch (OwsExceptionReport owse) {
throw new DecodingException(owse);
}
return soapRequest;
}
use of org.n52.shetland.w3c.soap.SoapRequest in project arctic-sea by 52North.
the class Soap12Decoder method createEnvelope.
/**
* Parses SOAP 1.2 Envelope to a SOS internal SOAP request.
*
* @param doc
* request as xml representation
*
* @return SOS internal SOAP request
*
* @throws DecodingException
* if an error occurs.
*/
@Override
protected SoapRequest createEnvelope(XmlObject doc) throws DecodingException {
SoapRequest soapRequest = new SoapRequest(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE, SOAPConstants.SOAP_1_2_PROTOCOL);
String soapAction = "";
try {
SOAPMessage message;
try {
message = SoapHelper.getSoapMessageForProtocol(SOAPConstants.SOAP_1_2_PROTOCOL, doc.newInputStream());
} catch (IOException | SOAPException ioe) {
throw new NoApplicableCodeException().causedBy(ioe).withMessage("Error while parsing SOAPMessage from request string!");
}
try {
if (message.getSOAPHeader() != null) {
soapRequest.setSoapHeader(getSoapHeader(message.getSOAPHeader()));
}
soapRequest.setAction(checkSoapAction(soapAction, soapRequest.getSoapHeader()));
soapRequest.setSoapBodyContent(getBodyContent((EnvelopeDocument) doc));
} catch (SOAPException soape) {
throw new NoApplicableCodeException().causedBy(soape).withMessage("Error while parsing SOAPMessage!");
}
} catch (OwsExceptionReport owse) {
throw new DecodingException(owse);
}
return soapRequest;
}
Aggregations