2010-03-19 147 views
6

使用axis1,可以通过在log4j.properties中的HTTPSender上添加日志记录来记录传入/传出的SOAP消息。在迁移到axis2(版本1.4.1)之后,我很难弄清楚如何完成同样的日志记录。我曾尝试在axis2软件包和org.apache.commons.httpclient上添加日志记录,但未提供日志记录。SOAP记录轴2

任何想法?

TIA

回答

10

尝试登录这两个包用DEBUG级别:

  • httpclient.wire
  • org.apache.commons.httpclient

您应该看到类似以下的输出对于您提出的任何要求:

>> "SOAPAction: urn:GeteBayOfficialTime[\r][\n]" 
>> "User-Agent: Axis2[\r][\n]" 
>> "Host: api.sandbox.ebay.com[\r][\n]" 
>> "Content-Length: 1546[\r][\n]" 
>> "Content-Type: text/xml; charset=UTF-8[\r][\n]" 
>> "<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header><ns1:RequesterCredentials xmlns:ns1="urn:ebay:apis:eBLBaseComponents"><ns1:eBayAuthToken>XYZ_ABCD</ns1:eBayAuthToken></ns1:RequesterCredentials></soapenv:Header><soapenv:Body><ns1:GeteBayOfficialTimeRequest xmlns:ns1="urn:ebay:apis:eBLBaseComponents" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns1:GeteBayOfficialTimeRequestType"><ns1:DetailLevelCodeType>ReturnAll</ns1:DetailLevelCodeType><ns1:ErrorLanguage>en_US</ns1:ErrorLanguage><ns1:Version>427</ns1:Version></ns1:GeteBayOfficialTimeRequest></soapenv:Body></soapenv:Envelope> 

而对于传入回应:

<< "HTTP/1.1 200 OK[\r][\n]" 
<< "Date: Wed, 23 Aug 2006 02:17:33 GMT[\r][\n]" 
<< "Server: Microsoft-IIS/5.0[\r][\n]" 
<< "X-EBAY-API-SERVER-NAME: ZXCVBA[\r][\n]" 
<< "Content-Type: text/xml;charset=utf-8[\r][\n]" 
<< "X-Cache: MISS from thrasher.sjc.ebay.com[\r][\n]" 
<< "Connection: close[\r][\n]" 
<< "<?xml version="1.0" encoding="UTF-8"?>[\n]" 
<< "<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">[\n]" 
<< " <soapenv:Body>[\n]" 
<< " <GeteBayOfficialTimeResponse xmlns="urn:ebay:apis:eBLBaseComponents">[\n]" 
<< " <Timestamp>2006-08-23T02:17:33.544Z</Timestamp>[\n]" 
<< " <Ack>Success</Ack>[\n]" 
<< " <Version>475</Version>[\n]" 
<< " <Build>e475_core_Bundled_3434772_R1</Build>[\n]" 
<< " </GeteBayOfficialTimeResponse>[\n]" 
<< " </soapenv:Body>[\n]" 
<< "</soapenv:Envelope>" 
+1

谢谢。这('httpclient.wire')用于记录传出消息 – 2013-10-04 06:43:51

+0

Super。有用 – Vins 2017-01-26 16:10:49