/**
* SayHelloStub.java
*
* This file was auto-generated from WSDL
* by the Apache Axis2 version: 1.1.1 Jan 09, 2007 (06:20:51 LKT)
*/
package org.example.www.sayhello;
/*
* SayHelloStub java implementation
*/
public class SayHelloStub extends org.apache.axis2.client.Stub
{
protected org.apache.axis2.description.AxisOperation[] _operations;
//hashmaps to keep the fault mapping
private java.util.HashMap faultExeptionNameMap = new java.util.HashMap();
private java.util.HashMap faultExeptionClassNameMap = new java.util.HashMap();
private java.util.HashMap faultMessageMap = new java.util.HashMap();
private void populateAxisService() throws org.apache.axis2.AxisFault {
//creating the Service with a unique name
_service = new org.apache.axis2.description.AxisService("SayHello" + this.hashCode());
//creating the operations
org.apache.axis2.description.AxisOperation __operation;
_operations = new org.apache.axis2.description.AxisOperation[1];
__operation = new org.apache.axis2.description.OutInAxisOperation();
__operation.setName(new javax.xml.namespace.QName("", "SayHello"));
_service.addOperation(__operation);
_operations[0]=__operation;
}
//populates the faults
private void populateFaults(){
}
/**
Constructor that takes in a configContext
*/
public SayHelloStub(org.apache.axis2.context.ConfigurationContext configurationContext,
java.lang.String targetEndpoint)
throws org.apache.axis2.AxisFault {
//To populate AxisService
populateAxisService();
populateFaults();
_serviceClient = new org.apache.axis2.client.ServiceClient(configurationContext,_service);
configurationContext = _serviceClient.getServiceContext().getConfigurationContext();
_serviceClient.getOptions().setTo(new org.apache.axis2.addressing.EndpointReference(
targetEndpoint));
}
/**
* Default Constructor
*/
public SayHelloStub() throws org.apache.axis2.AxisFault {
this("http://www.example.org/" );
}
/**
* Constructor taking the target endpoint
*/
public SayHelloStub(java.lang.String targetEndpoint) throws org.apache.axis2.AxisFault {
this(null,targetEndpoint);
}
/**
* Auto generated method signature
* @see org.example.www.sayhello.SayHello#SayHello
* @param param0
*/
public org.example.www.sayhello.SayHelloStub.SayHelloResponse SayHello(
org.example.www.sayhello.SayHelloStub.SayHello param0)
throws java.rmi.RemoteException
{
try{
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0].getName());
_operationClient.getOptions().setAction("http://www.example.org/SayHello/NewOperation");
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
// create SOAP envelope with that payload
org.apache.axiom.soap.SOAPEnvelope env = null;
//Style is Doc.
env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),
param0,
optimizeContent(new javax.xml.namespace.QName("",
"SayHello")));
//adding SOAP headers
_serviceClient.addHeadersToEnvelope(env);
// create message context with that soap envelope
org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext() ;
_messageContext.setEnvelope(env);
// add the message contxt to the operation client
_operationClient.addMessageContext(_messageContext);
//execute the operation client
_operationClient.execute(true);
org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext(
org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();
java.lang.Object object = fromOM(
_returnEnv.getBody().getFirstElement() ,
org.example.www.sayhello.SayHelloStub.SayHelloResponse.class,
getEnvelopeNamespaces(_returnEnv));
_messageContext.getTransportOut().getSender().cleanup(_messageContext);
return (org.example.www.sayhello.SayHelloStub.SayHelloResponse)object;
}catch(org.apache.axis2.AxisFault f){
org.apache.axiom.om.OMElement faultElt = f.getDetail();
if (faultElt!=null){
if (faultExeptionNameMap.containsKey(faultElt.getQName())){
//make the fault by reflection
try{
java.lang.String exceptionClassName = (java.lang.String)faultExeptionClassNameMap.get(faultElt.getQName());
java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);
java.lang.Exception ex=
(java.lang.Exception) exceptionClass.newInstance();
//message class
java.lang.String messageClassName = (java.lang.String)faultMessageMap.get(faultElt.getQName());
java.lang.Class messageClass = java.lang.Class.forName(messageClassName);
java.lang.Object messageObject = fromOM(faultElt,messageClass,null);
java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage",
new java.lang.Class[]{messageClass});
m.invoke(ex,new java.lang.Object[]{messageObject});
throw new java.rmi.RemoteException(ex.getMessage(), ex);
}catch(java.lang.ClassCastException e){
// we cannot intantiate the class - throw the original Axis fault
throw f;
} catch (java.lang.ClassNotFoundException e) {
// we cannot intantiate the class - throw the original Axis fault
throw f;
}catch (java.lang.NoSuchMethodException e) {
// we cannot intantiate the class - throw the original Axis fault
throw f;
} catch (java.lang.reflect.InvocationTargetException e) {
// we cannot intantiate the class - throw the original Axis fault
throw f;
} catch (java.lang.IllegalAccessException e) {
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
近一段时间在学习Web Service,呼必斯哈拉图--写的"Apache AXIS 开发 Web Services Step By Step"非常的详细,网上也存在很多不通的转载版本,很多人都说不行。我经过多次试验,总结出错误的原因有以下几个: Eclipse与Axis2插件版本不兼容。新版的Eclipse可能不完全向下兼容Axis2插件(太旧版的Axis2插件)。 网上博客的文章很多存在一些小错误。 细节问题没做好。 现在我把自己的操作成功的实例重新演练一遍,基本跟大家啊网上参考的一致,请注意every setp 。我的习惯,先写一个文章大纲: 软件配置。 构建Web Service。 生成WSDL。 生成客户端和服务器端,还有简单测试。
资源推荐
资源详情
资源评论
收起资源包目录
用Eclipse3.2+MyEclipse5.5M1+axis2_1.1.1+tomcat5.5 开发Web Services.rar (40个子文件)
用Eclipse3.2+MyEclipse5.5M1+axis2_1.1.1+tomcat5.5 开发Web Services.doc 584KB
SayHello
.project 1010B
.mymetadata 297B
WebRoot
WEB-INF
web.xml 375B
lib
classes
SayHello.wsdl 2KB
resources
SayHello.wsdl 3KB
services.xml 716B
org
example
www
sayhello
SayHelloStub$ExtensionMapper.class 1KB
SayHelloMessageReceiverInOut.class 6KB
SayHelloStub$SayHello$1.class 4KB
SayHelloResponse$Factory.class 3KB
SayHelloResponse$1.class 4KB
SayHelloTest.class 2KB
SayHelloSkeleton.class 1KB
SayHello$1.class 4KB
SayHelloStub$SayHello$Factory.class 3KB
SayHelloStub.class 10KB
SayHelloStub$SayHelloResponse$1.class 4KB
SayHelloResponse.class 3KB
SayHelloStub$SayHelloResponse$Factory.class 3KB
SayHelloStub$SayHelloResponse.class 3KB
SayHello$Factory.class 3KB
ExtensionMapper.class 920B
SayHelloStub$SayHello.class 3KB
SayHello.class 3KB
test
org
example
www
sayhello
build.xml 4KB
index.jsp 834B
META-INF
MANIFEST.MF 39B
.myeclipse
src
SayHello.wsdl 2KB
resources
SayHello.wsdl 3KB
services.xml 716B
org
example
www
sayhello
SayHello.java 14KB
SayHelloStub.java 40KB
SayHelloTest.java 1KB
ExtensionMapper.java 826B
SayHelloMessageReceiverInOut.java 6KB
SayHelloResponse.java 14KB
SayHelloSkeleton.java 948B
test
org
example
www
sayhello
build.xml 4KB
.classpath 495B
共 40 条
- 1
资源评论
- jianyunchongxian2014-03-22还有吧 一般般
dengxingbo
- 粉丝: 18
- 资源: 27
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 论文(最终)_20240430235101.pdf
- 基于python编写的Keras深度学习框架开发,利用卷积神经网络CNN,快速识别图片并进行分类
- 最全空间计量实证方法(空间杜宾模型和检验以及结果解释文档).txt
- 5uonly.apk
- 蓝桥杯Python组的历年真题
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 前端开发技术实验报告:内含4四实验&实验报告
- Highlight Plus v20.0.1
- 林周瑜-论文.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功