Given a WSDL file, create a simple Java client

前端 未结 6 505
孤独总比滥情好
孤独总比滥情好 2020-12-28 10:10

Can anyone please provide me with a sample code for this? I have a wsdl file, and I want to create a client that will call a service from that wsdl file
A working code

相关标签:
6条回答
  • 2020-12-28 10:47

    The main options are to use:

    1. JAX-WS, using the wsimport tool.
    2. Apache AXIS2, using wsdl2java.

    Both links provide code examples. Some searching on the web will get you even farther. There are also options for creating dynamic SOAP clients but the generated ones are easiest.

    0 讨论(0)
  • 2020-12-28 10:54

    I've seen Apache Axis do this automatically. You may want to try that to get to know a little about it.

    0 讨论(0)
  • 2020-12-28 10:56

    One of the many possible tools is WSDL2Java. In a shell:

    $ java org.apache.axis.wsdl.WSDL2Java foo.wsdl
    
    0 讨论(0)
  • 2020-12-28 10:57

    You can do it from command line using wsimport provided by JAX-WS

    wsimport -keep -s (output folder) urlToWsdl

    > ex : wsimport -keep -s {homeDirectory}/OutputFolder https://www.example.com
    

    PS: while using non-standard SOAP 1.2 binding. You must specify the "-extension" option to use this binding.

    for further reading visit this

    0 讨论(0)
  • 2020-12-28 11:00

    Eclipse is having the option to generate java client.
    Just Right click on the WSDL file
    Generate Web Service Client
    Thatz all. You get the client to invoke the SOAP Service

    0 讨论(0)
  • 2020-12-28 11:07

    NetBeans can generate a lot of that code for you: File -> New File... -> Web Serices -> Web Service Client

    0 讨论(0)
提交回复
热议问题