/* Pay attention to loading xfire-all-1.2.6.jar */
Import org. codehaus. xfire. client. Client;
/* Parse the returned xml using dom4j */
Import org. dom4j. Document;
Import org. dom4j. extends entexception;
Import org. dom4j. Element;
Import org. dom4j. io. SAXReader;
Public class Test {
Public static final String WebService_URL = "http: // 111.11.11.111: 8888/desk/service. asmx? Wsdl ";
Public static void main (String [] args ){
Client client1 = null;
Try
{
Client1 = new Client (new URL (WebService_URL ));
Object [] strResult1 = null;
// If the interface has a method name and a parameter needs to be included, specify the parameter in the form of an Object [] array in invoke.
StrResult1 = client1.invoke ("interface method name", new Object [] {parms1, parms2 ,.....
});
System. out. println ("Calling Interface return xml format -->" + strResult1 [0]);
}
Catch (MalformedURLException e)
{
E. printStackTrace ();
}
Catch (Exception e)
{
E. printStackTrace ();
}
}
}
This article is from the "Youth bag" blog