3, the use of tools TCP/IP monitor can monitor the interceptor request header and response header specific data
Soap is a text protocol based on XML Coding specification, so it is simple to say that SOAP transmits XML data on the basis of HTTP to realize remote invocation "No matter what language your server is written in, as long as you receive the XML data of the SOAP protocol and return the XML data of the SOAP protocol, Can be invoked in any language.
When using the Qqcheckonline validation in Qqonlinewebservicehttpget or Qqonlinewebservicehttppost, the returns are
nhttp://webxml.com.cn/">N>
Using TCP/IP Monitor
TCP/IP monitor can not only see the SOAP data, but also get the HTTP request and receive header information.
1, Location: This tool is located in: Window>show view>other>myeclipse Common (common tools) >TCP/IP Monitor
2, this tool, equivalent to an agent, after starting it will listen to a local port, and then forward the request to the specified destination IP and port.
Once the data is fetched, the data is returned to the customer intact. In the eyes of customers, always first access should be this agent, otherwise we will not see the process of data transfer.
3, configuration options:
On the open TCP/IP Monitor Interface: View Menu (small arrow at the top right) >properties>add (add to right)
Set to the following properties:
First step:
1 Local monitoring port (listening to port number): 9876, arbitrarily set a 4-bit port number, a will be through the form of http://127.0.0.1:9876 access
2 Host name (the server to listen for, such as www.jb51.net): 127.0.0.1– monitors native IP because a webservice is released on this machine. It can also be any host.
3 Port (ports for the target server to listen to): 6666-Because we released the WebService as Http://127.0.0.1:6666/helloworld so 6666 is the port number that needs listening.
4) type (type of listener):
--TCP/IP: The next request will continue to be accessed using the original address, such as user input: HTTP://127.0.0.1:9876/HELLOWORLD?WSDL will now return the WSDL service access address to the previous.
--HTTP: The next request will continue to be accessed using the destination address. such as user input: HTTP://127.0.0.1:9876/HELLOWORLD?WSDL will use Http://127.0.0.1:6666/helloworld to access the Sayhi method when the method is requested. This way will no longer be represented. Because it's not the port number you're listening to.
At the listening type, I chose TCP/IP and then viewed the change in the address in the returned WSDL file by typing in the address bar: http://127.0.0.1:9876/helloworld?wsdl.
Time Out: Set access to unsuccessful connection times, to remain 0, that is, not set.
After setting, click OK to press the twist, and then point to the right of the Start button, listening has been started.
Step Two:
Configure the WSDL URL as: http://127.0.0.1:9876/helloworld?wsdl on the webservice of MyEclipse, and note that the port for myeclipse TCP/IP monitor is used. Instead of going directly to our published HTTP://127.0.0.1:6666/HELLOWORLD?WSDL
How do I modify the contents of a WSDL file?
Use WebService annotations.
1, @WebService-Definition services
2, @WebMethod-Definition method
3, @WebResult-Define return value
4, @WebParam-Define parameters
Note: For annotations, different versions support the same degree:
1, 1.5 not supported.
2, 1.6.0_20 version must use the full annotation.
3, 1.6.0_21 can only use @webservice to annotate the class later.
The role of annotations:
By WebService annotation, you can describe Web services more image. Thus generating a WSDL document.
When the WebService annotation is modified, the client-generated code is also affected.
The method name and parameter name that were invoked also changed.
Example:
@WebService (name= "myname",//Corresponds porttype name= "myname" portname= "MyPort",//corresponding port name= "MyPort" in the service
MyService ",//Correspondence service Name=" MyService "targetnamespace=" http://leaf.com/mynamespace ")//Can be freely written in Java-like package
public class helloworld{private static SimpleDateFormat SDF = new SimpleDateFormat ("Yyyy-mm-dd HH:mm:ss"); @WebMethod (action= "myaction",//defines a soapaction= "myaction" used to find this method to execute Operationname= "myoperationname")//define the method that can be invoked
, the specific method of the corresponding class will be generated, Operation Name= "..."
The public @WebResult (name= "Mysayhelloresult") string//define the name of the returned value SayHello () {return "HelloWorld"; @WebMethod (action= "mysayhiaction", Operationname= "Mysayhioperationname") Public @WebResult (name= "Mysayhiresult") String Sayhi (@WebParam (name= "Myparaname",//Put parameters in header information, used to protect parameters, default in body Header=true, mode=mode.in) string name) {string
str = "Hello:" +name+ ", the current time is:" +sdf.format (New Date ());
return str;
public static void Main (string[] args) {endpoint.publish ("Http://127.0.0.1:6666/helloworld", New HelloWorld ()); }
}
3: After release of the above program, we visit through MyEclipse's WebService Explorer
You will find the same hints as before, but in fact, it is still the same method that you call.
4: Use Wsimport–s again. HTTP://127.0.0.1:6666/HELLOWORLD?WSDL generates Java code and then calls
The following is the calling code (which can be described as unrecognizable, but the same work is done.) )
Package com.leaf.mynamespace;
public class Main {public
static void Main (string[] args) {
//Getmyport returned from MyService by parsing the WSDL myname
MyName myname = new MyService (). Getmyport ();
Call Sayhi method
String str = myname.mysayhioperationname ("Wang Jian") by MyName Mysayhioperationname;
System.err.println (str);
}
About WebService Tutorials (ii) first to introduce you here, I hope to help you!