Refine search
private org.apache.axiom.soap.SOAPEnvelope toEnvelope(final org.apache.axiom.soap.SOAPFactory factory, final CadConsultaCadastro4Stub.NfeDadosMsg param, final boolean optimizeContent, final javax.xml.namespace.QName elementQName) throws org.apache.axis2.AxisFault { try { final org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope(); emptyEnvelope.getBody().addChild(param.getOMElement(CadConsultaCadastro4Stub.NfeDadosMsg.MY_QNAME, factory)); return emptyEnvelope; } catch (final org.apache.axis2.databinding.ADBException e) { throw org.apache.axis2.AxisFault.makeFault(e); } }
public AxisMessage encode(ClientOptions options, String message) throws Exception { AxisMessage result = new AxisMessage(); result.setMessageType("text/plain"); SOAPFactory factory = OMAbstractFactory.getSOAP11Factory(); SOAPEnvelope envelope = factory.getDefaultEnvelope(); OMElement wrapper = factory.createOMElement(BaseConstants.DEFAULT_TEXT_WRAPPER); wrapper.addChild(factory.createOMText(message)); envelope.getBody().addChild(wrapper); result.setEnvelope(envelope); return result; } };
private void addPayload() throws XMLStreamException { if (elementDepth <= 0 && !payloadAdded) { delegate.flush(); if (baos.size() > 0) { byte[] buf = baos.toByteArray(); OMDataSource dataSource = new ByteArrayDataSource(buf, encoding); OMNamespace namespace = getAxiomFactory().createOMNamespace(name.getNamespaceURI(), name.getPrefix()); OMElement payloadElement = getAxiomFactory().createOMElement(dataSource, name.getLocalPart(), namespace); getAxiomBody().addChild(payloadElement); payloadAdded = true; } } }
SOAPFactory fac = OMAbstractFactory.getSOAP11Factory(); SOAPEnvelope envelope = fac.getDefaultEnvelope(); OMNamespace xsi = fac.createOMNamespace("http://www.w3.org/2001/XMLSchema-instance", "xsi"); envelope.declareNamespace(xsi); OMNamespace methodNs = fac.createOMNamespace("http://somedomain.com/wsinterface", "ns1"); OMElement method = fac.createOMElement("CreateEntityTypesResponse", methodNs); //add the newkeys and errors as OMElements here...
private SOAPEnvelope buildSoapEnvelope(String clientID, String value) { SOAPFactory soapFactory = OMAbstractFactory.getSOAP12Factory(); SOAPEnvelope envelope = soapFactory.createSOAPEnvelope(); SOAPHeader header = soapFactory.createSOAPHeader(); envelope.addChild(header); OMNamespace synNamespace = soapFactory. createOMNamespace("http://ws.apache.org/ns/synapse", "syn"); OMElement clientIDElement = soapFactory.createOMElement("ClientID", synNamespace); clientIDElement.setText(clientID); header.addChild(clientIDElement); SOAPBody body = soapFactory.createSOAPBody(); envelope.addChild(body); OMElement valueElement = soapFactory.createOMElement("Value", null); valueElement.setText(value); body.addChild(valueElement); return envelope; }
if (messageCtx.isSOAP11()) { soapFactory = OMAbstractFactory.getSOAP11Factory(); SOAPEnvelope message = soapFactory.getDefaultFaultEnvelope(); SOAPFaultReason soapFaultReason = soapFactory.createSOAPFaultReason(); soapFaultReason.setText(reason); message.getBody().getFault().setReason(soapFaultReason); SOAPFaultCode soapFaultCode = soapFactory.createSOAPFaultCode(); QName qNameSubCode = new QName("http://wso2.org/passivests", subCode, "sts"); soapFaultCode.setText(qNameSubCode); message.getBody().getFault().setCode(soapFaultCode); return message.getBody().getFault(); } else { soapFactory = OMAbstractFactory.getSOAP12Factory(); SOAPEnvelope message = soapFactory.getDefaultFaultEnvelope(); SOAPFaultDetail soapFaultDetail = soapFactory.createSOAPFaultDetail(); soapFaultDetail.setText(detail); message.getBody().getFault().setDetail(soapFaultDetail); SOAPFaultReason soapFaultReason = soapFactory.createSOAPFaultReason(); SOAPFaultText soapFaultText = soapFactory.createSOAPFaultText(); soapFaultText.setText(reason); soapFaultReason.addSOAPText(soapFaultText); message.getBody().getFault().setReason(soapFaultReason); SOAPFaultCode soapFaultCode = soapFactory.createSOAPFaultCode(); SOAPFaultValue soapFaultValue = soapFactory.createSOAPFaultValue(soapFaultCode); soapFaultValue.setText(code); soapFaultCode.setValue(soapFaultValue); SOAPFaultSubCode soapFaultSubCode = soapFactory.createSOAPFaultSubCode(soapFaultCode); SOAPFaultValue soapFaultValueSub = soapFactory.createSOAPFaultValue(soapFaultSubCode); QName qNameSubCode = new QName("http://wso2.org/passivests", subCode, "sts");
final SOAPFactory factory = (SOAPFactory) env.getOMFactory(); final SOAPBody body = env.getBody(); SOAPFault fault = body.getFault(); fault = factory.createSOAPFault(body); final boolean isSoap11 = env.getVersion() instanceof SOAP11Version; final SOAPFaultCode fCode = factory.createSOAPFaultCode(fault); final QName faultValue = new QName(env.getNamespaceURI(), "Client"); if (isSoap11) { fCode.setText(faultValue); } else { final SOAPFaultValue fValue = factory.createSOAPFaultValue(fCode); fValue.setText(faultValue); final SOAPFaultReason fReason = factory.createSOAPFaultReason(fault); final String reason = "An error occurred while processing the received ebMS message. Check ebMS errors for details."; fReason.setText(reason); } else { final SOAPFaultText fReasonText = factory.createSOAPFaultText(fReason); fReasonText.setText(reason); fReasonText.setLang("en");
private static void makeMakeConnectionFault(RMMsgContext referenceRMMsgContext, FaultData data) throws AxisFault { SOAPFactory factory = (SOAPFactory) referenceRMMsgContext.getSOAPEnvelope().getOMFactory(); SOAPFaultCode faultCode = factory.createSOAPFaultCode(); SOAPFaultSubCode faultSubCode = factory.createSOAPFaultSubCode(faultCode); SOAPFaultValue faultColdValue = factory.createSOAPFaultValue(faultCode); SOAPFaultValue faultSubcodeValue = factory.createSOAPFaultValue(faultSubCode); SOAPFaultReason reason = factory.createSOAPFaultReason(); SOAPFaultText reasonText = factory.createSOAPFaultText(); reasonText.setText(data.getReason()); SOAPFaultDetail detail = factory.createSOAPFaultDetail(); if (data.getDetail() != null) detail.addDetailEntry(data.getDetail()); String SOAPNamespaceValue = factory.getSoapVersionURI(); AxisFault fault = new AxisFault(faultColdValue.getTextAsQName(), data.getReason(), "", "", data.getDetail()); fault.setFaultAction(Sandesha2Constants.SPEC_2007_02.Actions.MC_FAULT);
private void serializeSoapException11( XMLStreamWriter writer, SOAPException exception, String ns, String prefix ) throws XMLStreamException { writer.writeStartElement( "soapenv", envelope.getLocalName(), ns ); writer.writeNamespace( "soapenv", ns ); writer.writeNamespace( "xsi", XSINS ); writeHeader( writer, header ); SOAPBody body = envelope.getBody(); writer.writeStartElement( ns, body.getLocalName() ); writeAttributes( writer, body ); SOAPFault fault = factory.createSOAPFault( body ); writer.writeStartElement( ns, fault.getLocalName() ); writeAttributes( writer, fault ); SOAPFaultCode code = factory.createSOAPFaultCode( fault ); writer.writeStartElement( code.getLocalName() ); writeAttributes( writer, code ); SOAPFaultReason reason = factory.createSOAPFaultReason( fault ); writer.writeStartElement( reason.getLocalName() ); writeAttributes( writer, reason ); SOAPFaultDetail detail = factory.createSOAPFaultDetail( fault ); writer.writeStartElement( detail.getLocalName() ); writeAttributes( writer, detail );
public static void triggerAxisFault(MessageContext messageContext, WSTransferException wste) throws AxisFault{ SOAPFactory fac = (SOAPFactory) envelope.getOMFactory(); String soapNSURI = fac.getSoapVersionURI(); SOAPFaultCode faultCode = fac.createSOAPFaultCode(); SOAPFaultValue faultCodeValue = fac.createSOAPFaultValue(faultCode); faultCodeValue.setText(wste.getCode()); SOAPFaultSubCode faultSubCode = fac.createSOAPFaultSubCode(faultCode); SOAPFaultValue faultSubCodeValue = fac.createSOAPFaultValue(faultSubCode); faultSubCodeValue.setText(wste.getSubCode()); SOAPFaultReason faultReason = fac.createSOAPFaultReason(); SOAPFaultText faultText = fac.createSOAPFaultText(faultReason); faultText.setText(wste.getReason()); if (detail != null) { SOAPFaultDetail faultDetail = fac.createSOAPFaultDetail(); faultDetail.setText(detail); messageContext.setProperty(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME, faultDetail); throw AxisFault.makeFault(wste);
public void setStreamingPayload(StreamingPayload payload) { Assert.notNull(payload, "'payload' must not be null"); OMDataSource dataSource = new StreamingOMDataSource(payload); OMElement payloadElement = getAxiomFactory().createOMElement(dataSource, payload.getName()); SOAPBody soapBody = getAxiomBody(); AxiomUtils.removeContents(soapBody); soapBody.addChild(payloadElement); } }
SOAPFactory factory = OMAbstractFactory.getSOAP11Factory(); SOAPEnvelope envelope = factory.getDefaultEnvelope(); OMElement xmlElement= factory.createOMElement("search", envelope.getDefaultNamespace()); envelope.getBody().addChild(xmlElement); OMTextImpl omText = (OMTextImpl) xmlElement.getOMFactory().createOMText(xmlElement, xmlForCdata, XMLStreamConstants.CDATA); xmlElement.addChild(omText); System.out.println(envelope.toStringWithConsume());
private SOAPFault addStandardFault(String localName, String faultStringOrReason, Locale locale) { Assert.notNull(faultStringOrReason, "No faultStringOrReason given"); try { AxiomUtils.removeContents(getAxiomBody()); SOAPFault fault = getAxiomFactory().createSOAPFault(getAxiomBody()); SOAPFaultCode code = getAxiomFactory().createSOAPFaultCode(fault); SOAPFaultValue value = getAxiomFactory().createSOAPFaultValue(code); value.setText(fault.getNamespace().getPrefix() + ":" + localName); SOAPFaultReason reason = getAxiomFactory().createSOAPFaultReason(fault); SOAPFaultText text = getAxiomFactory().createSOAPFaultText(reason); if (locale != null) { text.setLang(AxiomUtils.toLanguage(locale)); } text.setText(faultStringOrReason); return fault; } catch (SOAPProcessingException ex) { throw new AxiomSoapFaultException(ex); } }
@Override public Soap11Fault addFault(QName code, String faultString, Locale faultStringLocale) { Assert.notNull(code, "No faultCode given"); Assert.hasLength(faultString, "faultString cannot be empty"); if (!StringUtils.hasLength(code.getNamespaceURI())) { throw new IllegalArgumentException( "A fault code with namespace and local part must be specific for a custom fault code"); } if (!langAttributeOnSoap11FaultString) { faultStringLocale = null; } try { AxiomUtils.removeContents(getAxiomBody()); SOAPFault fault = getAxiomFactory().createSOAPFault(getAxiomBody()); SOAPFaultCode faultCode = getAxiomFactory().createSOAPFaultCode(fault); setValueText(code, fault, faultCode); SOAPFaultReason faultReason = getAxiomFactory().createSOAPFaultReason(fault); if (faultStringLocale != null) { addLangAttribute(faultStringLocale, faultReason); } faultReason.setText(faultString); return new AxiomSoap11Fault(fault, getAxiomFactory()); } catch (SOAPProcessingException ex) { throw new AxiomSoapFaultException(ex); } }
/** * Crete SOAP Fault from fault information returned from ODE. * * @param bpelMessageContext DTO containing information on current messageflow. * @param odeMessageContext ODE MyRoleMessageExchange containing information on current process * invocation. * @return SOAPFault instance * @throws AxisFault in case of a error while creating SOAP Fault. */ public static SOAPFault createSoapFault(final BPELMessageContext bpelMessageContext, final MessageExchange odeMessageContext) throws AxisFault { SOAPFactory soapFactory = bpelMessageContext.getSoapFactoryForCurrentMessageFlow(); OMElement detail = buildSoapDetail(bpelMessageContext, odeMessageContext); SOAPFault fault = soapFactory.createSOAPFault(); SOAPFaultCode code = soapFactory.createSOAPFaultCode(fault); code.setText(new QName(Namespaces.SOAP_ENV_NS, "Server")); SOAPFaultReason reason = soapFactory.createSOAPFaultReason(fault); reason.setText(odeMessageContext.getFault()); SOAPFaultDetail soapDetail = soapFactory.createSOAPFaultDetail(fault); if (detail != null) { soapDetail.addDetailEntry(detail); } return fault; }
private static OMElement createRPCWrapperElement( SOAPBody soapBody, SOAPFactory soapFactory, QName wrapperElementName) { return soapFactory.createOMElement(wrapperElementName, soapBody); }
private static void setFaultCode(MessageContext messageContext, String faultCode, String faultSubCode) { SOAPFactory soapFac = OMAbstractFactory.getSOAP12Factory(); SOAPFaultCode soapFaultCode = soapFac.createSOAPFaultCode(); if (messageContext.isSOAP11()) { soapFaultCode.setText(faultCode); } else { SOAPFaultValue soapFaultValue = soapFac.createSOAPFaultValue(soapFaultCode); soapFaultValue.setText(SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX + ":" + SOAP12Constants.FAULT_CODE_SENDER); SOAPFaultSubCode soapFaultSubCode = soapFac.createSOAPFaultSubCode(soapFaultCode); SOAPFaultValue soapFaultSubcodeValue = soapFac.createSOAPFaultValue(soapFaultSubCode); namespace = Final.WSA_NAMESPACE; OMNamespace wsaNS = soapFac.createOMNamespace(namespace, AddressingConstants.WSA_DEFAULT_PREFIX); soapFaultSubcodeValue.declareNamespace(wsaNS); soapFac.createSOAPFaultSubCode(soapFaultSubCode); SOAPFaultValue soapFaultSubcodeValue2 = soapFac.createSOAPFaultValue(soapFaultSubCode2); String namespace = (String) messageContext.getProperty(AddressingConstants.WS_ADDRESSING_VERSION); OMNamespace wsaNS = soapFac.createOMNamespace(namespace, AddressingConstants.WSA_DEFAULT_PREFIX); soapFaultSubcodeValue2.declareNamespace(wsaNS);
throw new SOAPException("Unqualified QName object : " + subcode); if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) { throw new UnsupportedOperationException(); soapFactory.createSOAPFaultCode(this.omTarget); soapFaultSubCode = soapFactory.createSOAPFaultSubCode(this.omTarget.getCode()); } else if (this.omTarget.getCode().getSubCode() != null) { soapFaultSubCode = soapFactory.createSOAPFaultSubCode( getLastSubCode(this.omTarget.getCode().getSubCode())); } else { soapFaultSubCode = soapFactory.createSOAPFaultSubCode(this.omTarget.getCode()); soapFactory.createSOAPFaultValue(soapFaultSubCode); soapFaultValueimpl.setText(subcode.getPrefix() + ":" + subcode.getLocalPart()); soapFaultValueimpl.declareNamespace(subcode.getNamespaceURI(), subcode.getPrefix());
public void setClientSessionID(String id) { SOAPFactory soapFactory = OMAbstractFactory.getSOAP12Factory(); OMNamespace synNamespace = soapFactory. createOMNamespace("http://ws.apache.org/namespaces/synapse", "syn"); SOAPHeaderBlock header = soapFactory.createSOAPHeaderBlock("ClientID", synNamespace); header.setText(id); client.addHeader(header); }
private void populateHeader(SOAPEnvelope envelope, SOAPFactory fac) { OMNamespace ns = fac.createOMNamespace("http://custom.header.com", "syn"); envelope.getHeader().addHeaderBlock("Foo", ns); envelope.getHeader().addHeaderBlock("Bar", ns); }