Use axis to send xml packets, return and parse the message instance, axisxml
I learned a little about webservice some time ago, so I 'd like to share my achievements with you. For the sake of ability, I can only make a small instance. Sorry!
The idea of this example is: (1) construct the packet to be sent with the String type; (2) use axis to call the service to send the packet; (3) parse the returned packet.
The following is the package used by axis:
The following is the instance code:
1 // test instance 2 public class test {3 4 public static void main (String [] args) {5 // TODO Auto-generated method stub 6 test t = new test (); 7 // send 8 String requestXml = "<? Xml version = \ "1.0 \" encoding = \ "UTF-8 \"?> <Service xmlns = \ "http://www.chinatax.gov.cn/spec/\" xmlns: xsi = \ "Courier">
Of course, the format of the sent message varies according to the document type definition provided by others, so the method of parsing the message is different, but the general idea is as follows, so the code is only for reference.