搜索
首页php教程php手册Java CXF调用PHP[其它语言]的Web Service

最近在研究ProcessMaker,ProcessMaker 2.5版本是用php发布的webservice,所以需要采用java 的cxf调用php的webservice过程。 要了解Web Service,关键的是wsdl。 步骤一: http://blog.163.com/kangle0925@126/blog/static/27758198201363111718168) 1、先

         最近在研究ProcessMaker,ProcessMaker 2.5版本是用php发布的webservice,所以需要采用java 的cxf调用php的webservice过程。

         要了解Web Service,关键的是wsdl。

         步骤一:http://blog.163.com/kangle0925@126/blog/static/27758198201363111718168)

                1、先下载cxf包:http://cxf.apache.org/download.html,现在cxf包。

               2、解压缩包,通过cmd命令进入到bin目录下

Java CXF调用PHP[其它语言]的Web Service

            3、使用wsdl2java命令生成客户端代码

在命令行执行wsdl2java -p com.winssage.demo.service  -d d:\pmws -clientd:\pmws\wsdl2.xml            (只需生成WebService客户端相关的代码即可)

       

        wsdl2java用法: 
        wsdl2java -p com -d src -all  aa.wsdl 
        -p  指定其wsdl的命名空间,也就是要生成代码的包名: 
        -d  指定要产生代码所在目录 
        -client 生成客户端测试web service的代码 
        -server 生成服务器启动web  service的代码 
        -impl 生成web service的实现代码 
        -ant  生成build.xml文件 
        -all 生成所有开始端点代码:types,service proxy,,service interface, server mainline, client mainline, implementation object, and an Ant build.xml file. 

      步骤二:修改cxf的bean配置文件(spring集成)

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

     

     ProcessMakerServiceSoap:为从wsdl生成的webservice 接口类(interface),必须赋值予工厂类org.apache.cxf.jaxws.JaxWsProxyFactoryBean的serviceClass属性。

     工厂类org.apache.cxf.jaxws.JaxWsProxyFactoryBean的address属性:必须取自wsdl.xml文件中的service配置,如下

      service name="ProcessMakerService">
            ProcessMaker Web Service
            port
name="ProcessMakerServiceSoap" binding="xs0:ProcessMakerServiceSoap">
                  soap12:address
location="http://192.168.1.215:80/sysworkflow/en/classic/services/soap2"/>
            port>
      service>

     

     错误解决:A class/interface with the same name "XXX**" is already in use.

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

    1.使用-autoNameResolution自动处理 

     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 


   错误解决:super相关代码编译报错:

    

  1. //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2   
  2.    //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1   
  3.    //compliant code instead.   
  4.    public IcpBusinessService(WebServiceFeature ... features) {   
  5.        super(WSDL_LOCATION, SERVICE, features);   
  6.    }   
  7.   
  8.    //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2   
  9.    //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1   
  10.    //compliant code instead.   
  11.    public IcpBusinessService(URL wsdlLocation, WebServiceFeature ... features) {   
  12.        super(wsdlLocation, SERVICE, features);   
  13.    }   
  14.   
  15.    //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2   
  16.    //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1   
  17.    //compliant code instead.   
  18.    public IcpBusinessService(URL wsdlLocation, QName serviceName, WebServiceFeature ... features) {   
  19.        super(wsdlLocation, serviceName, features);   
  20.      $

    其不能正常编译通过是由于jax-ws2.2规约与java6冲突,执行命令:

wsdl2java -frontend jaxws21 -client *.xml

 

    这样以jax-ws2.1生成的代码就可以在java6中编译通过并可执行。




        

声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

AI Hentai Generator

AI Hentai Generator

免费生成ai无尽的。

热门文章

R.E.P.O.能量晶体解释及其做什么(黄色晶体)
4 周前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳图形设置
4 周前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.如果您听不到任何人,如何修复音频
4 周前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.聊天命令以及如何使用它们
4 周前By尊渡假赌尊渡假赌尊渡假赌

热工具

DVWA

DVWA

Damn Vulnerable Web App (DVWA) 是一个PHP/MySQL的Web应用程序,非常容易受到攻击。它的主要目标是成为安全专业人员在合法环境中测试自己的技能和工具的辅助工具,帮助Web开发人员更好地理解保护Web应用程序的过程,并帮助教师/学生在课堂环境中教授/学习Web应用程序安全。DVWA的目标是通过简单直接的界面练习一些最常见的Web漏洞,难度各不相同。请注意,该软件中

VSCode Windows 64位 下载

VSCode Windows 64位 下载

微软推出的免费、功能强大的一款IDE编辑器

SublimeText3 Linux新版

SublimeText3 Linux新版

SublimeText3 Linux最新版

Atom编辑器mac版下载

Atom编辑器mac版下载

最流行的的开源编辑器

SublimeText3汉化版

SublimeText3汉化版

中文版,非常好用