为什么 axis2 生产webservice的客户端的中几乎都没有CallbackHandler和stub了?

tongshushan 2011-05-10 05:21:10
我看了一下axis2-1.5.4的sample,其生产webservice的客户端中几乎都没有CallbackHandler这个抽象类和stub了,客户端很简洁。
CallbackHandler 和stub的作用是什么,用axis2可以实现哪些webservice调用方式?
初次接触webservice和axis2,请朋友们指点一下,谢谢!
...全文
303 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
tongshushan 2011-05-13
  • 打赏
  • 举报
回复
没人知道吗?
tongshushan 2011-05-11
  • 打赏
  • 举报
回复
例如上面的这个Client端就没有CallbackHandler和stub 代码也很简洁。
新手求教!
tongshushan 2011-05-10
  • 打赏
  • 举报
回复
大部分的客户端都写成了一下这种形式:


package example.client;

import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;

public class TestClient {
private static EndpointReference targetEPR = new EndpointReference(
"http://localhost:8080/axis2/services/HelloWorld");

public static OMElement getSayHelloOMElement(String name) {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac
.createOMNamespace("http://sample/xsd", "hw");
OMElement method = fac.createOMElement("sayHello", omNs);
OMElement value = fac.createOMElement("name", omNs);
value.addChild(fac.createOMText(value, name));
method.addChild(value);
return method;
}

public static void main(String[] args) {
try {
Options options = new Options();
options.setTo(targetEPR);
ServiceClient sender = new ServiceClient();
sender.setOptions(options);
OMElement sayHello = getSayHelloOMElement("ZJ");
OMElement result = sender.sendReceive(sayHello);
System.out.println(result);
} catch (Exception e) {
e.printStackTrace();
}
}
}

67,516

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧