javax.xml.soap.SOAPConstants Java Examples
The following examples show how to use
javax.xml.soap.SOAPConstants.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SOAPPart1_2Impl.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
protected Envelope createEnvelopeFromSource() throws SOAPException { XMLDeclarationParser parser = lookForXmlDecl(); Source tmp = source; source = null; EnvelopeImpl envelope = (EnvelopeImpl)EnvelopeFactory.createEnvelope(tmp, this); if (!envelope.getNamespaceURI().equals(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE)) { log.severe("SAAJ0415.ver1_2.msg.invalid.soap1.2"); throw new SOAPException("InputStream does not represent a valid SOAP 1.2 Message"); } if (parser != null) { //can be null if source was a DomSource and not StreamSource if (!omitXmlDecl) { envelope.setOmitXmlDecl("no"); envelope.setXmlDecl(parser.getXmlDeclaration()); envelope.setCharsetEncoding(parser.getEncoding()); } } return envelope; }
Example #2
Source File: SOAPPart1_2Impl.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
protected Envelope createEnvelopeFromSource() throws SOAPException { XMLDeclarationParser parser = lookForXmlDecl(); Source tmp = source; source = null; EnvelopeImpl envelope = (EnvelopeImpl)EnvelopeFactory.createEnvelope(tmp, this); if (!envelope.getNamespaceURI().equals(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE)) { log.severe("SAAJ0415.ver1_2.msg.invalid.soap1.2"); throw new SOAPException("InputStream does not represent a valid SOAP 1.2 Message"); } if (parser != null) { //can be null if source was a DomSource and not StreamSource if (!omitXmlDecl) { envelope.setOmitXmlDecl("no"); envelope.setXmlDecl(parser.getXmlDeclaration()); envelope.setCharsetEncoding(parser.getEncoding()); } } return envelope; }
Example #3
Source File: SOAPPart1_2Impl.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
protected Envelope createEnvelopeFromSource() throws SOAPException { XMLDeclarationParser parser = lookForXmlDecl(); Source tmp = source; source = null; EnvelopeImpl envelope = (EnvelopeImpl)EnvelopeFactory.createEnvelope(tmp, this); if (!envelope.getNamespaceURI().equals(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE)) { log.severe("SAAJ0415.ver1_2.msg.invalid.soap1.2"); throw new SOAPException("InputStream does not represent a valid SOAP 1.2 Message"); } if (parser != null) { //can be null if source was a DomSource and not StreamSource if (!omitXmlDecl) { envelope.setOmitXmlDecl("no"); envelope.setXmlDecl(parser.getXmlDeclaration()); envelope.setCharsetEncoding(parser.getEncoding()); } } return envelope; }
Example #4
Source File: SOAPPart1_1Impl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
protected Envelope createEnvelopeFromSource() throws SOAPException { // Record the presence of xml declaration before the envelope gets // created. XMLDeclarationParser parser = lookForXmlDecl(); Source tmp = source; source = null; EnvelopeImpl envelope = (EnvelopeImpl) EnvelopeFactory.createEnvelope(tmp, this); if (!envelope.getNamespaceURI().equals(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE)) { log.severe("SAAJ0304.ver1_1.msg.invalid.SOAP1.1"); throw new SOAPException("InputStream does not represent a valid SOAP 1.1 Message"); } if (parser != null && !omitXmlDecl) { envelope.setOmitXmlDecl("no"); envelope.setXmlDecl(parser.getXmlDeclaration()); envelope.setCharsetEncoding(parser.getEncoding()); } return envelope; }
Example #5
Source File: SAAJMetaFactoryImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
protected MessageFactory newMessageFactory(String protocol) throws SOAPException { if (SOAPConstants.SOAP_1_1_PROTOCOL.equals(protocol)) { return new com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl(); } else if (SOAPConstants.SOAP_1_2_PROTOCOL.equals(protocol)) { return new com.sun.xml.internal.messaging.saaj.soap.ver1_2.SOAPMessageFactory1_2Impl(); } else if (SOAPConstants.DYNAMIC_SOAP_PROTOCOL.equals(protocol)) { return new com.sun.xml.internal.messaging.saaj.soap.dynamic.SOAPMessageFactoryDynamicImpl(); } else { log.log( Level.SEVERE, "SAAJ0569.soap.unknown.protocol", new Object[] {protocol, "MessageFactory"}); throw new SOAPException("Unknown Protocol: " + protocol + " specified for creating MessageFactory"); } }
Example #6
Source File: SAAJMetaFactoryImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
protected SOAPFactory newSOAPFactory(String protocol) throws SOAPException { if (SOAPConstants.SOAP_1_1_PROTOCOL.equals(protocol)) { return new com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl(); } else if (SOAPConstants.SOAP_1_2_PROTOCOL.equals(protocol)) { return new com.sun.xml.internal.messaging.saaj.soap.ver1_2.SOAPFactory1_2Impl(); } else if (SOAPConstants.DYNAMIC_SOAP_PROTOCOL.equals(protocol)) { return new com.sun.xml.internal.messaging.saaj.soap.dynamic.SOAPFactoryDynamicImpl(); } else { log.log( Level.SEVERE, "SAAJ0569.soap.unknown.protocol", new Object[] {protocol, "SOAPFactory"}); throw new SOAPException("Unknown Protocol: " + protocol + " specified for creating SOAPFactory"); } }
Example #7
Source File: SAAJMetaFactoryImpl.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
protected SOAPFactory newSOAPFactory(String protocol) throws SOAPException { if (SOAPConstants.SOAP_1_1_PROTOCOL.equals(protocol)) { return new com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl(); } else if (SOAPConstants.SOAP_1_2_PROTOCOL.equals(protocol)) { return new com.sun.xml.internal.messaging.saaj.soap.ver1_2.SOAPFactory1_2Impl(); } else if (SOAPConstants.DYNAMIC_SOAP_PROTOCOL.equals(protocol)) { return new com.sun.xml.internal.messaging.saaj.soap.dynamic.SOAPFactoryDynamicImpl(); } else { log.log( Level.SEVERE, "SAAJ0569.soap.unknown.protocol", new Object[] {protocol, "SOAPFactory"}); throw new SOAPException("Unknown Protocol: " + protocol + " specified for creating SOAPFactory"); } }
Example #8
Source File: SOAPPart1_1Impl.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
protected Envelope createEnvelopeFromSource() throws SOAPException { // Record the presence of xml declaration before the envelope gets // created. XMLDeclarationParser parser = lookForXmlDecl(); Source tmp = source; source = null; EnvelopeImpl envelope = (EnvelopeImpl) EnvelopeFactory.createEnvelope(tmp, this); if (!envelope.getNamespaceURI().equals(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE)) { log.severe("SAAJ0304.ver1_1.msg.invalid.SOAP1.1"); throw new SOAPException("InputStream does not represent a valid SOAP 1.1 Message"); } if (parser != null && !omitXmlDecl) { envelope.setOmitXmlDecl("no"); envelope.setXmlDecl(parser.getXmlDeclaration()); envelope.setCharsetEncoding(parser.getEncoding()); } return envelope; }
Example #9
Source File: Fault1_2Impl.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override protected void checkIfStandardFaultCode(String faultCode, String uri) throws SOAPException { QName qname = new QName(uri, faultCode); if (SOAPConstants.SOAP_DATAENCODINGUNKNOWN_FAULT.equals(qname) || SOAPConstants.SOAP_MUSTUNDERSTAND_FAULT.equals(qname) || SOAPConstants.SOAP_RECEIVER_FAULT.equals(qname) || SOAPConstants.SOAP_SENDER_FAULT.equals(qname) || SOAPConstants.SOAP_VERSIONMISMATCH_FAULT.equals(qname)) return; log.log( Level.SEVERE, "SAAJ0435.ver1_2.code.not.standard", qname); throw new SOAPExceptionImpl(qname + " is not a standard Code value"); }
Example #10
Source File: EchoServiceImpl.java From cxf with Apache License 2.0 | 6 votes |
private SOAPFaultException wrapToSoapFault(Exception ex) throws Exception { SOAPFactory fac = null; try { fac = SOAPFactory.newInstance(); String message = ex.getMessage(); SOAPFault sf = fac.createFault(message, new QName(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE, "Server")); sf.setFaultString("TestSOAPFaultException"); // add detail makes CXF goes in a infinite loop sf.addDetail().addDetailEntry(new QName("urn:echo", "entry")).addTextNode("SOAPFaultException"); return new SOAPFaultException(sf); } catch (Exception e2) { throw e2; } }
Example #11
Source File: SOAPPart1_2Impl.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
protected Envelope createEnvelopeFromSource() throws SOAPException { XMLDeclarationParser parser = lookForXmlDecl(); Source tmp = source; source = null; EnvelopeImpl envelope = (EnvelopeImpl)EnvelopeFactory.createEnvelope(tmp, this); if (!envelope.getNamespaceURI().equals(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE)) { log.severe("SAAJ0415.ver1_2.msg.invalid.soap1.2"); throw new SOAPException("InputStream does not represent a valid SOAP 1.2 Message"); } if (parser != null) { //can be null if source was a DomSource and not StreamSource if (!omitXmlDecl) { envelope.setOmitXmlDecl("no"); envelope.setXmlDecl(parser.getXmlDeclaration()); envelope.setCharsetEncoding(parser.getEncoding()); } } return envelope; }
Example #12
Source File: SOAPPart1_2Impl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
protected Envelope createEnvelopeFromSource() throws SOAPException { XMLDeclarationParser parser = lookForXmlDecl(); Source tmp = source; source = null; EnvelopeImpl envelope = (EnvelopeImpl)EnvelopeFactory.createEnvelope(tmp, this); if (!envelope.getNamespaceURI().equals(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE)) { log.severe("SAAJ0415.ver1_2.msg.invalid.soap1.2"); throw new SOAPException("InputStream does not represent a valid SOAP 1.2 Message"); } if (parser != null) { //can be null if source was a DomSource and not StreamSource if (!omitXmlDecl) { envelope.setOmitXmlDecl("no"); envelope.setXmlDecl(parser.getXmlDeclaration()); envelope.setCharsetEncoding(parser.getEncoding()); } } return envelope; }
Example #13
Source File: SOAPFaultDecoderTest.java From feign with Apache License 2.0 | 6 votes |
@Test public void soapDecoderThrowsSOAPFaultException() throws IOException { thrown.expect(SOAPFaultException.class); thrown.expectMessage("Processing error"); Response response = Response.builder() .status(200) .reason("OK") .request(Request.create(HttpMethod.GET, "/api", Collections.emptyMap(), null, Util.UTF_8)) .headers(Collections.emptyMap()) .body(getResourceBytes("/samples/SOAP_1_2_FAULT.xml")) .build(); new SOAPDecoder.Builder().withSOAPProtocol(SOAPConstants.SOAP_1_2_PROTOCOL) .withJAXBContextFactory(new JAXBContextFactory.Builder().build()).build() .decode(response, Object.class); }
Example #14
Source File: SAAJMetaFactoryImpl.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
protected MessageFactory newMessageFactory(String protocol) throws SOAPException { if (SOAPConstants.SOAP_1_1_PROTOCOL.equals(protocol)) { return new com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl(); } else if (SOAPConstants.SOAP_1_2_PROTOCOL.equals(protocol)) { return new com.sun.xml.internal.messaging.saaj.soap.ver1_2.SOAPMessageFactory1_2Impl(); } else if (SOAPConstants.DYNAMIC_SOAP_PROTOCOL.equals(protocol)) { return new com.sun.xml.internal.messaging.saaj.soap.dynamic.SOAPMessageFactoryDynamicImpl(); } else { log.log( Level.SEVERE, "SAAJ0569.soap.unknown.protocol", new Object[] {protocol, "MessageFactory"}); throw new SOAPException("Unknown Protocol: " + protocol + " specified for creating MessageFactory"); } }
Example #15
Source File: SAAJMetaFactoryImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override protected MessageFactory newMessageFactory(String protocol) throws SOAPException { if (SOAPConstants.SOAP_1_1_PROTOCOL.equals(protocol)) { return new com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl(); } else if (SOAPConstants.SOAP_1_2_PROTOCOL.equals(protocol)) { return new com.sun.xml.internal.messaging.saaj.soap.ver1_2.SOAPMessageFactory1_2Impl(); } else if (SOAPConstants.DYNAMIC_SOAP_PROTOCOL.equals(protocol)) { return new com.sun.xml.internal.messaging.saaj.soap.dynamic.SOAPMessageFactoryDynamicImpl(); } else { log.log( Level.SEVERE, "SAAJ0569.soap.unknown.protocol", new Object[] {protocol, "MessageFactory"}); throw new SOAPException("Unknown Protocol: " + protocol + " specified for creating MessageFactory"); } }
Example #16
Source File: SOAPPart1_1Impl.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override protected Envelope createEnvelopeFromSource() throws SOAPException { // Record the presence of xml declaration before the envelope gets // created. XMLDeclarationParser parser = lookForXmlDecl(); Source tmp = source; source = null; EnvelopeImpl envelope = (EnvelopeImpl) EnvelopeFactory.createEnvelope(tmp, this); if (!envelope.getNamespaceURI().equals(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE)) { log.severe("SAAJ0304.ver1_1.msg.invalid.SOAP1.1"); throw new SOAPException("InputStream does not represent a valid SOAP 1.1 Message"); } if (parser != null && !omitXmlDecl) { envelope.setOmitXmlDecl("no"); envelope.setXmlDecl(parser.getXmlDeclaration()); envelope.setCharsetEncoding(parser.getEncoding()); } return envelope; }
Example #17
Source File: SOAPPart1_2Impl.java From hottub with GNU General Public License v2.0 | 6 votes |
protected Envelope createEnvelopeFromSource() throws SOAPException { XMLDeclarationParser parser = lookForXmlDecl(); Source tmp = source; source = null; EnvelopeImpl envelope = (EnvelopeImpl)EnvelopeFactory.createEnvelope(tmp, this); if (!envelope.getNamespaceURI().equals(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE)) { log.severe("SAAJ0415.ver1_2.msg.invalid.soap1.2"); throw new SOAPException("InputStream does not represent a valid SOAP 1.2 Message"); } if (parser != null) { //can be null if source was a DomSource and not StreamSource if (!omitXmlDecl) { envelope.setOmitXmlDecl("no"); envelope.setXmlDecl(parser.getXmlDeclaration()); envelope.setCharsetEncoding(parser.getEncoding()); } } return envelope; }
Example #18
Source File: SAAJMetaFactoryImpl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
protected SOAPFactory newSOAPFactory(String protocol) throws SOAPException { if (SOAPConstants.SOAP_1_1_PROTOCOL.equals(protocol)) { return new com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl(); } else if (SOAPConstants.SOAP_1_2_PROTOCOL.equals(protocol)) { return new com.sun.xml.internal.messaging.saaj.soap.ver1_2.SOAPFactory1_2Impl(); } else if (SOAPConstants.DYNAMIC_SOAP_PROTOCOL.equals(protocol)) { return new com.sun.xml.internal.messaging.saaj.soap.dynamic.SOAPFactoryDynamicImpl(); } else { log.log( Level.SEVERE, "SAAJ0569.soap.unknown.protocol", new Object[] {protocol, "SOAPFactory"}); throw new SOAPException("Unknown Protocol: " + protocol + " specified for creating SOAPFactory"); } }
Example #19
Source File: Fault1_2Impl.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override public SOAPElement addChildElement(SOAPElement element) throws SOAPException { String localName = element.getLocalName(); if ("Detail".equalsIgnoreCase(localName)) { if (hasDetail()) { log.severe("SAAJ0436.ver1_2.detail.exists.error"); throw new SOAPExceptionImpl("Cannot add Detail, Detail already exists"); } String uri = element.getElementQName().getNamespaceURI(); if (!uri.equals(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE)) { log.severe("SAAJ0437.ver1_2.version.mismatch.error"); throw new SOAPExceptionImpl("Cannot add Detail, Incorrect SOAP version specified for Detail element"); } } if (element instanceof Detail1_2Impl) { Element importedElement = importElement(element); addNode(importedElement); return convertToSoapElement(importedElement); } else return super.addChildElement(element); }
Example #20
Source File: SOAPPart1_1Impl.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
protected Envelope createEnvelopeFromSource() throws SOAPException { // Record the presence of xml declaration before the envelope gets // created. XMLDeclarationParser parser = lookForXmlDecl(); Source tmp = source; source = null; EnvelopeImpl envelope = (EnvelopeImpl) EnvelopeFactory.createEnvelope(tmp, this); if (!envelope.getNamespaceURI().equals(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE)) { log.severe("SAAJ0304.ver1_1.msg.invalid.SOAP1.1"); throw new SOAPException("InputStream does not represent a valid SOAP 1.1 Message"); } if (parser != null && !omitXmlDecl) { envelope.setOmitXmlDecl("no"); envelope.setXmlDecl(parser.getXmlDeclaration()); envelope.setCharsetEncoding(parser.getEncoding()); } return envelope; }
Example #21
Source File: AbstractSoapEncoder.java From arctic-sea with Apache License 2.0 | 6 votes |
/** * Creates a SOAPBody element from SOS response * * @param soapResponseMessage * SOAPBody element * @param sosResponse * SOS response * @param actionURI * the action URI * * @return the action URI * * @throws SOAPException * if an error occurs. * @deprecated javax.xml.soap.* is no longer supported from 8.0 because it * was removed from Java */ @Deprecated protected String createSOAPBody(SOAPMessage soapResponseMessage, XmlObject sosResponse, String actionURI) throws SOAPException { if (sosResponse != null) { addAndRemoveSchemaLocationForSOAP(sosResponse, soapResponseMessage); soapResponseMessage.getSOAPBody() .addDocument((Document) sosResponse.getDomNode()); return actionURI; } else { SoapFault fault = new SoapFault(); fault.setFaultCode(SOAPConstants.SOAP_RECEIVER_FAULT); fault.setFaultSubcode(new QName(OWSConstants.NS_OWS, OwsExceptionCode.NoApplicableCode.name(), OWSConstants.NS_OWS_PREFIX)); fault.setFaultReason(DEFAULT_FAULT_REASON); fault.setLocale(Locale.ENGLISH); fault.setDetailText(MISSING_RESPONSE_DETAIL_TEXT); createSOAPFault(soapResponseMessage.getSOAPBody() .addFault(), fault); } return null; }
Example #22
Source File: StreamHeader11.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
protected final FinalArrayList<Attribute> processHeaderAttributes(XMLStreamReader reader) { FinalArrayList<Attribute> atts = null; _role = SOAPConstants.URI_SOAP_ACTOR_NEXT; for (int i = 0; i < reader.getAttributeCount(); i++) { final String localName = reader.getAttributeLocalName(i); final String namespaceURI = reader.getAttributeNamespace(i); final String value = reader.getAttributeValue(i); if (SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE.equals(namespaceURI)) { if (SOAP_1_1_MUST_UNDERSTAND.equals(localName)) { _isMustUnderstand = Util.parseBool(value); } else if (SOAP_1_1_ROLE.equals(localName)) { if (value != null && value.length() > 0) { _role = value; } } } if(atts==null) { atts = new FinalArrayList<Attribute>(); } atts.add(new Attribute(namespaceURI,localName,value)); } return atts; }
Example #23
Source File: WsaTubeHelper.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public SOAPFault newMapRequiredFault(MissingAddressingHeaderException e) { QName subcode = addVer.mapRequiredTag; QName subsubcode = addVer.mapRequiredTag; String faultstring = addVer.getMapRequiredText(); try { SOAPFactory factory; SOAPFault fault; if (soapVer == SOAPVersion.SOAP_12) { factory = SOAPVersion.SOAP_12.getSOAPFactory(); fault = factory.createFault(); fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT); fault.appendFaultSubcode(subcode); fault.appendFaultSubcode(subsubcode); getMapRequiredDetail(e.getMissingHeaderQName(), fault.addDetail()); } else { factory = SOAPVersion.SOAP_11.getSOAPFactory(); fault = factory.createFault(); fault.setFaultCode(subsubcode); } fault.setFaultString(faultstring); return fault; } catch (SOAPException se) { throw new WebServiceException(se); } }
Example #24
Source File: StreamHeader12.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
protected final FinalArrayList<Attribute> processHeaderAttributes(XMLStreamReader reader) { FinalArrayList<Attribute> atts = null; _role = SOAPConstants.URI_SOAP_1_2_ROLE_ULTIMATE_RECEIVER; for (int i = 0; i < reader.getAttributeCount(); i++) { final String localName = reader.getAttributeLocalName(i); final String namespaceURI = reader.getAttributeNamespace(i); final String value = reader.getAttributeValue(i); if (SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE.equals(namespaceURI)) { if (SOAP_1_2_MUST_UNDERSTAND.equals(localName)) { _isMustUnderstand = Util.parseBool(value); } else if (SOAP_1_2_ROLE.equals(localName)) { if (value != null && value.length() > 0) { _role = value; } } else if (SOAP_1_2_RELAY.equals(localName)) { _isRelay = Util.parseBool(value); } } if(atts==null) { atts = new FinalArrayList<Attribute>(); } atts.add(new Attribute(namespaceURI,localName,value)); } return atts; }
Example #25
Source File: WsaTubeHelper.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public SOAPFault createInvalidAddressingHeaderFault(InvalidAddressingHeaderException e, AddressingVersion av) { QName name = e.getProblemHeader(); QName subsubcode = e.getSubsubcode(); QName subcode = av.invalidMapTag; String faultstring = String.format(av.getInvalidMapText(), name, subsubcode); try { SOAPFactory factory; SOAPFault fault; if (soapVer == SOAPVersion.SOAP_12) { factory = SOAPVersion.SOAP_12.getSOAPFactory(); fault = factory.createFault(); fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT); fault.appendFaultSubcode(subcode); fault.appendFaultSubcode(subsubcode); getInvalidMapDetail(name, fault.addDetail()); } else { factory = SOAPVersion.SOAP_11.getSOAPFactory(); fault = factory.createFault(); fault.setFaultCode(subsubcode); } fault.setFaultString(faultstring); return fault; } catch (SOAPException se) { throw new WebServiceException(se); } }
Example #26
Source File: Soap12Encoder.java From arctic-sea with Apache License 2.0 | 5 votes |
private XmlObject createSOAP12FaultFromExceptionResponse(final OwsExceptionReport owsExceptionReport) throws EncodingException { final FaultDocument faultDoc = FaultDocument.Factory.newInstance(); final Fault fault = faultDoc.addNewFault(); final Faultcode code = fault.addNewCode(); code.setValue(SOAPConstants.SOAP_SENDER_FAULT); // we encode only the first exception because of OGC#09-001 Section // 19.2.3 SOAP 1.2 Fault Binding if (!owsExceptionReport.getExceptions().isEmpty()) { final CodedException firstException = owsExceptionReport.getExceptions().get(0); final Subcode subcode = code.addNewSubcode(); QName qName; if (firstException.getCode() != null) { qName = OwsHelper.getQNameForLocalName(firstException.getCode().toString()); } else { qName = OwsHelper.getQNameForLocalName(OwsExceptionCode.NoApplicableCode.name()); } subcode.setValue(qName); final Reasontext addNewText = fault.addNewReason().addNewText(); addNewText.setLang(Locale.ENGLISH.getLanguage()); addNewText.setStringValue(SoapHelper.getSoapFaultReasonText(firstException.getCode())); fault.addNewDetail().set(encodeObjectToXml(OWSConstants.NS_OWS, firstException, EncodingContext.of(XmlBeansEncodingFlags.ENCODE_OWS_EXCEPTION_ONLY))); } return faultDoc; }
Example #27
Source File: Soap11Decoder.java From arctic-sea with Apache License 2.0 | 5 votes |
@Override protected SoapRequest createFault(DecodingException de) { SoapFault fault = new SoapFault(); fault.setFaultCode(QN_CLIENT); fault.setLocale(Locale.ENGLISH); fault.setFaultReason(getFaultReasons(de)); SoapRequest r = new SoapRequest(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE, SOAPConstants.SOAP_1_1_PROTOCOL); r.setSoapFault(fault); return r; }
Example #28
Source File: NameImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
Fault1_2Name(String name, String prefix) { super( (name == null || name.equals("")) ? "Fault" : name, (prefix == null || prefix.equals("")) ? SOAPConstants.SOAP_ENV_PREFIX : prefix, SOAP12_NAMESPACE); }
Example #29
Source File: ParseBodyTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testReadSOAPFault() throws Exception { InputStream inStream = getClass().getResourceAsStream("soap12-fault.xml"); Document doc = StaxUtils.read(inStream); SoapMessage msg = new SoapMessage(new MessageImpl()); Exchange ex = new ExchangeImpl(); ex.setInMessage(msg); SOAPMessage saajMsg = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL).createMessage(); SOAPPart part = saajMsg.getSOAPPart(); SAAJStreamWriter writer = new SAAJStreamWriter(part); StaxUtils.copy(doc, writer); //Source s = new StaxSource(StaxUtils.createXMLStreamReader(doc)); //part.setContent(s); saajMsg.saveChanges(); msg.setContent(SOAPMessage.class, saajMsg); doc = part; // System.out.println("OUTPUT: " + StaxUtils.toString(doc)); byte[] docbytes = getMessageBytes(doc); // System.out.println("OUTPUT: " + new String(docbytes)); XMLStreamReader reader = StaxUtils.createXMLStreamReader(new ByteArrayInputStream(docbytes)); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setValidating(false); dbf.setIgnoringComments(false); dbf.setIgnoringElementContentWhitespace(true); dbf.setNamespaceAware(true); DocumentBuilder db = dbf.newDocumentBuilder(); db.setEntityResolver(new NullResolver()); doc = StaxUtils.read(db, reader, false); }
Example #30
Source File: WsaTubeHelper.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public SOAPFault newMapRequiredFault(MissingAddressingHeaderException e) { QName subcode = addVer.mapRequiredTag; QName subsubcode = addVer.mapRequiredTag; String faultstring = addVer.getMapRequiredText(); try { SOAPFactory factory; SOAPFault fault; if (soapVer == SOAPVersion.SOAP_12) { factory = SOAPVersion.SOAP_12.getSOAPFactory(); fault = factory.createFault(); fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT); fault.appendFaultSubcode(subcode); fault.appendFaultSubcode(subsubcode); getMapRequiredDetail(e.getMissingHeaderQName(), fault.addDetail()); } else { factory = SOAPVersion.SOAP_11.getSOAPFactory(); fault = factory.createFault(); fault.setFaultCode(subsubcode); } fault.setFaultString(faultstring); return fault; } catch (SOAPException se) { throw new WebServiceException(se); } }