有wsimport命令可以生成WSDL中引用的所有类型。但是这对于调用Web服务方法,将XML解析为Java对象等所有剩余的样板都没有做任何事情。
假设由服务提供者WSDL定义的名为CustomerService的Web服务提供操作getCustomerAddress(String CustomerID)并返回CustomerAddress类型的对象。 wsimport只生成CustomerAddress等类型。我正在寻找的是自动生成的代码,如:
String AppID = "" ; // autogenerated (if there was such parameter specified in WSDL)
String endpointA = "some end point";
CustomerAddress getCustomerAddress(String customerID) {
// all the bolierplate of actaully calling the webservice, unmarshalling the XML response
// including error/exception handling etc.
return result;
}