本文整理汇总了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;
}