日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

axis2 调用webservice

發布時間:2024/8/26 编程问答 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 axis2 调用webservice 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

maven配置:主要引用包及plugins

<properties><axis2.version>1.6.1</axis2.version></properties><dependencies><dependency><groupId>org.apache.axis2</groupId><artifactId>axis2-kernel</artifactId><version>${axis2.version}</version></dependency><dependency><groupId>org.apache.axis2</groupId><artifactId>axis2-adb</artifactId><version>${axis2.version}</version></dependency><dependency><groupId>org.apache.axis2</groupId><artifactId>axis2-transport-http</artifactId><version>${axis2.version}</version></dependency><dependency><groupId>org.apache.axis2</groupId><artifactId>axis2-transport-local</artifactId><version>${axis2.version}</version></dependency></dependencies><build><plugins><plugin><groupId>org.apache.axis2</groupId><artifactId>axis2-wsdl2code-maven-plugin</artifactId><version>1.6.1</version><executions><execution><id>wsdl2code-client</id><phase>generate-sources</phase><goals><goal>wsdl2code</goal></goals></execution></executions><configuration><wsdlFile>src/main/resources/wsdl/IXman.wsdl</wsdlFile><packageName>com.stub.generated</packageName><generateServicesXml>false</generateServicesXml><unpackClasses>true</unpackClasses></configuration></plugin></plugins></build>

通過wsdlFile屬性指定wsdl所在文件。

如果是有多個wsdl需要生成java代碼,則可以用下面的配置:

<plugin><groupId>org.apache.axis2</groupId><artifactId>axis2-wsdl2code-maven-plugin</artifactId><version>1.6.0</version><executions><execution><id>ws1</id><goals><goal>wsdl2code</goal></goals><configuration><unpackClasses>true</unpackClasses><databindingName>adb</databindingName><packageName>org.example.stackoverflow.axis2-maven</packageName><wsdlFile>src/main/resources/service1.wsdl</wsdlFile><outputDirectory>target/generated-sources</outputDirectory><syncMode>sync</syncMode></configuration></execution><execution><id>ws2</id><goals><goal>wsdl2code</goal></goals><configuration><unpackClasses>true</unpackClasses><databindingName>adb</databindingName><packageName>org.example.stackoverflow.axis2-maven</packageName><wsdlFile>src/main/resources/service2.wsdl</wsdlFile><outputDirectory>target/generated-sources</outputDirectory><syncMode>sync</syncMode></configuration></execution></executions></plugin>

注意,這段xml配置,如果使用axis2-wsdl2code:wsdl2code命令去生成會報錯,但使用install者可以生成成功。

之后通過中間代碼調用即可。

@Testpublic void testWs() throws Exception{AIServiceStub aiServiceStub=new AIServiceStub();AIRequest aiRequest=new AIRequest();aiRequest.setMsgHeader("test");aiRequest.setMsgBody("test");AIResponse response= aiServiceStub.aIService_visit(aiRequest);System.out.println(response.getRes());}

?

轉載于:https://www.cnblogs.com/Gyoung/p/6132710.html

總結

以上是生活随笔為你收集整理的axis2 调用webservice的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。