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