Learning axis2

您所在的位置:网站首页 endpointreference Learning axis2

Learning axis2

2023-03-27 19:34| 来源: 网络整理| 查看: 265

public class AxisTest { private static Log log = LogFactory.getLog(AxisTest.class); protected Object process(String operation, String paramter) throws AxisFault { Object result = null; EndpointReference ref = new EndpointReference(url); Options options = new Options(); options.setTo(ref); options.setTimeOutInMilliSeconds(60 * 1000); try { ServiceClient sender = new ServiceClient(); sender.setOptions(options); OMFactory fac = OMAbstractFactory.getOMFactory(); OMNamespace ns = fac.createOMNamespace(nameSpace, "myService"); OMElement method = fac.createOMElement(operation, ns); if (null != paramter) method.setText(paramter); OMElement resp = sender.sendReceive(method).getFirstElement(); String serialize = resp.getText(); log.debug(serialize); result = decode(serialize); } catch (AxisFault e) { log.error("", e); throw e; } return result; } public static void main(String[] args) { } }

 

需要的jar

 

axiom-api-1.2.7.jar axiom-dom-1.2.7.jar axiom-impl-1.2.7.jar axis2-kernel-1.4.jar backport-util-concurrent-3.1.jar neethi-2.0.4.jar wsdl4j-1.6.2.jar XmlSchema-1.4.2.jar

 

 

 

取结果

OMElement resp = sender.sendReceive(method).getFirstElement();

 

OMElement resp = sender.sendReceive(method).getFirstChildWithName(new QName("return"));

 



【本文地址】


今日新闻


推荐新闻


    CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3