---
title: "WebService的5个方法如果来使用"
author: "duyunfengsolo"
date: "2009-08-20T10:42:22Z"
tags: ["WebService"]
slug: "webservice-5"
draft: false
lastmod: "2009-08-20T15:21:19Z"
id: 453426
url: "https://solodu.iteye.com/blog/453426"
---

```
(1)ServiceFunction client = null;
(2)ServiceFunctionService service = new ServiceFunctionServiceLocator();
(3)client = service.getServiceFunction();
(4)client.helloFunction();

解释：
在(1)中的ServiceFunction是个接口，这个接口是最重要的，它里面的helloFunction()方法才是真正和服务器打交道的。(2)中的ServiceFunctionService也是个接口而ServiceFunctionServiceLocator是其实现类。(3)getServiceFunction()是接口中的方法返回类型是ServiceFunction。(4)helloFunction()这个方法是接口中的方法，其真正的实现类方法是在:ServiceFunctionSoapBindingStub这个类中。
```

 

   
   
![](/upload/attachment/138283/0f51ffe5-93e7-33e5-b092-bc1c80b9fe9d.jpg)