简体   繁体   English

检查来自Java / spring Web服务客户端的请求/响应

[英]Inspecting request/response from Java/spring web service client

I have a client written in Java using the Springsource toolkit (that is, the @Service attribute) that is talking to an external webservice (completely seperate, nothing to do with my company) via HTTPS. 我有一个使用Springsource工具包(即@Service属性)用Java编写的客户端,该客户端通过HTTPS与外部Web服务(完全独立,与我的公司无关)进行通信。 I'm getting an exception on the marshalSendAndReceive step, which states that the content-type is coming back as text/html instead of the expected text/xml - with the message "could this be an error message?" 我在marshalSendAndReceive步骤上遇到异常,该异常指出内容类型以text / html而不是预期的text / xml的形式返回-消息“这可能是错误消息吗?”

The webservice itself is the public test for the next version of the service, and calling the live service from the same code works fine. Web服务本身是该服务下一版本的公共测试,并且使用相同的代码调用实时服务可以正常工作。 This particular method I am calling works fine on the live system but not on the test system. 我正在调用的这种特定方法在实时系统上可以正常运行,但在测试系统上却无法正常运行。

My hunch is that the request is not correctly formatted for the test system - although only the response should have changed in the schema according to the release notes - and this is causing the service to return an error that is incorrectly parsed by my client. 我的直觉是,对于测试系统,请求的格式没有正确设置-尽管根据版本说明,模式中只应更改了响应-这导致服务返回由我的客户端错误解析的错误。 I am getting this error with all requests, even those that (according to the release notes) have not changed. 我的所有请求都收到此错误,即使那些请求(根据发行说明)也没有更改。

I have tried to use Fiddler and Wireshark to inspect the traffic, but can't get Fiddler to see it at all (I suspect this is a problem using Tomcat in STS with a proxy) and Wireshark can't decode the HTTPS stuff (I don't have the keys). 我曾尝试使用Fiddler和Wireshark来检查流量,但根本无法让Fiddler看到它(我怀疑这是在STS中使用带有代理的Tomcat中的问题),并且Wireshark无法解码HTTPS内容(我没有钥匙)。 I can't use HTTP, as the external service returns 403 Forbidden if I try. 我无法使用HTTP,因为如果尝试外部服务将返回403 Forbidden。

I'm not the original developer, and I'm not even a Java developer. 我不是原始开发人员,甚至不是Java开发人员。 I am an experienced .NET developer, so any analogies with that will be understood - otherwise, I am a dummy and phrase your instructions/questions/possible help accordingly. 我是一位经验丰富的.NET开发人员,因此可以理解与之类似的任何事物-否则,我是一个假人,并相应地表达您的说明/问题/可能的帮助。 As instructed by my predecessor, I have created a JAR file from the WSDL using XmlBeans and added that as a referenced library but I can't be sure that I've done that correctly, or even what it is that that is doing. 按照我的前任的指示,我已经使用XmlBeans从WSDL创建了一个JAR文件,并将其添加为引用的库,但是我不能确定自己是否正确地做到了,甚至不能确定这样做的意思。 It doesn't appear to have a discernable effect on things. 它似乎对事物没有明显的影响。

How can I debug this problem, and verify whether it is a problem with my client or their service? 如何调试此问题,并验证我的客户端或其服务是否存在问题?

My first goal would be getting Fiddler working. 我的第一个目标是让Fiddler工作。 It is difficult to debug in the dark. 在黑暗中很难调试。 However, where I get confused is when you discuss your client running in Tomcat in STS. 但是,当您讨论在STS的Tomcat中运行的客户端时,我会感到困惑。 Is your client a webapp? 您的客户是webapp吗?

Have you tried other tools like SoapUI to validate that the service is responding to your requests as expected? 您是否尝试过使用诸如SoapUI之类的其他工具来验证服务是否按预期响应了您的请求?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM