List of usage examples for javax.xml.namespace QName getPrefix
public String getPrefix()
Get the prefix of this QName
.
The prefix assigned to a QName
might NOT be valid in a different context.
From source file:org.apache.axis2.jaxws.marshaller.impl.alt.RPCLitMethodMarshaller.java
public Message marshalResponse(Object returnObject, Object[] signatureArgs, OperationDescription operationDesc, Protocol protocol) throws WebServiceException { EndpointInterfaceDescription ed = operationDesc.getEndpointInterfaceDescription(); EndpointDescription endpointDesc = ed.getEndpointDescription(); // We want to respond with the same protocol as the request, // It the protocol is null, then use the Protocol defined by the binding if (protocol == null) { protocol = Protocol.getProtocolForBinding(endpointDesc.getBindingType()); }//from ww w .j av a 2 s . co m // Note all exceptions are caught and rethrown with a WebServiceException try { // Sample RPC message // .. // <soapenv:body> // <m:opResponse xmlns:m="urn://api"> // <param xsi:type="data:foo" >...</param> // </m:op> // </soapenv:body> // // Important points. // 1) RPC has an operation element under the body. This is the name of the // wsdl operation. // 2) The data blocks are located underneath the operation element. (In doc/lit // the data elements are underneath the body. // 3) The name of the data blocks (param) are defined by the wsdl:part not the // schema. Note that it is unqualified. // 4) The type of the data block (data:foo) is defined by schema (thus there is // JAXB type rendering. Since we are using JAXB to marshal the data, // we always generate an xsi:type attribute. This is an implemenation detail // and is not defined by any spec. // Get the operation information ParameterDescription[] pds = operationDesc.getParameterDescriptions(); MarshalServiceRuntimeDescription marshalDesc = MethodMarshallerUtils.getMarshalDesc(endpointDesc); TreeSet<String> packages = marshalDesc.getPackages(); // Create the message MessageFactory mf = (MessageFactory) FactoryRegistry.getFactory(MessageFactory.class); Message m = mf.create(protocol); // Indicate the style and operation element name. This triggers the message to // put the data blocks underneath the operation element m.setStyle(Style.RPC); QName rpcOpQName = getRPCOperationQName(operationDesc, false); String localPart = rpcOpQName.getLocalPart() + "Response"; QName responseOp = new QName(rpcOpQName.getNamespaceURI(), localPart, rpcOpQName.getPrefix()); m.setOperationElement(responseOp); // Put the return object onto the message Class returnType = operationDesc.getResultActualType(); String returnNS = null; String returnLocalPart = null; if (operationDesc.isResultHeader()) { returnNS = operationDesc.getResultTargetNamespace(); returnLocalPart = operationDesc.getResultName(); } else { returnNS = ""; // According to WSI BP the body part is unqualified returnLocalPart = operationDesc.getResultPartName(); } if (returnType != void.class) { AttachmentDescription attachmentDesc = operationDesc.getResultAttachmentDescription(); if (attachmentDesc != null) { if (attachmentDesc.getAttachmentType() == AttachmentType.SWA) { // Create an Attachment object with the signature value Attachment attachment = new Attachment(returnObject, returnType, attachmentDesc, operationDesc.getResultPartName()); m.addDataHandler(attachment.getDataHandler(), attachment.getContentID()); m.setDoingSWA(true); } else { throw ExceptionFactory.makeWebServiceException(Messages.getMessage("pdElementErr")); } } else { // TODO should we allow null if the return is a header? //Validate input parameters for operation and make sure no input parameters are null. //As per JAXWS Specification section 3.6.2.3 if a null value is passes as an argument //to a method then an implementation MUST throw WebServiceException. if (returnObject == null) { throw ExceptionFactory.makeWebServiceException( Messages.getMessage("NullParamErr3", operationDesc.getJavaMethodName())); } Element returnElement = null; QName returnQName = new QName(returnNS, returnLocalPart); if (marshalDesc.getAnnotationDesc(returnType).hasXmlRootElement()) { returnElement = new Element(returnObject, returnQName); } else { returnElement = new Element(returnObject, returnQName, returnType); } // Use marshalling by java type if necessary Class byJavaType = null; if (!operationDesc.isResultHeader() || MethodMarshallerUtils.isNotJAXBRootElement(returnType, marshalDesc)) { byJavaType = returnType; } MethodMarshallerUtils.toMessage(returnElement, returnType, operationDesc.isListType(), marshalDesc, m, byJavaType, operationDesc.isResultHeader()); } } // Convert the holder objects into a list of JAXB objects for marshalling List<PDElement> pdeList = MethodMarshallerUtils.getPDElements(marshalDesc, pds, signatureArgs, false, // output false, true); // use partName since this is rpc/lit // We want to use "by Java Type" marshalling for // all body elements and all non-JAXB objects for (PDElement pde : pdeList) { ParameterDescription pd = pde.getParam(); Class type = pd.getParameterActualType(); if (!pd.isHeader() || MethodMarshallerUtils.isNotJAXBRootElement(type, marshalDesc)) { pde.setByJavaTypeClass(type); } } // TODO Should we check for null output body values? Should we check for null output header values ? // Put values onto the message MethodMarshallerUtils.toMessage(pdeList, m, packages, null); // Enable SWA for nested SwaRef attachments if (operationDesc.hasResponseSwaRefAttachments()) { m.setDoingSWA(true); } return m; } catch (Exception e) { throw ExceptionFactory.makeWebServiceException(e); } }
From source file:org.apache.axis2.jaxws.message.impl.XMLSpineImpl.java
public void setBodyBlock(int index, Block block) throws WebServiceException { // Forces the parser to read all of the blocks getNumBodyBlocks();//from ww w. ja v a2s . c om block.setParent(getParent()); OMElement bElement = _getBodyBlockParent(); OMElement om = this._getChildOMElement(bElement, index); // The block is supposed to represent a single element. // But if it does not represent an element , the following will fail. QName qName = block.getQName(); OMNamespace ns = soapFactory.createOMNamespace(qName.getNamespaceURI(), qName.getPrefix()); OMElement newOM = _createOMElementFromBlock(qName.getLocalPart(), ns, block, soapFactory, false); if (om == null) { bElement.addChild(newOM); } else { om.insertSiblingBefore(newOM); om.detach(); } }
From source file:org.apache.axis2.jaxws.message.impl.XMLSpineImpl.java
public void setBodyBlock(Block block) throws WebServiceException { // Forces the parser to read all of the blocks getNumBodyBlocks();//from w ww .ja v a 2s. c o m block.setParent(getParent()); // Remove all of the children OMElement bElement = _getBodyBlockParent(); Iterator it = bElement.getChildren(); while (it.hasNext()) { it.next(); it.remove(); } if (block.isElementData()) { // If the block is element data then it is safe to create // an OMElement representing the block // The block is supposed to represent a single element. // But if it does not represent an element , the following will fail. QName qName = block.getQName(); OMNamespace ns = soapFactory.createOMNamespace(qName.getNamespaceURI(), qName.getPrefix()); OMElement newOM = _createOMElementFromBlock(qName.getLocalPart(), ns, block, soapFactory, false); bElement.addChild(newOM); } else { // This needs to be fixed, but for now we will require that there must be an // element...otherwise no block is added try { QName qName = block.getQName(); OMNamespace ns = soapFactory.createOMNamespace(qName.getNamespaceURI(), qName.getPrefix()); OMElement newOM = _createOMElementFromBlock(qName.getLocalPart(), ns, block, soapFactory, false); bElement.addChild(newOM); } catch (Throwable t) { if (log.isDebugEnabled()) { log.debug("An attempt was made to pass a Source or String that does not " + "have an xml element. Processing continues with an empty payload."); } } } }
From source file:org.apache.axis2.jaxws.message.impl.XMLSpineImpl.java
public void setOperationElement(QName operationQName) { OMElement opElement = this._getBodyBlockParent(); if (!(opElement instanceof SOAPBody)) { OMNamespace ns = soapFactory.createOMNamespace(operationQName.getNamespaceURI(), operationQName.getPrefix()); opElement.setLocalName(operationQName.getLocalPart()); opElement.setNamespace(ns);//from ww w . j a v a2 s.c o m // Necessary to avoid duplicate namespaces later. opElement.declareNamespace("http://www.w3.org/2001/XMLSchema-instance", "xsi"); } }
From source file:org.apache.axis2.jaxws.spi.handler.BaseHandlerResolver.java
private static void validatePattern(QName pattern) { if (pattern == null) { if (log.isDebugEnabled()) { log.debug("The pattern qname is null. This is accepted and interpretted as a wildcard"); }/*from w w w . jav a 2 s . c om*/ return; } String patternStringPrefix = pattern.getPrefix(); String patternInfoLocalPart = pattern.getLocalPart(); String patternString = ((patternStringPrefix == null) || (patternStringPrefix.equals(""))) ? "" : patternStringPrefix + ":"; patternString += patternInfoLocalPart; /* * Below pattern is ported from: http://java.sun.com/xml/ns/javaee/javaee_web_services_1_2.xsd * Schema regular expressions are defined differently from Java regular expressions which are different from Perl regular * expressions. I've converted the pattern defined in the above linked schema to its Java equivalent, as best as I can. * * Schema reg ex: "\*|([\i-[:]][\c-[:]]*:)?[\i-[:]][\c-[:]]*\*?" * Java reg ex: "\\*|((\\w|_)(\\w|\\.|-|_)*:)?(\\w|_)(\\w|\\.|-|_)*\\*?" */ // first, confirm the defined pattern is legal Pattern p = Pattern.compile("\\*|((\\w|_)(\\w|\\.|-|_)*:)?(\\w|_)(\\w|\\.|-|_)*\\*?"); Matcher m = p.matcher(patternString); if (!m.matches()) { // pattern defined by user in handler chain xml file is illegal -- report it but continue log.warn("Pattern defined by user is illegal: \"" + patternString + "\" does not match regular expression in schema http://java.sun.com/xml/ns/javaee/javaee_web_services_1_2.xsd. Pattern matching should now be considered \"best-effort.\""); } }
From source file:org.apache.axis2.saaj.SOAPFactoryTest.java
@Validated @Test/* w w w .j a va 2 s. c om*/ public void testCreateElement() { try { //SOAPFactory sf = SOAPFactory.newInstance(); SOAPFactory sf = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL); if (sf == null) { fail("createElementTest4() could not create SOAPFactory object"); } //Create QName object with localName=MyName1,prefix=MyPrefix1, uri=MyUri1 QName name = new QName("MyUri1", "MyName1", "MyPrefix1"); SOAPElement se = sf.createElement(name); assertNotNull(se); name = se.getElementQName(); String localName = name.getLocalPart(); String prefix = name.getPrefix(); String uri = name.getNamespaceURI(); if (localName == null) { fail("localName is null (expected MyName1)"); } else if (!localName.equals("MyName1")) { fail("localName is wrong (expected MyName1)"); } else if (prefix == null) { fail("prefix is null (expected MyPrefix1)"); } else if (!prefix.equals("MyPrefix1")) { fail("prefix is wrong (expected MyPrefix1)"); } else if (uri == null) { fail("uri is null (expected MyUri1)"); } else if (!uri.equals("MyUri1")) { fail("uri is wrong (expected MyUri1)"); } } catch (Exception e) { fail(); } }
From source file:org.apache.axis2.schema.writer.JavaBeanWriter.java
/** * @param model/*www . j a va 2 s .c o m*/ * @param className * @param originalName * @param packageName * @param qName * @param isElement * @param metainf * @param propertyNames * @param typeMap * @return Returns Element. * @throws SchemaCompilationException */ private Element getBeanElement(Document model, String className, String originalName, String packageName, QName qName, boolean isElement, boolean isAbstract, BeanWriterMetaInfoHolder metainf, ArrayList<String> propertyNames, Map<QName, String> typeMap, Map<QName, String> groupTypeMap) throws SchemaCompilationException { Element rootElt = XSLTUtils.getElement(model, "bean"); XSLTUtils.addAttribute(model, "name", className, rootElt); XSLTUtils.addAttribute(model, "originalName", originalName, rootElt); XSLTUtils.addAttribute(model, "package", packageName, rootElt); XSLTUtils.addAttribute(model, "nsuri", qName.getNamespaceURI(), rootElt); XSLTUtils.addAttribute(model, "nsprefix", isSuppressPrefixesMode ? "" : getPrefixForURI(qName.getNamespaceURI(), qName.getPrefix()), rootElt); if (!wrapClasses) { XSLTUtils.addAttribute(model, "unwrapped", "yes", rootElt); } if (isAbstract) { XSLTUtils.addAttribute(model, "isAbstract", "yes", rootElt); } if (!writeClasses) { XSLTUtils.addAttribute(model, "skip-write", "yes", rootElt); } if (!isElement) { XSLTUtils.addAttribute(model, "type", "yes", rootElt); } if (metainf.isAnonymous()) { XSLTUtils.addAttribute(model, "anon", "yes", rootElt); } if (isUseWrapperClasses) { XSLTUtils.addAttribute(model, "usewrapperclasses", "yes", rootElt); } if (metainf.isExtension()) { XSLTUtils.addAttribute(model, "extension", metainf.getExtensionClassName(), rootElt); } if (metainf.isRestriction()) { XSLTUtils.addAttribute(model, "restriction", metainf.getRestrictionClassName(), rootElt); } //add the mapper class name XSLTUtils.addAttribute(model, "mapperClass", getFullyQualifiedMapperClassName(), rootElt); if (metainf.isChoice()) { XSLTUtils.addAttribute(model, "choice", "yes", rootElt); } if (metainf.isSimple()) { XSLTUtils.addAttribute(model, "simple", "yes", rootElt); } if (metainf.isUnion()) { XSLTUtils.addAttribute(model, "union", "yes", rootElt); } if (metainf.isList()) { XSLTUtils.addAttribute(model, "list", "yes", rootElt); } if (metainf.isOrdered()) { XSLTUtils.addAttribute(model, "ordered", "yes", rootElt); } if (isElement && metainf.isNillable(qName)) { XSLTUtils.addAttribute(model, "nillable", "yes", rootElt); } if (metainf.isParticleClass()) { XSLTUtils.addAttribute(model, "particleClass", "yes", rootElt); } if (metainf.isHasParticleType()) { XSLTUtils.addAttribute(model, "hasParticleType", "yes", rootElt); } // populate all the information populateInfo(metainf, model, rootElt, propertyNames, typeMap, groupTypeMap, false); if (metainf.isSimple() && metainf.isUnion()) { populateMemberInfo(metainf, model, rootElt, typeMap); } if (metainf.isSimple() && metainf.isList()) { populateListInfo(metainf, model, rootElt, typeMap, groupTypeMap); } ////////////////////////////////////////////////////////// // System.out.println(DOM2Writer.nodeToString(rootElt)); //////////////////////////////////////////////////////////// return rootElt; }
From source file:org.apache.axis2.util.MessageContextBuilder.java
/** * Information to create the SOAPFault can be extracted from different places. * 1. Those information may have been put in to the message context by some handler. When someone * is putting like that, he must make sure the SOAPElements he is putting must be from the * correct SOAP Version./* www . j a v a 2 s .c o m*/ * 2. SOAPProcessingException is flexible enough to carry information about the fault. For example * it has an attribute to store the fault code. The fault reason can be extracted from the * message of the exception. I opted to put the stacktrace under the detail element. * eg : <Detail> * <Exception> stack trace goes here </Exception> * <Detail> * <p/> * If those information can not be extracted from any of the above places, I default the soap * fault values to following. * <Fault> * <Code> * <Value>env:Receiver</Value> * </Code> * <Reason> * <Text>unknown</Text> * </Reason> * <Role/> * <Node/> * <Detail/> * </Fault> * <p/> * -- EC * * @param context * @param e */ private static SOAPEnvelope createFaultEnvelope(MessageContext context, Throwable e) { SOAPEnvelope envelope; if (log.isDebugEnabled()) { log.debug("start createFaultEnvelope()"); } if (context.isSOAP11()) { envelope = OMAbstractFactory.getSOAP11Factory().getDefaultFaultEnvelope(); } else { // Following will make SOAP 1.2 as the default, too. envelope = OMAbstractFactory.getSOAP12Factory().getDefaultFaultEnvelope(); } SOAPFault fault = envelope.getBody().getFault(); SOAPProcessingException soapException = null; AxisFault axisFault = null; if (e == null) return envelope; if (e instanceof AxisFault) { axisFault = (AxisFault) e; } else if (e.getCause() instanceof AxisFault) { axisFault = (AxisFault) e.getCause(); } if (axisFault != null) { Iterator iter = axisFault.headerIterator(); while (iter.hasNext()) { SOAPHeaderBlock header = (SOAPHeaderBlock) iter.next(); envelope.getHeader().addChild(header); } } if (e instanceof SOAPProcessingException) { soapException = (SOAPProcessingException) e; } else if (axisFault != null) { if (axisFault.getCause() instanceof SOAPProcessingException) { soapException = (SOAPProcessingException) axisFault.getCause(); } } // user can set the fault information to the message context or to the AxisFault itself. // whatever user sets to the message context, supercedes eerything. Object faultCode = context.getProperty(SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME); String soapFaultCode = ""; if (faultCode != null) { if (log.isDebugEnabled()) { log.debug("faultCode != null"); } fault.setCode((SOAPFaultCode) faultCode); soapFaultCode = ((SOAPFaultCode) faultCode).getText(); } else if (soapException != null) { if (log.isDebugEnabled()) { log.debug("soapException != null"); } soapFaultCode = soapException.getFaultCode(); OMNamespace namespace = null; if (envelope != null) { if (log.isDebugEnabled()) { log.debug("envelope!=null"); } namespace = envelope.getNamespace(); } if (namespace != null) { String sfcLocalPart = soapFaultCode.substring(soapFaultCode.lastIndexOf(":") + 1); //If the fault code is one of the predefined ones that make sure the prefix //matches that of the envelope NS if (sfcLocalPart.equals(SOAPConstants.FAULT_CODE_VERSION_MISMATCH) || sfcLocalPart.equals(SOAPConstants.FAULT_CODE_MUST_UNDERSTAND) || sfcLocalPart.equals(SOAPConstants.FAULT_CODE_DATA_ENCODING_UNKNOWN) || sfcLocalPart.equals(SOAPConstants.FAULT_CODE_RECEIVER) || sfcLocalPart.equals(SOAPConstants.FAULT_CODE_SENDER)) { if (log.isDebugEnabled()) { log.debug("SoapFaultCode local part= " + sfcLocalPart); } String prefix = namespace.getPrefix() + ":"; if (!soapFaultCode.contains(":")) { soapFaultCode = prefix + soapFaultCode; } else { soapFaultCode = prefix + soapFaultCode.substring(soapFaultCode.indexOf(":") + 1); } if (log.isDebugEnabled()) { log.debug("SoapFaultCode reset to " + soapFaultCode); } } } else { if (log.isDebugEnabled()) { log.debug("Namespace is null, cannot attach prefix to SOAPFaultCode"); } } if (log.isDebugEnabled()) { log.debug("SoapFaultCode =" + soapFaultCode); } } else if (axisFault != null) { if (log.isDebugEnabled()) { log.debug("axisFault != null"); } if (axisFault.getFaultCodeElement() != null) { fault.setCode(axisFault.getFaultCodeElement()); soapFaultCode = axisFault.getFaultCodeElement().getText(); } else { QName faultCodeQName = axisFault.getFaultCode(); if (faultCodeQName != null) { if (log.isDebugEnabled()) { log.debug("prefix =" + faultCodeQName.getPrefix()); log.debug("Fault Code namespace =" + faultCodeQName.getNamespaceURI()); log.debug("Fault Code =" + faultCodeQName.getLocalPart()); } if (faultCodeQName.getLocalPart().indexOf(":") == -1) { if (log.isDebugEnabled()) { log.debug("faultCodeQName.getLocalPart().indexOf(\":\") == -1"); } String prefix = faultCodeQName.getPrefix(); if (log.isDebugEnabled()) { log.debug("prefix = " + prefix); } String uri = faultCodeQName.getNamespaceURI(); // Get the specified prefix and uri prefix = prefix == null ? "" : prefix; uri = uri == null || "".equals(uri) ? fault.getNamespace().getNamespaceURI() : uri; // Make sure the prefix and uri are declared on the fault, and // get the resulting prefix. prefix = fault.declareNamespace(uri, prefix).getPrefix(); soapFaultCode = prefix + ":" + faultCodeQName.getLocalPart(); if (log.isDebugEnabled()) { log.debug("Altered soapFaultCode =" + soapFaultCode); } } else { soapFaultCode = faultCodeQName.getLocalPart(); } } } } // defaulting to fault code Receiver, if no message is available if (faultCode == null && context.getEnvelope() != null) { soapFaultCode = ("".equals(soapFaultCode) || (soapFaultCode == null)) ? SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX + ":" + context.getEnvelope().getVersion().getReceiverFaultCode().getLocalPart() : soapFaultCode; } if (faultCode == null) { if (log.isDebugEnabled()) { log.debug("faultCode == null"); } if (context.isSOAP11()) { if (log.isDebugEnabled()) { log.debug("context.isSOAP11() = true"); SOAPFaultCode code = (fault != null) ? fault.getCode() : null; SOAPFaultValue value = (code != null) ? code.getValue() : null; if (value != null) { QName name = value.getQName(); log.debug("prefix =" + name.getPrefix()); log.debug("Fault Code namespace =" + name.getNamespaceURI()); log.debug("Fault Code =" + name.getLocalPart()); } } fault.getCode().setText(soapFaultCode); } else { if (log.isDebugEnabled()) { log.debug("context.isSOAP11() = false"); SOAPFaultCode code = (fault != null) ? fault.getCode() : null; SOAPFaultValue value = (code != null) ? code.getValue() : null; if (value != null) { QName name = value.getQName(); log.debug("prefix =" + name.getPrefix()); log.debug("Fault Code namespace =" + name.getNamespaceURI()); log.debug("Fault Code =" + name.getLocalPart()); } } SOAPFaultValue value = fault.getCode().getValue(); if (log.isDebugEnabled()) { log.debug("soapFaultCode originally was set to : " + soapFaultCode); } OMNamespace namespace = value.getNamespace(); soapFaultCode = switchNamespacePrefix(soapFaultCode, namespace); value.setText(soapFaultCode); } } if (axisFault != null && !context.isSOAP11()) { if (axisFault.getFaultSubCodes() != null) { List faultSubCodes = axisFault.getFaultSubCodes(); QName faultSubCodeQName; for (Object faultSubCode : faultSubCodes) { faultSubCodeQName = (QName) faultSubCode; SOAPFactory sf = (SOAPFactory) envelope.getOMFactory(); SOAPFaultSubCode soapFaultSubCode = sf.createSOAPFaultSubCode(fault.getCode()); SOAPFaultValue saopFaultValue = sf.createSOAPFaultValue(fault.getCode()); saopFaultValue.setText(faultSubCodeQName); soapFaultSubCode.setValue(saopFaultValue); fault.getCode().setSubCode(soapFaultSubCode); } } } SOAPFaultReason faultReason = (SOAPFaultReason) context .getProperty(SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME); if (faultReason == null && axisFault != null) { faultReason = axisFault.getFaultReasonElement(); } if (faultReason != null) { fault.setReason(faultReason); } else { String message = ""; if (soapException != null) { message = soapException.getMessage(); } else if (axisFault != null) { // Couldn't find FaultReasonElement, try reason string message = axisFault.getReason(); } if (message == null || "".equals(message)) { message = getFaultReasonFromException(e, context); } if (message == null || "".equals(message)) message = "unknown"; if (context.isSOAP11()) { fault.getReason().setText(message); } else { fault.getReason().getFirstSOAPText().setLang("en-US"); fault.getReason().getFirstSOAPText().setText(message); } } Object faultRole = context.getProperty(SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME); if (faultRole != null) { fault.getRole().setText((String) faultRole); } else if (axisFault != null) { if (axisFault.getFaultRoleElement() != null) { fault.setRole(axisFault.getFaultRoleElement()); } } Object faultNode = context.getProperty(SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME); if (faultNode != null) { SOAPFaultNode soapFaultNode = fault.getNode(); if (soapFaultNode != null) { soapFaultNode.setText((String) faultNode); } } else if (axisFault != null) { if (axisFault.getFaultNodeElement() != null) { fault.setNode(axisFault.getFaultNodeElement()); } } // Allow handlers to override the sendStacktraceDetailsWithFaults setting from the Configuration to allow // WS-* protocol faults to not include the exception. boolean sendStacktraceDetailsWithFaults = false; OperationContext oc = context.getOperationContext(); Object flagFromContext = null; if (oc != null) { flagFromContext = context.getOperationContext() .getProperty(Constants.Configuration.SEND_STACKTRACE_DETAILS_WITH_FAULTS); } if (flagFromContext != null) { sendStacktraceDetailsWithFaults = JavaUtils.isTrue(flagFromContext); } else { Parameter param = context.getParameter(Constants.Configuration.SEND_STACKTRACE_DETAILS_WITH_FAULTS); if (param != null) { sendStacktraceDetailsWithFaults = JavaUtils.isTrue(param.getValue()); } } Object faultDetail = context.getProperty(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME); if (faultDetail != null) { fault.setDetail((SOAPFaultDetail) faultDetail); } else if (axisFault != null) { if (axisFault.getFaultDetailElement() != null) { fault.setDetail(axisFault.getFaultDetailElement()); } else { OMElement detail = axisFault.getDetail(); if (detail != null) { fault.getDetail().addDetailEntry(detail); } else if (sendStacktraceDetailsWithFaults) { fault.setException(axisFault); } } } else if (fault.getException() == null && sendStacktraceDetailsWithFaults) { if (e instanceof Exception) { fault.setException((Exception) e); } else { fault.setException(new Exception(e)); } } if (log.isDebugEnabled()) log.debug("End createFaultEnvelope()"); return envelope; }
From source file:org.apache.falcon.lifecycle.engine.oozie.utils.OozieBuilderUtils.java
public static Path marshalDefaultConfig(Cluster cluster, WORKFLOWAPP workflowapp, Properties properties, Path outPath) throws FalconException { QName workflowQName = new org.apache.falcon.oozie.workflow.ObjectFactory().createWorkflowApp(workflowapp) .getName();/*from w w w .j a va2 s .com*/ org.apache.falcon.oozie.workflow.CONFIGURATION config = getWorkflowConfig(properties); JAXBElement<org.apache.falcon.oozie.workflow.CONFIGURATION> configJaxbElement = new JAXBElement( new QName(workflowQName.getNamespaceURI(), "configuration", workflowQName.getPrefix()), org.apache.falcon.oozie.workflow.CONFIGURATION.class, config); Path defaultConfigPath = new Path(outPath, "config-default.xml"); return marshal(cluster, configJaxbElement, CONFIG_JAXB_CONTEXT, defaultConfigPath); }
From source file:org.apache.falcon.oozie.OozieOrchestrationWorkflowBuilder.java
protected Path marshal(Cluster cluster, WORKFLOWAPP workflowapp, CONFIGURATION config, Path outPath) throws FalconException { QName workflowQName = new org.apache.falcon.oozie.workflow.ObjectFactory().createWorkflowApp(workflowapp) .getName();//from w ww . j ava 2s. c om JAXBElement<CONFIGURATION> configJaxbElement = new JAXBElement( new QName(workflowQName.getNamespaceURI(), "configuration", workflowQName.getPrefix()), CONFIGURATION.class, config); return marshal(cluster, configJaxbElement, OozieUtils.CONFIG_JAXB_CONTEXT, new Path(outPath, "config-default.xml")); }