JavaCXF calls the WebService of PHP [other languages]

Source: Internet
Author: User
Recently, ProcessMaker and ProcessMaker2.5 are WebServices released in php. Therefore, java cxf is required to call php webservice. To understand WebService, the key is wsdl. Step 1: blog.163.comkangle0925 @ 126blogstatic27758198201363111718168) 1. First

Recently, ProcessMaker 2.5 is a webservice released by php. Therefore, java cxf is required to call php webservice. The key to understanding Web Services is wsdl. Step 1: http://blog.163.com/kangle0925@126/blog/static/27758198201363111718168) 1. First

Recently, ProcessMaker 2.5 is a webservice released by php. Therefore, java cxf is required to call php webservice.

The key to understanding Web Services is wsdl.

Step 1:Http://blog.163.com/kangle0925@126/blog/static/27758198201363111718168)

1. Download The cxf package: http://cxf.apache.org/download.html. now cxf package.

2. decompress the package and run the cmd command to enter the bin directory.

3. Use the wsdl2java command to generate client code

Run wsdl2java-p com. winssage. demo. service-d: \ pmws-clientd: \ pmws \ wsdl2.xml on the command line (you only need to generate the WebService client-related code)

Wsdl2java usage:
Wsdl2java-p com-d src-all aa. wsdl
-P specifies the wsdl namespace, that is, the package name of the Code to be generated:
-D specifies the directory where the code to be generated is located
-The client generates the code for the client to test the web service.
-The server generates the code for the server to start the web service.
-Impl: generate the web service implementation code
-Ant generate the build. xml file
-All: generate all the starting endpoint code: types, service proxy, service interface, server mainline, client mainline, implementation object, and an Ant build. xml file.

Step 2: Modify the bean configuration file of cxf (spring integration)

Factory-bean = "wsSampleClientFactory" factory-method = "create"/>




ProcessMakerServiceSoap: the webservice interface Class (interface) generated from the wsdl must be assigned to the serviceClass attribute of the factory class org. apache. cxf. jaxws. JaxWsProxyFactoryBean.

The address attribute of the factory class org. apache. cxf. jaxws. JaxWsProxyFactoryBean must be taken from the service configuration in the wsdl. xml file, as shown below:


ProcessMaker Web Service



Solution:A class/interface with the same name "XXX **" is already in use.

Http://chenlin10058.iteye.com/blog/1558591)

1. Use-autoNameResolution for Automatic Processing

Wsdl2java-autoNameResolution http: // localhost: 8060/soa/services/otherTrackedVehicleSoapService? Wsdl

Or

Wsimport-p com. test. client-keep http: // localhost: 8060/soa/services/otherTrackedVehicleSoapService? Wsdl-B-XautoNameResolution


Troubleshooting: Super code compilation error:

  1. // ThisConstructorRequiresJAX-WSAPI2.2.YouWillNeedToEndorseThe2.2
  2. // APIJarOrRe-runWsdl2javaWith"-FrontendJaxws21"ToGenerateJAX-WS2.1
  3. // CompliantCodeInstead.
  4. PublicIcpBusinessService (WebServiceFeature...Features){
  5. Super (WSDL_LOCATION,SERVICE,Features );
  6. }
  7. // ThisConstructorRequiresJAX-WSAPI2.2.YouWillNeedToEndorseThe2.2
  8. // APIJarOrRe-runWsdl2javaWith"-FrontendJaxws21"ToGenerateJAX-WS2.1
  9. // CompliantCodeInstead.
  10. PublicIcpBusinessService (URLWsdlLocation,WebServiceFeature...Features){
  11. Super (wsdlLocation,SERVICE,Features );
  12. }
  13. // ThisConstructorRequiresJAX-WSAPI2.2.YouWillNeedToEndorseThe2.2
  14. // APIJarOrRe-runWsdl2javaWith"-FrontendJaxws21"ToGenerateJAX-WS2.1
  15. // CompliantCodeInstead.
  16. PublicIcpBusinessService (URLWsdlLocation,QNameServiceName,WebServiceFeature...Features){
  17. Super (wsdlLocation,ServiceName,Features );
  18. } $

It cannot be compiled normally because the jax-ws2.2 protocol conflicts with java6, execute the command:

Wsdl2java-frontend jaxws21-client *. xml

In this way, the code generated in the jax-ws2.1 can be compiled and executable in Java 6.


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.