Axis2 WebService的配置、发布、调用
准备工作 1. 下载 axis2-1.6.2-bin.zip,axis2-1.6.2-war.zip文件。http://axis.apache.org/axis2/java/core/download.cgi 2. 环境变量配置 AXIS2_HOME JAVA_HOME 3. axis2-1.6.2-war.zip压缩文件中的axis2.war复制到 %TOMCAT-HOME%/webapps目录下,然后启动
准备工作
1. 下载 axis2-1.6.2-bin.zip,axis2-1.6.2-war.zip文件。http://axis.apache.org/axis2/java/core/download.cgi
2. 环境变量配置
AXIS2_HOME
JAVA_HOME
3. axis2-1.6.2-war.zip压缩文件中的axis2.war复制到 %TOMCAT-HOME%/webapps目录下,然后启动Tomcat
访问 http://localhost:8080/axis2/ 看是否正常。
点击Services会进入service列表页面,当前只有一个Version服务。
4. 下载axis2-eclipse-codegen-wizard.zip和axis2-eclipse-service-archiver-wizard.zip 插件
http://archive.apache.org/dist/ws/axis2/tools/1_4_1/
解压后得到两个文件夹:Axis2_Codegen_Wizard_1.3.0和Axis2_Service_Archiver_1.3.0,拷贝至eclipse\dropins
注另一种方式,测试不成功,不推荐。下载axis-eclipse-codegen-plugin-1.6.2.zip和axis-eclipse-service-plugin1.6.2.zip文件解压后将plugins复制到%ECLIPSE_HOME%/plugins/目录下。 http://mirrors.cnnic.cn/apache/axis/axis2/java/core/1.6.2/
5. 安装完成后,IDE中选择new -> other 有Axis2 Wizards,说明插件安装成功。
AXIS2发布Web Services
一. 工程文件
新建Axis2Service1 java工程;
新建/Axis2Service1/src/ws/TestWs.java文件;
package ws; public class TestWs { public String showName(String name){ return name; } public String getName(){ return "Axis2Service Sample"; } }
二. aar部署方式
1. 手动打包
新建 /Axis2Service1/deploy文件夹,将/Axis2Service1/bin/目录下的class下文复制过来;
新建/Axis2Service1/deploy/META-INF/services.xml文件
<service name="AxisService"> <description>AxisService</description> <parameter name="ServiceClass">ws.TestWs</parameter> <operation name="showName"> <messagereceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"></messagereceiver> </operation> <operation name="getName"> <messagereceiver class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"></messagereceiver> </operation> </service>
2. 插件打包
在IDE中选择New -> other -> Axis2 Service Archiver,点击Next;
在Class File Location:选择Axis2Service1\bin目录,点击Next;
勾选Skip WSDL,点击Next;
Service Archiver 选择jar位置,没有jar包就直接点击Next;
勾选Generate the service xml automatically 自动生成XML file文件,点击Next;
service name,输入AxisService(名字可以自己定),然后在class name 中填写要发布的类(全路径),点击load,勾选search declared methods only,点击Next;
output File location ,output File Name输入artiver文件的名称AxisService。点击finish,提示Service Archvie generated successfully!表明生成成功。
3. 发布AxisService
AxisService.aar复制到%TOMCAT-HOME%/webapps/axis/WEB-INF/services下。(不打aar包,/Axis2Service1/deploy/下面复制过去也可以)
打开 http://localhost:8080/axis2/services/listServices 可以看到如下页面
AXIS2调用Web Services
一. 客户端stub文件生成
1. 脚本生成方式
在%AXIS2_HOME%/bin/ 目录下执行下面的命令wsdl2java -uri http://localhost:8080/axis2/services/AxisService?wsdl -p ws -s -o stub说明:-p 指定了生成的java类的报名;-o指定了生成的一系列文件保存的目录;在stub/src/ws 自动生成AxisServiceStub.java
2. 插件生成方式
IDE中选择New -> other -> Axis2 Code Generator, 点击Next;
勾选Generate Java source code from a SWDL file,点击Next;
WSDL file location输入:http://localhost:8080/axis2/services/AxisService?wsdl正确的话,点击Next;
指定输入路径,点击Next;
提示 All operation completed successfully!生成成功。在D:\src\wc 自动生成了stub一系列文件,其中ws是包名;
注:错误 An error occurred while completing process-java.lang.reflect.InvocationTargetException解决方法
1. 从AXIS2的LIB库中复制"geronimo-stax-api_1.0_spec-1.0.1.jar"和"backport-util- concurrent-3.1.jar"
文件到Axis2_Codegen_Wizard_1.3.0的lib目录中,同时修改 Axis2_Codegen_Wizard_1.3.0
下的plugin.xml文件,在文件中中添加:
如没有backport-util-concurrent-3.1.jar,可以从地址:http://backport-jsr166.sourceforge.net/ 下载。
2.将 $workspace位置\.metadata\.plugins下目录 Axis2_Codegen_Wizard 删除。
3.在命令行下切换至$ECLIPSE_HOME目录,然后执行:eclipse –clear。
如还决有问题参考如下解决办法:修改名字,再改回来
二. 客户端调用
脚本生成方式为例,插件生成的类似。
1. 新建 java工程 Axis2Client;
将%AXIS2_HOME%\lib\目录下的 jar包复制到\Axis2Client\lib\ , 并加入工程引用中,将通过脚本生成的单一AxisServiceStub.java文件 加入到src\ws、下;
2. 新建TestWs.java 代码如下
package ws; import java.rmi.RemoteException; public class Axis2Client { public static void main(String [] args) throws RemoteException{ //初始化Stub类 AxisServiceStub stub = new AxisServiceStub(); //传递AxisServiceStub.ShowName对象,相关参数在这边赋值 AxisServiceStub.ShowName command = new AxisServiceStub.ShowName(); command.setName("Hello!"); //取得返回值 String name = stub.showName(command).get_return(); System.out.println(name); } }
3. 调用成功后控制台输出:Hello!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

You can view various contents on Xiaohongshu, which can provide you with various help and help you discover a better life. If you have anything you want to share, you can post it here so that everyone can take a look. , and at the same time, it can bring you profits. It is very cost-effective. If you don’t know how to publish your works here, you can check out the tutorial. You can use this software every day and publish various contents to help everyone use it better. Don’t miss it if you need it! 1. Open Xiaohongshu and click the plus icon below. 2. There are [Video] [Picture] [Live Picture] options here; select the content you want to publish and click to check. 3. Select [Next] on the content editing page. 4. Enter the text content you want to publish and click [Publish Pen]

With the rapid development of social media, short video platforms have become the main channel for many users to express themselves and share their lives. Many users may encounter various problems when publishing videos of their works on Xiaohongshu. This article will discuss the reasons that may cause the video publishing of Xiaohongshu works to fail and provide the correct publishing method. 1. Why can’t Xiaohongshu publish videos of works? The Xiaohongshu platform may occasionally experience system failures, which may be caused by system maintenance or upgrades. In this case, users may encounter the problem of being unable to publish videos of their works. Users need to wait patiently for the platform to return to normal before trying to publish. An unstable or slow network connection may prevent users from posting videos of their work on Xiaohongshu. Users should confirm their network environment to ensure that the connection is stable and

As a lifestyle sharing platform, Xiaohongshu has attracted a large number of users to share their daily life and grow products. Many users have reported that their published content cannot be displayed. What is going on? This article will analyze the possible reasons why Xiaohongshu cannot be released and provide solutions. 1. Why can’t Xiaohongshu be released? Xiaohongshu implements strict community guidelines and has zero tolerance for publishing advertisements, spam, vulgar content, etc. If the user's content violates the regulations, the system will block it and the content will not be displayed. Xiaohongshu requires users to publish high-quality and valuable content, and the content needs to be unique and innovative. If the content is too generic and lacks innovation, it may not pass review and therefore not be displayed on the platform. 3. Account abnormality

As a popular social e-commerce platform, Xiaohongshu has attracted a large number of users to share their daily life and shopping experiences. Sometimes we may inadvertently publish some inappropriate content, which needs to be deleted in time to better maintain our personal image or comply with platform regulations. 1. How to delete Xiaohongshu releases? 1. Log in to your Xiaohongshu account and enter your personal homepage. 2. At the bottom of the personal homepage, find the "My Creations" option and click to enter. 3. On the "My Creations" page, you can see all published content, including notes, videos, etc. 4. Find the content that needs to be deleted and click the "..." button on the right. 5. In the pop-up menu, select the "Delete" option. 6. After confirming the deletion, the content will disappear from your personal homepage and public page.

How does the Xiaohongshu app publish works? Many friends know that there are a large number of creative works and a strong dating circle in this software. For users who are new to this software, they probably don’t know how to publish their works, so that more people can watch the other side of you. If you still don’t know how to publish the works in it, then quickly refer to the five-minute tutorial on publishing works on the Xiaohongshu app recommended by the editor of this site. Tutorial on publishing works in Xiaohongshu app in five minutes 1. Click [Three] As shown in the picture, click [Three] pointed by the red arrow in the upper left corner. 2. Click [Creation Center] As shown in the picture, click [Creation Center] pointed by the red arrow. 3. Click [Go to Publish] as shown in the picture,

Title: The working principle and configuration method of GDM in Linux systems In Linux operating systems, GDM (GNOMEDisplayManager) is a common display manager used to control graphical user interface (GUI) login and user session management. This article will introduce the working principle and configuration method of GDM, as well as provide specific code examples. 1. Working principle of GDM GDM is the display manager in the GNOME desktop environment. It is responsible for starting the X server and providing the login interface. The user enters

In today's social network era, Xiaohongshu has become an important platform for young people to share their lives and obtain information. Many users hope to attract more attention and traffic by publishing content on Xiaohongshu. So, when is the best time to post content? This article will explore in detail the selection of Xiaohongshu’s publishing time and the publishing location with the most traffic recommendations. 1. When is the best time to publish Xiaohongshu? The best time to publish content on Xiaohongshu is usually during periods of high user activity. According to the characteristics and behavioral habits of Xiaohongshu users, there are several time periods that are more appropriate. During the time period from 7 pm to 9 pm, most users have returned home from get off work and started browsing content on their mobile phones in search of relaxation and entertainment. Therefore, content posted during this period is more likely to attract users

With the rise of short video platforms, Xiaohongshu has become a platform for many people to share their lives, express themselves, and gain traffic. On this platform, publishing video works is a very popular way of interaction. So, how to publish Xiaohongshu video works? 1. How to publish Xiaohongshu video works? First, make sure you have a video content ready to share. You can use your mobile phone or other camera equipment to shoot, but you need to pay attention to the image quality and sound clarity. 2. Edit the video: In order to make the work more attractive, you can edit the video. You can use professional video editing software, such as Douyin, Kuaishou, etc., to add filters, music, subtitles and other elements. 3. Choose a cover: The cover is the key to attracting users to click. Choose a clear and interesting picture as the cover to attract users to click on it.
