本文整理匯總了Java中org.apache.axiom.om.OMElement.detach方法的典型用法代碼示例。如果您正苦於以下問題:Java OMElement.detach方法的具體用法?Java OMElement.detach怎麽用?Java OMElement.detach使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.axiom.om.OMElement
的用法示例。
在下文中一共展示了OMElement.detach方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: removeSOAPHeader
import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
private void removeSOAPHeader(MessageDataSource messageDataSource) throws SOAPException {
SOAPEnvelope soapEnvelope = (SOAPEnvelope) messageDataSource.getDataObject();
SOAPHeader soapHeader = soapEnvelope.getHeader();
if (soapHeader != null) {
for (Iterator iter = soapHeader.examineAllHeaderBlocks(); iter.hasNext(); ) {
Object o = iter.next();
if (o instanceof SOAPHeaderBlock) {
SOAPHeaderBlock headerBlk = (SOAPHeaderBlock) o;
if (name.equals(headerBlk.getLocalName())) {
headerBlk.detach();
}
} else if (o instanceof OMElement) {
OMElement headerElem = (OMElement) o;
if (name.equals(headerElem.getLocalName())) {
headerElem.detach();
}
}
}
}
}
示例2: setClientName
import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
public OMElement setClientName(OMElement name) {
name.build();
name.detach();
String cName = name.getText();
serviceContext.setProperty("cName", cName);
String sName = "anonymous";
Object s = System.getProperty("server_name");
if (s != null) {
sName = (String) s;
}
String msg = "Server " + sName + " started a session with client " + cName;
System.out.println(msg);
name.setText(msg);
return name;
}
示例3: sampleOperation
import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
public OMElement sampleOperation(OMElement param) {
param.build();
param.detach();
String sName = "";
if (System.getProperty("test_mode") != null) {
sName = org.apache.axis2.context.MessageContext.getCurrentMessageContext().getTo().getAddress();
} else {
sName = System.getProperty("server_name");
}
if (sName != null) {
param.setText("Response from server: " + sName);
} else {
param.setText("Response from anonymous server");
}
return param;
}
示例4: sleepOperation
import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
public OMElement sleepOperation(OMElement param) throws AxisFault {
param.build();
param.detach();
OMElement timeElement = param.getFirstChildWithName(new QName("load"));
String time = timeElement.getText();
try {
Thread.sleep(Long.parseLong(time));
} catch (InterruptedException e) {
throw new AxisFault("Service is interrupted while sleeping.");
}
String sName = System.getProperty("server_name");
if (sName != null) {
timeElement.setText("Response from server: " + sName);
} else {
timeElement.setText("Response from anonymous server");
}
return param;
}
示例5: loadOperation
import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
public OMElement loadOperation(OMElement param) throws AxisFault {
param.build();
param.detach();
OMElement loadElement = param.getFirstChildWithName(new QName("load"));
String l = loadElement.getText();
long load = Long.parseLong(l);
for (long i = 0; i < load; i++) {
System.out.println("Iteration: " + i);
}
String sName = System.getProperty("server_name");
if (sName != null) {
loadElement.setText("Response from server: " + sName);
} else {
loadElement.setText("Response from anonymous server");
}
return param;
}
示例6: onMessage
import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
public void onMessage(org.apache.axis2.context.MessageContext messageContext) {
System.out.println("Response received to the callback");
OMElement result
= messageContext.getEnvelope().getBody().getFirstElement();
// Detach the result to make sure that the element we return to the sample client
// is completely built
result.detach();
StockQuoteClient.InnerStruct.RESULT = result;
}
示例7: sleepOperation
import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
public OMElement sleepOperation(OMElement topParam) {
topParam.build();
topParam.detach();
OMElement param = topParam.getFirstChildWithName(new QName("load"));
String l = param.getText();
long time = Long.parseLong(l);
try {
Thread.sleep(time);
} catch (InterruptedException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
Long c = null;
Object o = serviceContext.getProperty("count");
if (o == null) {
c = new Long(1);
serviceContext.setProperty("count", c);
} else {
c = (Long) o;
c = new Long(c.longValue() + 1);
serviceContext.setProperty("count", c);
}
String cName = "anonymous";
Object cn = serviceContext.getProperty("cName");
if (cn != null) {
cName = (String) cn;
}
String sName = "anonymous";
Object s = System.getProperty("server_name");
if (s != null) {
sName = (String) s;
}
String msg = "Server: " + sName + " processed the request " + c.toString() + " from client: " + cName;
System.out.println(msg);
param.setText(msg);
return topParam;
}
示例8: loadOperation
import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
public OMElement loadOperation(OMElement topParam) {
topParam.build();
topParam.detach();
OMElement param = topParam.getFirstChildWithName(new QName("load"));
String l = param.getText();
long load = Long.parseLong(l);
for (long i = 0; i < load; i++) {
System.out.println("Iteration: " + i);
}
Long c = null;
Object o = serviceContext.getProperty("count");
if (o == null) {
c = new Long(1);
serviceContext.setProperty("count", c);
} else {
c = (Long) o;
c = new Long(c.longValue() + 1);
serviceContext.setProperty("count", c);
}
String cName = "anonymous";
Object cn = serviceContext.getProperty("cName");
if (cn != null) {
cName = (String) cn;
}
String sName = "anonymous";
Object s = System.getProperty("server_name");
if (s != null) {
sName = (String) s;
}
String msg = "Server: " + sName + " processed the request " + c.toString() + " from client: " + cName;
System.out.println(msg);
param.setText(msg);
return topParam;
}
示例9: setClientName
import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
public OMElement setClientName(OMElement cName) {
cName.build();
cName.detach();
cName.setText("Sessions are not supported in this service.");
return cName;
}