Webservice project instance construction

http://blog.csdn.net/hanxuemin12345/article/details/40163757

Note:

Question 1: When the service is published successfully, sometimes 404 will appear at the test address: http://localhost:8080/Hello?wsdl

1. It is because of the jdk version: Solution: window->preferences------->java-----> Detailed steps in the attached picture

2. The method published by the server cannot be static and non-final

3, because there are two javaw processes.

Solution: Use netstat /a /b to view the process in the command window-----"Start the task manager kill javaw process-----"Redeploy in myeclipse, start tomcat----"Use the test on IE Address test wsdl: localhost:8080/HelloWebService?wsdl------" finally succeeded! ! !

After tomcat is started, the console must see the last successfully printed code to indicate that the preparation is complete, and then go to IE to test.

 IE: Test address requires opening a new tab

 

Question 2: Tomcat cannot be started, and the console reports an error that the port is occupied

Solution: restart tomcat and clean the project

 

Question 3: When the client code is automatically implemented in the command window, an error will be reported: because tomcat is not started, the last address of the command and the wsdl file cannot be connected;

命令格式:wsimport -s D:\\Workspaces\\MyEclipse\\TheClient\\src -p com.hyan.client -keep http://localhost:8080/service/Hello?wsdl

wsimport -s working address -p automatically implemented code address -keep wsdl file address.

 

Question 4: Use the command code to report an error during the self-implementation process: the error service does not contain the service port,

The solution needs to read the wsdl file first,

wsdl files include

message: <!-- name="The method name written by the service server"-->

binding: <!-- name="server class name" servlet_class-->

binding: <!-- Data binding SOAP protocol servlet_name for server method transmission-->

service: <!-- address mapping name=server class name+service binding=binging name-->

My solution: If you can't generate it using the command window, use the generation function that comes with myeclipse.

new webService Client---->next----->WSDL URl: Fill in the address of the server publishing service--->next------>finish------>Automatically generate--- --"Create a new class in the client named myCilent------------"

In myclient, [service in wsdl] HelloService hs = new HelloService();

[Interface receiving port] Hello h = (Hello) hs.getHelloPort();

[Method in port] String result=h.getValue("Xixi");

 

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327081280&siteId=291194637