本文整理匯總了Java中org.apache.axis.client.Call.getMessageContext方法的典型用法代碼示例。如果您正苦於以下問題:Java Call.getMessageContext方法的具體用法?Java Call.getMessageContext怎麽用?Java Call.getMessageContext使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.axis.client.Call
的用法示例。
在下文中一共展示了Call.getMessageContext方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: main
import org.apache.axis.client.Call; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
try {
Options opts = new Options(args);
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(opts.getURL()));
SOAPEnvelope env = new SOAPEnvelope();
SOAPBodyElement sbe = new SOAPBodyElement(XMLUtils.StringToElement("http://localhost:8080/LogTestService", "testMethod", ""));
env.addBodyElement(sbe);
env = new SignedSOAPEnvelope(env, "http://xml-security");
System.out.println("\n============= Request ==============");
XMLUtils.PrettyElementToStream(env.getAsDOM(), System.out);
call.invoke(env);
MessageContext mc = call.getMessageContext();
System.out.println("\n============= Response ==============");
XMLUtils.PrettyElementToStream(mc.getResponseMessage().getSOAPEnvelope().getAsDOM(), System.out);
}
catch (Exception e) {
e.printStackTrace();
}
}
示例2: getMessageContext
import org.apache.axis.client.Call; //導入方法依賴的package包/類
private static MessageContext getMessageContext(WSClient client) throws AxisFault, PageException {
if(client!=null) {
Call call = client.getLastCall();
if(call==null) throw new AxisFault("web service was not invoked yet");
return call.getMessageContext();
}
MessageContext context = MessageContext.getCurrentContext();
if(context == null) throw new AxisFault("not inside a Soap Request");
return context;
}