简体   繁体   English

如何测试cxf生成的SOAP客户端?

[英]How to test cxf generated SOAP client?

I have generated classes from a wsdl using wsdl2java from CXF. 我已经使用CXF的wsdl2java从wsdl生成了类。 This wsdl has securitypolicy which uses security token though. 此wsdl具有使用安全令牌的securitypolicy。

Could someone guide me how to test this client? 有人可以指导我如何测试此客户端吗? I am stuck as the client tries to obtain a token from a mock server I built using WireMock, but it cannot as the mock server does not know how to respond. 当客户端尝试从使用WireMock构建的模拟服务器中获取令牌时,我陷入了困境,但由于模拟服务器不知道如何响应,它无法这样做。

Thanks! 谢谢!

Try generating server side classes using cxf and implement the server side method to respond with proper response. 尝试使用cxf生成服务器端类,并实现服务器端方法以适当的响应进行响应。

Again this is kind of simulator which you build using cxf. 同样,这是一种使用cxf构建的模拟器。

I'm answering my post again. 我再次回答我的帖子。 So there is no straightforward way of doing this as it is very difficult to mock a server with the security policies implemented. 因此,没有直接的方法来执行此操作,因为很难模拟实现了安全策略的服务器。

Thus, what I did is create another service without the authentication part and tested it. 因此,我要做的是创建另一个没有身份验证部分的服务并对其进行测试。 We can also say that we don't need to test the authentication part as cxf anyways handles it. 我们也可以说我们不需要测试身份验证部分,因为无论如何cxf都会处理它。

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

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