Spring integrates Cxf's Client

Source: Internet
Author: User
Tags wsdl

The service class has already been created, and the service has been published, and now it is time to call the publish and put service;

Here I divide it into two projects;

1. Re-create a webproject, and use the Wsdl2java tool to generate the Client's code (to Configure the CXF environment first);

Here I have a worried problem, first I use the JDK1.8, and then in the doc to generate the code when the prompt will appear

' 由于 accessExternalSchema 属性设置的限制而不允许  ‘file‘访问,因此无法读取方案文档 ‘xjc.xsd‘

Then I replaced it with a 1.7 jdk, but it didn't work, or continued with the hint, and the final solution was to add a configuration file called ' Jaxp.properties ' in the lib of the JDK1.7 jre, with the content

Javax.xml.accessExternalSchema = all, Smooth solution;

Statements that generate code in Doc:wsdl2java-d. http://localhost:8080/CxfAndSpring/ws/weather?wsdl

After the code is generated as follows

  

2. Start configuring the Applicationcontext.xml file

  

Address is the Server's WSDL document location;

ServiceClass is the WSDL document in the porttype, that is, you publish the interface name, you can pull your WSDL document to the bottom, and then according to the name of bingding to find porttype;

 

here, my porttype is weathercxf.

This is where the client configuration is done, and then the Junt is used to test clients.

1 Load the spring configuration file first:

  

2. Then we can get the results after we have the bean Configured.

Take care of sleeping ...

Spring integrates Cxf's Client

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.