简体   繁体   English

从java访问wsdl的简便方法

[英]Easy way to access wsdl from java

I'm looking for an easy way to acces wsdl file from java. 我正在寻找一种从java访问wsdl文件的简单方法。

In python with suds I can do somethin like: 在使用suds python中,我可以做以下事情:

self.wsdlClient = Client(WSDL_URL)
wsdlClient.methodName()

Is there a way to connect to wsdl through an URL? 有没有办法通过URL连接到wsdl?

Python is a dynamic language so you can create methods on an object on the fly, like for example a method for each operation of your web service as discovered by reading the WSDL. Python是一种动态语言,因此您可以动态地在对象上创建方法,例如通过读取WSDL发现的Web服务的每个操作的方法。 But Java is not a dynamic language so the Python approach can't be used. 但Java不是动态语言,因此无法使用Python方法。

You either have to generate the code at design time (ie create a stub) by feeding the WSDL to some tool like wsimport.exe (or other tools) then use the generated code in your application or ... 您必须在设计时生成代码(即创建存根),方法是将WSDL提供给某些工具,如wsimport.exe (或其他工具),然后在您的应用程序中使用生成的代码或...

... you have to parse the WSDL at runtime and create the XML payload based on the information you acquired from the WSDL, in which case you might want to look at the following tool: soap-ws . ...您必须在运行时解析WSDL并根据从WSDL获取的信息创建XML有效负载,在这种情况下,您可能需要查看以下工具: soap-ws

The easiest way is to generate a stub. 最简单的方法是生成存根。

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

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