Web
Eclipse
Application server
WebService
The SOAP
Eclipse Europa comes with its own Web tools. We can make it generate dynamic Web applications. But by default, the generated dynamic default program does not contain Web Service-related dependencies. so
When generating the project, check the Axis2 Web Service option in the Projet Facets dialog step
A project with web Service-related dependencies can be generated.
When it is generated, you may feel a little disappointed. “How could it be wrong?” . If you do, then you can gain some knowledge again. Because Eclipse doesn’t have Axis itself. So we need to download Axis and associate Eclipse’s WebService Settings with it. I downloaded the Axis2 1.4 release. Unzip to the directory you want, and then
Menu “Windows” – & gt; “Preferences…” —> Produce the left “Web Service” node –& GT; Select the Axis2 Preferences project –& GT; Set the Axis2 Runtime Location on the right under the “Axis2 Runtime” TAB
Just set up Axis2 1.4, which we just downloaded and unzipped.
After the above steps, we know how to successfully create a dynamic Web project with web Service-related dependencies. After we set up a project, we can try to write a Java class and publish it as a Web Service. If write the class as follows:
Java code
The
-
- package test; Public class HelloWorld {public String hello (String name) {return name + said: “hello world”; }}
The
-
-
- package test; Public class HelloWorld {public String hello (String name) {return name + said: “hello world”; }}
-
package test;
public class HelloWorld {
public String hello(String name) {
return name + "Hello World";
}
}
So how do you publish him?If you’ve looked at the Axis documentation, there are many ways to do this. If you don’t have patience, you’ll get confused. It’s a good thing we use tools for convenience. Try right-clicking the HelloWorld class you just wrote (under Java EE attempts). You can go to the “Web Services” option and in its word menu, click Create Web Service. Well, following the dialog wizard and your intentions, you might think it will work out pretty well. But it may not turn out that way. You will most likely encounter an exception named IWAB0489E. Specific as follows
The
IWAB0489E Error when deploying a Web service to The Axis runtime The Axis – admin failed with {http://schemas.xmlsoap.org/soap/envelope/} Client service always be found for it endpoint reference (EPR) http://localhost:8080/WebServiceTest/services/AdminService |
Don’t be discouraged, I have encountered this too, and when I searched for information on the Internet, I found that many foreigners have encountered this too. Probably this tool is not used much by Chinese people, the data is scarce. And some foreign English-language technology forums have been muddled. I’m not going to say anything here, just say the solution
In the generated webservice first dialog click Confingration the links below – & gt; Click “Apache Axis2” in the dialog box that pops up -> Click OK to return to the remote dialog and select Publish the Web Service, Monitor the Web Services
Well, now that you know the reason for the exception, Eclipse is generated by default according to Axis rules, not Axis2 rules. And we’re using Axis2. What follows the second arrow is to let you publish the Web service directly after generating it, and to enable our monitor to detect it.
Ok, so basically follow the Eclipse wizard down the road and you’ll be fine. When the launch is over and we believe that our server is open, we can test our launch success in the browser.
Login (note that WebsServiceTest is the name of the dynamic Web project I built)
http://localhost:8080/WebServiceTest/services/listServices to see if monitoring program has detected a Hello World we just write a web service.
landing
http://localhost:8080/WebServiceTest/services/HelloWorld?WSDL looks at the generated WSDL content.
landing
http://localhost:8080/WebServiceTest/services/HelloWorld/hello?Name = Zhangyt check the information returned by our Web service. At this point the meeting will open as follows
Xml code
-
-
-
- < Ns :helloResponse XMLNS :ns = “http://test” > & lt; ns:return > Zhangyt said: Hello world & LT;/ns:return > & lt;/ns:helloResponse > </ ol>
-
-
Xml code
-
-
-
-
- < Ns: helloResponse XMLNS: ns = “http://test” & gt; & lt; ns:return> Zhangyt said: Hello world & LT; /ns:return> & lt; /ns:helloResponse> </ ol>
-
-
-
<ns:helloResponse xmlns:ns="http://test"> <ns:return>zhangyt: Hello World</ns:return> </ns:helloResponse>
This was exciting because the test found that our Web service worked and returned what we wanted.
Well, this statement really just highlights some of the first things to notice about writing Web services using Eclipse. That’s how the tool is used. You can write a Web service using a tool, but you don’t really understand it. It is believed that many people will not be able to do many things once they leave Eclipse. Therefore, some homework should be done outside the application time. To see why, look at the relevant information.
Read More:
- How to Fix Failed to start service jboss.deployment.unit.”jboss-as-bmt.war”.INSTALL: org.jboss.msc.service.S
- Web Crawler: How to get the data in the web page and disguise the header, disguise as a browser to visit many times, avoid a single visit leading to IP blocked
- How to Fix SQL Error: 1054, SQLState: 42S22 Unknown column ‘markcardex0_.art_service_time’ in ‘field list’
- “503 Service Unavailable” error when connecting to vCenter Server using vSphere Web Client (2121043)
- Matplotlib of data visualization plt.xlim The () ylim() function sets the x-axis and y-axis range coordinates
- The web project removal server reports an error, and the web project in eclipse cannot be automatically deployed to Tomcat
- ERROR: Failed to parse POMs (How to Fix)
- How to Fix stack overflow error
- Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded (How to Fix)
- nt service 1072 No need to restart, repeat the method of installing the service program or service driver
- VCSA web access error 503 Service Unavailable
- How to Fix Session is not Connecting (How to Diagnose it)
- How to Fix failed to Connect to MySQL at localhost:3306 with user root
- How to Fix Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile
- An error was reported when springboot connected to redis Servlet.service () for servlet [dispatcherServlet] in context with path [] threw e
- Apawn class, add axis mapping to control apawn movement
- How to Fix Tomcat Error: Failed to destroy end point associated with ProtocolHandler[ajp-nio-8009]
- How to solve the “specified service has been marked for deletion” error
- How to Fix Error: JavaFX cannot find fxml
- Asp.netcore project publishing and deploying to IIS needs aspnetcore module v2