本文整理了Java中org.apache.axiom.om.OMElement.setLocalName()
方法的一些代码示例,展示了OMElement.setLocalName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OMElement.setLocalName()
方法的具体详情如下:
包路径:org.apache.axiom.om.OMElement
类名称:OMElement
方法名:setLocalName
暂无
代码示例来源:origin: org.apache.axis2/axis2-transport-testkit
public OMElement echoOMElement(OMElement omEle) {
omEle.buildWithAttachments();
omEle.setLocalName(omEle.getLocalName() + "Response");
if (omEle.getFirstElement().getText().trim().startsWith("fault")) {
throw new RuntimeException("fault string found in echoOMElement");
}
return omEle;
}
代码示例来源:origin: org.apache.axis2/axis2-saaj
public SOAPElement setElementQName(QName newName) throws SOAPException {
String localName = this.target.getLocalName();
if (org.apache.axiom.soap.SOAPConstants.BODY_LOCAL_NAME.equals(localName)
|| org.apache.axiom.soap.SOAPConstants.HEADER_LOCAL_NAME.equals(localName)
|| org.apache.axiom.soap.SOAPConstants.SOAPENVELOPE_LOCAL_NAME .equals(localName)) {
throw new SOAPException("changing this element name is not allowed");
}
OMNamespace omNamespace =
omTarget.getOMFactory().createOMNamespace(newName.getNamespaceURI(), newName.getPrefix());
this.omTarget.setNamespace(omNamespace);
this.omTarget.setLocalName(newName.getLocalPart());
return this;
}
代码示例来源:origin: org.apache.axis2.transport/axis2-transport-testkit
public OMElement echoOMElement(OMElement omEle) {
omEle.buildWithAttachments();
omEle.setLocalName(omEle.getLocalName() + "Response");
if (omEle.getFirstElement().getText().trim().startsWith("fault")) {
throw new RuntimeException("fault string found in echoOMElement");
}
return omEle;
}
代码示例来源:origin: apache/axis2-java
public OMElement echoOMElement(OMElement omEle) {
omEle.buildWithAttachments();
omEle.setLocalName(omEle.getLocalName() + "Response");
if (omEle.getFirstElement().getText().trim().startsWith("fault")) {
throw new RuntimeException("fault string found in echoOMElement");
}
return omEle;
}
代码示例来源:origin: apache/axis2-java
public SOAPElement setElementQName(QName newName) throws SOAPException {
String localName = this.target.getLocalName();
if (org.apache.axiom.soap.SOAPConstants.BODY_LOCAL_NAME.equals(localName)
|| org.apache.axiom.soap.SOAPConstants.HEADER_LOCAL_NAME.equals(localName)
|| org.apache.axiom.soap.SOAPConstants.SOAPENVELOPE_LOCAL_NAME .equals(localName)) {
throw new SOAPException("changing this element name is not allowed");
}
OMNamespace omNamespace =
omTarget.getOMFactory().createOMNamespace(newName.getNamespaceURI(), newName.getPrefix());
this.omTarget.setNamespace(omNamespace);
this.omTarget.setLocalName(newName.getLocalPart());
return this;
}
代码示例来源:origin: org.springframework.ws/org.springframework.ws
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
OMContainer parent = getParent();
OMElement element = factory.createOMElement(localName, null, parent);
for (Map.Entry<String, String> entry : namespaces.entrySet()) {
String prefix = entry.getKey();
if (prefix.length() == 0) {
element.declareDefaultNamespace((String) entry.getValue());
}
else {
element.declareNamespace((String) entry.getValue(), prefix);
}
}
QName qname = QNameUtils.toQName(uri, qName);
element.setLocalName(qname.getLocalPart());
element.setNamespace(element.findNamespace(qname.getNamespaceURI(), qname.getPrefix()));
for (int i = 0; i < atts.getLength(); i++) {
QName attrName = QNameUtils.toQName(atts.getURI(i), atts.getQName(i));
String value = atts.getValue(i);
if (!atts.getQName(i).startsWith("xmlns")) {
OMNamespace namespace = factory.createOMNamespace(attrName.getNamespaceURI(), attrName.getPrefix());
OMAttribute attribute = factory.createOMAttribute(attrName.getLocalPart(), namespace, value);
element.addAttribute(attribute);
}
}
elements.add(element);
}
代码示例来源:origin: org.wso2.bpel/ode-bpel-epr
Class beanFactory = clazz.forName(clazz.getCanonicalName() + "$Factory");
elmt.setNamespace(new NamespaceImpl(""));
elmt.setLocalName("xml-fragment");
return beanFactory.getMethod("parse", XMLStreamReader.class)
.invoke(null, elmt.getXMLStreamReaderWithoutCaching());
代码示例来源:origin: org.apache.tuscany.sca/tuscany-databinding-axiom
/**
* @param context
* @param element
*/
public static void adjustElementName(TransformationContext context, OMElement element) {
if (context != null) {
DataType dataType = context.getTargetDataType();
Object logical = dataType == null ? null : dataType.getLogical();
if (!(logical instanceof XMLType)) {
return;
}
XMLType xmlType = (XMLType)logical;
if (xmlType.isElement() && !xmlType.getElementName().equals(element.getQName())) {
// FIXME:: Throw exception or switch to the new Element?
OMFactory factory = OMAbstractFactory.getOMFactory();
QName name = xmlType.getElementName();
OMNamespace namespace = factory.createOMNamespace(name.getNamespaceURI(), name.getPrefix());
element.setNamespace(namespace);
element.setLocalName(name.getLocalPart());
}
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-databinding-sdo-axiom
/**
* @param context
* @param element
*/
public static void adjustElementName(TransformationContext context, OMElement element) {
if (context != null) {
DataType dataType = context.getTargetDataType();
Object logical = dataType == null ? null : dataType.getLogical();
if (!(logical instanceof XMLType)) {
return;
}
XMLType xmlType = (XMLType)logical;
if (xmlType.isElement() && !xmlType.getElementName().equals(element.getQName())) {
// FIXME:: Throw exception or switch to the new Element?
OMFactory factory = OMAbstractFactory.getOMFactory();
QName name = xmlType.getElementName();
OMNamespace namespace = factory.createOMNamespace(name.getNamespaceURI(), name.getPrefix());
element.setNamespace(namespace);
element.setLocalName(name.getLocalPart());
}
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-databinding-axiom
private void addChild(OMElement wrapper, ElementInfo childElement, OMElement element) {
if (element == null) {
// Prefer xsi:nil="true"
if (childElement.isNillable()) {
OMElement e = wrapper.getOMFactory().createOMElement(childElement.getQName(), wrapper);
attachXSINil(e);
}
// else, we might have minOccurs="0", so don't add anything to the wrapper.
return;
}
QName elementName = childElement.getQName();
// Make it a bit tolerating of element QName
if (!elementName.equals(element.getQName())) {
OMNamespace namespace = factory.createOMNamespace(elementName.getNamespaceURI(), elementName.getPrefix());
element.setNamespace(namespace);
element.setLocalName(childElement.getQName().getLocalPart());
}
wrapper.addChild(element);
}
代码示例来源:origin: wso2/wso2-synapse
public OMElement processDocument(InputStream inputStream, String s,
MessageContext messageContext) throws AxisFault {
// first process the input stream
SOAPEnvelope soapEnv = (SOAPEnvelope) processDocumentWrapper(inputStream, s, messageContext);
// when this is a POST request, if the body of the soap envelope is empty and the parameter
// map is there, build a dummy soap body which contains all the parameters coming in.
SOAPBody body = soapEnv.getBody();
String httpMethod = (String) messageContext.getProperty(HTTPConstants.HTTP_METHOD);
if (body.getFirstElement() == null && HTTPConstants.HTTP_METHOD_POST.equals(httpMethod) &&
messageContext.getProperty(Constants.REQUEST_PARAMETER_MAP) != null) {
MultipleEntryHashMap map = (MultipleEntryHashMap) messageContext
.getProperty(Constants.REQUEST_PARAMETER_MAP);
SOAPFactory soapFactory = getSOAPFactory(messageContext);
OMElement bodyFirstChild = soapFactory
.createOMElement(XFORM_FIRST_ELEMENT, body);
createSOAPMessageWithoutSchema(soapFactory, bodyFirstChild, map);
} else if (body.getFirstElement() != null && "mediate".equals(body.getFirstElement().getLocalName())) {
body.getFirstElement().setLocalName(XFORM_FIRST_ELEMENT.getLocalPart());
}
return soapEnv;
}
代码示例来源:origin: org.apache.axis2/axis2-kernel
OMElement omElement =
axisBindingFault.toWSDL20(wsdl, tns, wsoap, whttp, nameSpaceMap);
omElement.setLocalName(WSDL2Constants.FAULT_LOCAL_NAME);
bindingElement
.addChild(omElement);
代码示例来源:origin: apache/axis2-java
OMElement omElement =
axisBindingFault.toWSDL20(wsdl, tns, wsoap, whttp, nameSpaceMap);
omElement.setLocalName(WSDL2Constants.FAULT_LOCAL_NAME);
bindingElement
.addChild(omElement);
代码示例来源:origin: org.apache.synapse/synapse-core
OMElement inSeqElement = seqSerializer.serializeAnonymousSequence(
null, resource.getInSequence());
inSeqElement.setLocalName("inSequence");
resourceElt.addChild(inSeqElement);
OMElement outSeqElement = seqSerializer.serializeAnonymousSequence(
null, resource.getOutSequence());
outSeqElement.setLocalName("outSequence");
resourceElt.addChild(outSeqElement);
OMElement faultSeqElement = seqSerializer.serializeAnonymousSequence(
null, resource.getFaultSequence());
faultSeqElement.setLocalName("faultSequence");
resourceElt.addChild(faultSeqElement);
代码示例来源:origin: wso2/wso2-synapse
OMElement element = serializer.serializeAnonymousSequence(null,
(SequenceMediator) mediator);
element.setLocalName(XMLConfigConstants.ONREJECT);
throttle.addChild(element);
OMElement element = serializer.serializeAnonymousSequence(null,
(SequenceMediator) mediator);
element.setLocalName(XMLConfigConstants.ONACCEPT);
throttle.addChild(element);
代码示例来源:origin: org.apache.synapse/synapse-extensions
OMElement element = serializer.serializeAnonymousSequence(null,
(SequenceMediator) mediator);
element.setLocalName(XMLConfigConstants.ONREJECT);
throttle.addChild(element);
OMElement element = serializer.serializeAnonymousSequence(null,
(SequenceMediator) mediator);
element.setLocalName(XMLConfigConstants.ONACCEPT);
throttle.addChild(element);
代码示例来源:origin: org.apache.synapse/synapse-core
if (inLineInSeq != null) {
OMElement inSeqElement = serializer.serializeAnonymousSequence(null, inLineInSeq);
inSeqElement.setLocalName("inSequence");
target.addChild(inSeqElement);
proxy.addChild(target);
if (inLineOutSeq != null) {
OMElement outSeqElement = serializer.serializeAnonymousSequence(null, inLineOutSeq);
outSeqElement.setLocalName("outSequence");
target.addChild(outSeqElement);
proxy.addChild(target);
if (inLineFaultSeq != null) {
OMElement faultSeqElement = serializer.serializeAnonymousSequence(null, inLineFaultSeq);
faultSeqElement.setLocalName("faultSequence");
target.addChild(faultSeqElement);
proxy.addChild(target);
代码示例来源:origin: wso2/wso2-synapse
OMElement inSeqElement = seqSerializer.serializeAnonymousSequence(
null, resource.getInSequence());
inSeqElement.setLocalName("inSequence");
resourceElt.addChild(inSeqElement);
OMElement outSeqElement = seqSerializer.serializeAnonymousSequence(
null, resource.getOutSequence());
outSeqElement.setLocalName("outSequence");
resourceElt.addChild(outSeqElement);
OMElement faultSeqElement = seqSerializer.serializeAnonymousSequence(
null, resource.getFaultSequence());
faultSeqElement.setLocalName("faultSequence");
resourceElt.addChild(faultSeqElement);
代码示例来源:origin: wso2/wso2-synapse
OMElement seqElement = seqSerializer.serializeAnonymousSequence(
null, forEachMed.getSequence());
seqElement.setLocalName("sequence");
forEachElem.addChild(seqElement);
代码示例来源:origin: wso2/wso2-synapse
if (inLineInSeq != null) {
OMElement inSeqElement = serializer.serializeAnonymousSequence(null, inLineInSeq);
inSeqElement.setLocalName("inSequence");
target.addChild(inSeqElement);
proxy.addChild(target);
if (inLineOutSeq != null) {
OMElement outSeqElement = serializer.serializeAnonymousSequence(null, inLineOutSeq);
outSeqElement.setLocalName("outSequence");
target.addChild(outSeqElement);
proxy.addChild(target);
if (inLineFaultSeq != null) {
OMElement faultSeqElement = serializer.serializeAnonymousSequence(null, inLineFaultSeq);
faultSeqElement.setLocalName("faultSequence");
target.addChild(faultSeqElement);
proxy.addChild(target);
内容来源于网络,如有侵权,请联系作者删除!