首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >axis2 soap日志记录

axis2 soap日志记录
EN

Stack Overflow用户
提问于 2010-12-29 02:22:24
回答 4查看 6.5K关注 0票数 0

我已经使用axis2生成了使用wsdl2java的java客户端。我的客户端程序可以成功地连接到webservice。我想记录读取soap消息的传出soap请求。

有人可以将我引向一篇解释如何在Axis2中记录soap消息的文章吗?

EN

回答 4

Stack Overflow用户

发布于 2011-06-18 01:24:31

我知道这是一个古老的问题,但如果它对任何人有帮助,您可以通过将此标记放入服务器的globalConfig -config.wsdd文件中的<requestFlow><responseFlow>部分来打开日志:

代码语言:javascript
复制
<handler type="java:org.apache.axis.handlers.LogHandler"/>
票数 2
EN

Stack Overflow用户

发布于 2011-08-04 04:39:43

您还可以考虑编写一个用于日志记录的自定义axis模块-有关详细信息,请查看http://axis.apache.org/axis2/java/core/docs/modules.html

票数 2
EN

Stack Overflow用户

发布于 2011-05-12 05:32:25

如果您正在使用Axis2数据绑定,那么为您的web服务自动生成的类都将是ADBBean的子类。您可以使用如下代码将ADBBean转换为字符串,然后记录该字符串。

代码语言:javascript
复制
public static String
writeADBBean(ADBBean aBean) throws XMLStreamException {
    if (null == aBean)
        return "null";
    OMElement omElement;
    try
    {
        // The preferred way of serializing objects generated by Axis2's
        // WSDL2JAVA involves methods that are named the same on every
        // class but that aren't inherited from any base class. So, use
        // reflection to find them.
        QName qname;
        try {
            Field qnameField = aBean.getClass().getField("MY_QNAME");
            qname = (QName)qnameField.get(aBean);
        } catch (Exception e) {
            // Some Axis2-generated objects don't have QNames. Supply
            // one based on the object's class.
            qname = new QName(aBean.getClass().getCanonicalName());
        }
        Method getOMElement = aBean.getClass().getMethod("getOMElement", QName.class, OMFactory.class);
        omElement = (OMElement)getOMElement.invoke(aBean, qname, OMAbstractFactory.getOMFactory());
    } catch (Exception e) {
        log.warn("Reflection failed for " + aBean.toString() + ": " + e.toString());
        throw new XMLStreamException("Cannot serialize " + aBean.toString(), e);
    } catch (NoClassDefFoundError e) {
        log.error("NoClassDefFoundError while serializing " + aBean.toString() + ": " + e.toString());
        throw new XMLStreamException("Cannot serialize " + aBean.toString(), e);
    }
    String serialized = omElement.toStringWithConsume();
    return serialized;
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4548334

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档