protected String addOperationNode(SoapMessage message, XMLStreamWriter xmlWriter) throws XMLStreamException { String responseSuffix = !isRequestor(message) ? "Response" : ""; BindingOperationInfo boi = message.getExchange().get( BindingOperationInfo.class); String ns = boi.getName().getNamespaceURI(); NSStack nsStack = new NSStack(); nsStack.push(); nsStack.add(ns); String prefix = nsStack.getPrefix(ns); StaxUtils.writeStartElement(xmlWriter, prefix, boi.getName() .getLocalPart() + responseSuffix, ns); return ns; }
/** * Add a new declaration to the current scope using a unique prefix * and return the prefix. This is useful when one just wants to add a * decl and doesn't want to have to deal with creating unique prefixes. * If the namespace name is already declared and in scope, then the * previously declared prefix is returned. * * @param uri the namespace name of this namespace * @return the unique prefix created or previously declared * for this namespace */ public synchronized String add(String uri) { String uniquePrefix = getPrefix(uri); if (uniquePrefix == null) { do { uniquePrefix = NS_PREFIX_PREFIX + nsPrefixCount++; } while (getURI(uniquePrefix) != null); add(uniquePrefix, uri); } return uniquePrefix; }
protected String addOperationNode(NSStack nsStack, Message message, XMLStreamWriter xmlWriter, boolean output, BindingOperationInfo boi) throws XMLStreamException { String ns = boi.getName().getNamespaceURI(); SoapBody body = null; if (output) { body = boi.getOutput().getExtensor(SoapBody.class); } else { body = boi.getInput().getExtensor(SoapBody.class); } if (body != null) { final String nsUri = body.getNamespaceURI(); //do it once, as it might internally use reflection... if (!StringUtils.isEmpty(nsUri)) { ns = nsUri; } } nsStack.add(ns); String prefix = nsStack.getPrefix(ns); String name = output ? boi.getName().getLocalPart() + "Response" : boi.getName().getLocalPart(); StaxUtils.writeStartElement(xmlWriter, prefix, name, ns); return ns; }
protected String addOperationNode(NSStack nsStack, Message message, XMLStreamWriter xmlWriter, boolean output, BindingOperationInfo boi) throws XMLStreamException { String ns = boi.getName().getNamespaceURI(); SoapBody body = null; if (output) { body = boi.getOutput().getExtensor(SoapBody.class); } else { body = boi.getInput().getExtensor(SoapBody.class); } if (body != null) { final String nsUri = body.getNamespaceURI(); //do it once, as it might internally use reflection... if (!StringUtils.isEmpty(nsUri)) { ns = nsUri; } } nsStack.add(ns); String prefix = nsStack.getPrefix(ns); String name = output ? boi.getName().getLocalPart() + "Response" : boi.getName().getLocalPart(); StaxUtils.writeStartElement(xmlWriter, prefix, name, ns); return ns; }
public void handleMessage(NMRMessage message) throws Fault { message.put(org.apache.cxf.message.Message.RESPONSE_CODE, new Integer(500)); NSStack nsStack = new NSStack(); nsStack.push(); Fault fault = getFault(message); NMRFault jbiFault = NMRFault.createFault(fault); nsStack.add(NMRConstants.NS_NMR_BINDING); String prefix = nsStack.getPrefix(NMRConstants.NS_NMR_BINDING); StaxUtils.writeStartElement(writer, prefix, NMRFault.NMR_FAULT_ROOT, NMRConstants.NS_NMR_BINDING);
/** * Add a new declaration to the current scope using a unique prefix * and return the prefix. This is useful when one just wants to add a * decl and doesn't want to have to deal with creating unique prefixes. * If the namespace name is already declared and in scope, then the * previously declared prefix is returned. * * @param URI the namespace name of this namespace * @return the unique prefix created or previously declared * for this namespace */ public synchronized String add(String uri) { String uniquePrefix = getPrefix(uri); if (uniquePrefix == null) { do { uniquePrefix = NS_PREFIX_PREFIX + nsPrefixCount++; } while (getURI(uniquePrefix) != null); add(uniquePrefix, uri); } return uniquePrefix; }
public void handleMessage(JBIMessage message) throws Fault { message.put(org.apache.cxf.message.Message.RESPONSE_CODE, new Integer(500)); NSStack nsStack = new NSStack(); nsStack.push(); Fault fault = getFault(message); JBIFault jbiFault = JBIFault.createFault(fault); nsStack.add(JBIConstants.NS_JBI_BINDING); String prefix = nsStack.getPrefix(JBIConstants.NS_JBI_BINDING); StaxUtils.writeStartElement(writer, prefix, JBIFault.JBI_FAULT_ROOT, JBIConstants.NS_JBI_BINDING);
/** * Add a new declaration to the current scope using a unique prefix * and return the prefix. This is useful when one just wants to add a * decl and doesn't want to have to deal with creating unique prefixes. * If the namespace name is already declared and in scope, then the * previously declared prefix is returned. * * @param uri the namespace name of this namespace * @return the unique prefix created or previously declared * for this namespace */ public synchronized String add(String uri) { String uniquePrefix = getPrefix(uri); if (uniquePrefix == null) { do { uniquePrefix = NS_PREFIX_PREFIX + nsPrefixCount++; } while (getURI(uniquePrefix) != null); add(uniquePrefix, uri); } return uniquePrefix; }
/** * Add a new declaration to the current scope using a unique prefix * and return the prefix. This is useful when one just wants to add a * decl and doesn't want to have to deal with creating unique prefixes. * If the namespace name is already declared and in scope, then the * previously declared prefix is returned. * * @param uri the namespace name of this namespace * @return the unique prefix created or previously declared * for this namespace */ public synchronized String add(String uri) { String uniquePrefix = getPrefix(uri); if (uniquePrefix == null) { do { uniquePrefix = NS_PREFIX_PREFIX + nsPrefixCount++; } while (getURI(uniquePrefix) != null); add(uniquePrefix, uri); } return uniquePrefix; }
/** * Add a new declaration to the current scope using a unique prefix * and return the prefix. This is useful when one just wants to add a * decl and doesn't want to have to deal with creating unique prefixes. * If the namespace name is already declared and in scope, then the * previously declared prefix is returned. * * @param uri the namespace name of this namespace * @return the unique prefix created or previously declared * for this namespace */ public synchronized String add(String uri) { String uniquePrefix = getPrefix(uri); if (uniquePrefix == null) { do { uniquePrefix = NS_PREFIX_PREFIX + nsPrefixCount++; } while (getURI(uniquePrefix) != null); add(uniquePrefix, uri); } return uniquePrefix; }