And*_*ddo 5 soap web-services http-headers jakarta-ee
一直在寻找和测试。
到目前为止我发现了什么:
- 处理程序.. 将soap 消息作为原始xml 输出到控制台输出这是非常好的解决方案。但是,对于HTTP标头(使用MimeHeaders),输出似乎太少了。例如在客户端我只得到
Accept : text/xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Content-Type : text/xml; charset=utf-8
Content-Length : 260
Run Code Online (Sandbox Code Playgroud)
- 系统属性
System.setProperty("com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump", "true");
System.setProperty("com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump", "true");
System.setProperty("com.sun.xml.ws.util.pipe.StandaloneTubeAssembler.dump", "true");
System.setProperty("com.sun.xml.ws.transport.http.HttpAdapter.dump", "true");
System.setProperty("com.sun.xml.internal.ws.transport.http.HttpAdapter.dump", "true");
Run Code Online (Sandbox Code Playgroud)
这是完美的输出到控制台、完整的 http 标头和肥皂消息。但不能自定义用于日志记录、操作标题/消息。这是一个示例
---[HTTP request - http://localhost:8080/Testmart/TestMartCatalogService]---
Accept: text/xml, multipart/related
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
User-Agent: JAX-WS RI 2.2.9-b130926.1035 svn-revision#5f6196f2b90e9460065a4c2f4e30e065b245e51e
<?xml version="1.0" ?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:getProducts xmlns:ns2="http://www.testmart.com"><arg0>books</arg0></ns2:getProducts></S:Body></S:Envelope>--------------------
---[HTTP response - http://localhost:8080/Testmart/TestMartCatalogService - 200]---
null: HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 414
Content-Type: text/xml;charset=UTF-8
Date: Sat, 30 Sep 2017 11:42:56 GMT
Server: JBoss-EAP/7
X-Powered-By: Undertow/1
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"/><soap:Body><ns1:getProductsResponse xmlns:ns1="http://www.testmart.com"><return xmlns=""><item>Inferno</item><item>Joyland</item><item>The Game Of Thrones</item></return></ns1:getProductsResponse><TestBodyElement>hahahaha</TestBodyElement></soap:Body></soap:Envelope>--------------------
Run Code Online (Sandbox Code Playgroud)
- Eclipse TCP/IP 监视器或 WireShark
两者都非常适合作为以前的解决方案进行监控,但像第一个这样(或以前)解决方案输出的程序化解决方案非常适合在代码内部控制它。
那么有没有另一种方式或我可能会错过使用的东西,比如处理程序或在处理程序中会输出像转储配置那样的详细信息?任何建议都非常感谢。
小智 2
我的解决方案是使用 getResponseContext()
Map<String, Object> responseHeaders;
responseHeaders = sourceDispatch.getResponseContext();
Object cookie = responseHeaders.get("javax.xml.ws.http.response.headers");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2500 次 |
| 最近记录: |