Java and WebService docking case--Generate code method

Source: Internet
Author: User

The front-end time to do the project, because we give the three-party factory MES project, which has a reporting process, need our MES to submit products to their U9 (ERP), but because U9 is UF products, written in C #, and I was written in Java, Then webservice generated code is a little more difficult, third-party companies can not precisely debug the program, resulting in my side in vain to spend half a month to U9 docking, finally we all have no way, the direct use of C # re-write a webservice as the middle, And it's pretty easy for us to call the new webservice, but it's also a solution.

First docking with WebService, so take this opportunity to record a pen.

The other party will give the document, which has a URL, according to which the client code can be generated. (It's also possible to generate code using Eclipse's own capabilities, but the authors recommend it better than this)

Using tools: such as apache-cxf-3.2.1.zip,:http://cxf.apache.org/download.html

Unzip apache-cxf-3.2.1 to d:\\apache-cxf-3.2.1,

Setting environment variables

1, cxf_home=d:\apache-cxf-3.2.1

2, add%cxf_home%/bin after path;

3, through the cmd, input Wsdl2java, indicating that the usage is configured successfully.

4. Start generating code: URL:HTTP://I.SIMON.COM.CN/CREATEDISPATCHCOMPELETEORDER/CREATEDISPATCHCOMPELETESERVICE?WSDL in the document

CMD in execution:

Wsdl2java-d e:\\u9-client http://i.simon.com.cn/CreateDispatchCompeleteOrder/CreateDispatchCompeleteService?wsdl ,

Then U9 this directory will generate the corresponding code, put into the project, and finally refer to the other side of the document to start writing.

Half of this code is my fixed usage, and there are some Wsdl2java commands to refer to:

-p Specifies the namespace of its WSDL, which is the package name to generate code for

-d Specifies the directory where the code is to be generated

-client generating the code for the Client test Web service

-server The build server starts the code for the Web service

-impl Generating the implementation code for a Web service

-ant Generating Build.xml files

-all generates all start endpoint codes: Types,service Proxy,,service interface, server mainline, client mainline, implementation object, and an an T build.xml file.

Java and WebService docking case--Generate code method

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.