webservice 使用axis2实现
Axis2 是Apache的:使用下载 :org.apache.axis2.eclipse.service.plugin_1.6.2.jar org.apache.axis2.eclipse.codegen.plugin_1.6.2.jar
axis2-1.6.2-war.zip axis2-1.6.2-bin.zip
将war包积压布署到tomcat上 放在D:\apache-tomcat-7.0.56\webapps 启动tomcat 浏览器访问 localhost:8080/axis2/ 验证看下就行(8080端口可能被Oracle占用)
前两个为eclipse的插件
将两个包考到: D:\MyEclipse\MyEclipse 10\dropins 目录下重启MyEclipse (Myeclipse8.5版本貌似不好使)
生成Webservice服务 指定到所提供服务方法java文件class所在位置,有的情况是java类不要放在包里要不找不到class
导入工程所用jar包
选择提供服务的类的方法
将服务生成在tomcat下
这时在tomcat相应目录下会生成aar文件
浏览器访问
选择相应Service会看到生成的服务模版
访问方法 所提供方法名加? key为getFromRedis方法中参数的值 原方法为public String[][] getFromRedis(String key)
Axis2 不支持方法参数为map list,但可以是二维数组,或是类的对象,而且Axis2 不支持重载,重载的方法在生成服务端wsdl文件时,可能将两个重载方法只生成一个方法调用时会报出数组越界异常。
用axis2-1.6.2-bin.zip生成Webservice客户端 可以用bin目录下的wsdl2java.bat工具将wsdl文件生成客户端
使用该工具需要配置JAVA_HOME ,也可以在ue打开wsdl2java.bat 在文件中配置
teat.a 是生成的包名 生成的文件就在bin下面的src下
在MyService下新建web工程将MyService2Stub.java copy到src下 把axis2-1.6.2-bin.zip下lib的jar包copy到web工程的lib下
下面是个二维数组作为参数的方法服务生成的例子
服务端代码 有三个方法
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock; public class Redis {
/**
* 无key存入 向redis存数组以map形式存,返回key存入失败返回-1
* @param String[][]
* @return key
*/ public String saveToRedis(String[][] ObjectMap) {
String key = null;
Lock lock = new ReentrantLock();
try{
lock.lock();
key = new Date().getTime()+"";
}finally{
lock.unlock();
}
HashMap<String,String> map = new HashMap<String,String>();
for(int i=0;i<ObjectMap.length;i++){
System.out.println(ObjectMap[i][0]+"-------"+ObjectMap[i][1]);
map.put(ObjectMap[i][0],ObjectMap[i][1]);
}
GetRedisCluster redisCluster = new GetRedisCluster();
try {
redisCluster.getRedisCluster().hmset(key, map);
} catch (Exception e) {
return "-1";
}
return key;
} /**
* 有key存入 向redis存数组以map形式存,返回key存入失败返回-1
* @param String[][] key
* @return key
*/
public String saveToRedisWithKey(String key,String[][] ObjectMap) {
HashMap<String,String> map = new HashMap<String,String>();
System.out.println(ObjectMap.length+ "---------------------------");
for(int i=0;i<ObjectMap.length;i++){
System.out.print(ObjectMap[i][0]+"------------------");
System.out.println(ObjectMap[i][1]+"------------------");
map.put(ObjectMap[i][0],ObjectMap[i][1]); }
GetRedisCluster redisCluster = new GetRedisCluster();
try {
redisCluster.getRedisCluster().hmset(key, map);
} catch (Exception e) {
return "-1";
}
return key;
}
/**
* 用key从redis取数组 异常时返回[-1][-1]数组
* @param key
* @return String[][]
*/
public String[][] getFromRedis(String key) {
GetRedisCluster redisCluster = new GetRedisCluster();
Map map = new HashMap();
try {
map = (Map) redisCluster.getRedisCluster().hgetAll(key);
} catch (Exception e) {
String[][] fail = {{"-1","-1"}};
return fail;
}
Set<Map.Entry<String, String>> entrySet = map.entrySet();
Iterator<Map.Entry<String, String>> it = entrySet.iterator();
System.out.println(entrySet.size());
String[][] ObjectMap = new String[entrySet.size()][2];
int i = 0;
while(it.hasNext()){
Map.Entry<String, String> me = it.next();
String key1 = me.getKey();
String value = me.getValue();
System.out.println(i);
ObjectMap[i][0] = key1;
ObjectMap[i][1] = value;
System.out.println("key: "+key1+"-->value: "+value);
i++;
}
return ObjectMap;
} }
服务端方法类调用的类
import java.util.HashSet;
import java.util.Set; import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.JedisCluster; public class GetRedisCluster {
/**
* 获得redis集群连接
* @return
*/
public JedisCluster getRedisCluster(){
Set<HostAndPort> jedisClusterNodes = new HashSet<HostAndPort>();
//Jedis Cluster will attempt to discover cluster nodes automatically
jedisClusterNodes.add(new HostAndPort("192.168.56.101", 6379));
jedisClusterNodes.add(new HostAndPort("192.168.56.101", 6380));
jedisClusterNodes.add(new HostAndPort("192.168.56.101", 6381));
JedisCluster jc = new JedisCluster(jedisClusterNodes,5000,10000);
return jc;
} }
不通过Webservice调用 本地调用的方法
import java.awt.List;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set; import redis.clients.jedis.BinaryShardedJedis;
import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisCluster;
import redis.clients.jedis.JedisShardInfo; public class MysqlToRedis { public static void main(String[] args) { // Set<HostAndPort> jedisClusterNodes = new HashSet<HostAndPort>();
// //Jedis Cluster will attempt to discover cluster nodes automatically
// jedisClusterNodes.add(new HostAndPort("192.168.56.101", 6379));
// jedisClusterNodes.add(new HostAndPort("192.168.56.101", 6380));
// jedisClusterNodes.add(new HostAndPort("192.168.56.101", 6381));
// JedisCluster jc = new JedisCluster(jedisClusterNodes,5000,1000); Connection con = null;
Statement stmt = null;
ResultSet rs = null;
//Order order = new Order();
//Order order1 = new Order();
Redis redis = new Redis();
String [][] newOrder = new String [3][2];
String [][] newOrder1 = new String [3][2];
BaseDTO baseDTO = new BaseDTO();
//SaveToRedis str = new SaveToRedis();
//GetRedis gr = new GetRedis();
try{
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/iom", "root", "weiguoyuan");//java.sql 包中 Connection 接口的实现
stmt = con.createStatement();//通过Connection创建一个语句对象,语句对象可以执行语句
rs = stmt.executeQuery("select * from e_crm_order");//定义一个结果集接受查询结果
while(rs.next()){
//
// order.setId(rs.getString("srv_order_id"));
// order.setNet_type(rs.getString("net_type"));
// order.setSerial_no(rs.getString("serial_no"));
// order.setUser_id(rs.getString("user_id"));
// order.setNet_code(rs.getString("net_code"));
// order.setMain_server_id(rs.getString("main_server_id"));
// order.setAccept_date(rs.getString("accept_date"));
// order.setDepart_name(rs.getString("depart_name"));
// order.setStaff_id(rs.getString("staff_id"));
// order.setStaff_name(rs.getString("staff_name")); //redis.saveOrderToRedis(order);
//order1 = redis.getOrderFromRedis(order.getId());
//System.out.println(order1.getId()+" "+ order.getNet_type()+" "+order1.getSerial_no()+" "+order1.getUser_id()+" "+order1.getNet_code()+" "+
// order1.getMain_server_id()+" "+order1.getAccept_date()+" "+order1.getDepart_name()+" "+order1.getStaff_id()+" "+order1.getStaff_name()); HashMap<String,String> hm = new HashMap<String,String>();
HashMap<String,String> map = new HashMap<String,String>();
HashMap<String,String> map1 = new HashMap<String,String>();
hm.put("net_type", rs.getString("net_type"));
hm.put("serial_no",rs.getString("serial_no"));
hm.put("user_id", rs.getString("user_id"));
//redis.saveOrderToRedis(rs.getString("srv_order_id"), hm);
newOrder[0][0] = "net_type";
newOrder[0][1] = rs.getString("net_type");
newOrder[1][0] = "serial_no";
newOrder[1][1] = rs.getString("serial_no");
newOrder[2][0] = "user_id";
newOrder[2][1] = rs.getString("user_id");
//baseDTO.setObjectMap(newOrder);
//String key = redis.saveToRedis(newOrder);
String key1 = redis.saveToRedis(newOrder);
System.out.println(key1);
//System.out.println(key); //map=(HashMap<String, String>) redis.getOrderFromRedis(rs.getString("srv_order_id"));
//newOrder1 =redis.getFromRedis(key);
//jedis.hmset(key,hm);
//System.out.println(map);
//System.out.println(newOrder1+"--------------");
// for(int i=0;i<newOrder1.length;i++){
// System.out.println(newOrder1.length);
// System.out.print(newOrder1[i][0]);
// System.out.println(newOrder1[i][1]);
// }
} }
catch(ClassNotFoundException e){
e.printStackTrace();
}
catch(SQLException e){
e.printStackTrace();
}
try{
rs.close();
stmt.close();
con.close();
}
catch(SQLException e){
e.printStackTrace();
} } }
客户端的代码
wsdl生成的客户端代码
/**
* RedisServiceStub.java
*
* This file was auto-generated from WSDL
* by the Apache Axis2 version: 1.6.2 Built on : Apr 17, 2012 (05:33:49 IST)
*/
package RedisService; /*
* RedisServiceStub java implementation
*/ public class RedisServiceStub extends org.apache.axis2.client.Stub
{
protected org.apache.axis2.description.AxisOperation[] _operations; //hashmaps to keep the fault mapping
private java.util.HashMap faultExceptionNameMap = new java.util.HashMap();
private java.util.HashMap faultExceptionClassNameMap = new java.util.HashMap();
private java.util.HashMap faultMessageMap = new java.util.HashMap(); private static int counter = 0; private static synchronized java.lang.String getUniqueSuffix(){
// reset the counter if it is greater than 99999
if (counter > 99999){
counter = 0;
}
counter = counter + 1;
return java.lang.Long.toString(java.lang.System.currentTimeMillis()) + "_" + counter;
} private void populateAxisService() throws org.apache.axis2.AxisFault { //creating the Service with a unique name
_service = new org.apache.axis2.description.AxisService("RedisService" + getUniqueSuffix());
addAnonymousOperations(); //creating the operations
org.apache.axis2.description.AxisOperation __operation; _operations = new org.apache.axis2.description.AxisOperation[3]; __operation = new org.apache.axis2.description.OutInAxisOperation(); __operation.setName(new javax.xml.namespace.QName("http://ws.apache.org/axis2", "saveToRedisWithKey"));
_service.addOperation(__operation); _operations[0]=__operation; __operation = new org.apache.axis2.description.OutInAxisOperation(); __operation.setName(new javax.xml.namespace.QName("http://ws.apache.org/axis2", "saveToRedis"));
_service.addOperation(__operation); _operations[1]=__operation; __operation = new org.apache.axis2.description.OutInAxisOperation(); __operation.setName(new javax.xml.namespace.QName("http://ws.apache.org/axis2", "getFromRedis"));
_service.addOperation(__operation); _operations[2]=__operation; } //populates the faults
private void populateFaults(){ } /**
*Constructor that takes in a configContext
*/ public RedisServiceStub(org.apache.axis2.context.ConfigurationContext configurationContext,
java.lang.String targetEndpoint)
throws org.apache.axis2.AxisFault {
this(configurationContext,targetEndpoint,false);
} /**
* Constructor that takes in a configContext and useseperate listner
*/
public RedisServiceStub(org.apache.axis2.context.ConfigurationContext configurationContext,
java.lang.String targetEndpoint, boolean useSeparateListener)
throws org.apache.axis2.AxisFault {
//To populate AxisService
populateAxisService();
populateFaults(); _serviceClient = new org.apache.axis2.client.ServiceClient(configurationContext,_service); _serviceClient.getOptions().setTo(new org.apache.axis2.addressing.EndpointReference(
targetEndpoint));
_serviceClient.getOptions().setUseSeparateListener(useSeparateListener); //Set the soap version
_serviceClient.getOptions().setSoapVersionURI(org.apache.axiom.soap.SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); } /**
* Default Constructor
*/
public RedisServiceStub(org.apache.axis2.context.ConfigurationContext configurationContext) throws org.apache.axis2.AxisFault { this(configurationContext,"http://localhost:8080/axis2/services/RedisService.RedisServiceHttpSoap12Endpoint/" ); } /**
* Default Constructor
*/
public RedisServiceStub() throws org.apache.axis2.AxisFault { this("http://localhost:8080/axis2/services/RedisService.RedisServiceHttpSoap12Endpoint/" ); } /**
* Constructor taking the target endpoint
*/
public RedisServiceStub(java.lang.String targetEndpoint) throws org.apache.axis2.AxisFault {
this(null,targetEndpoint);
} /**
* Auto generated method signature
*
* @see RedisService.RedisService#saveToRedisWithKey
* @param saveToRedisWithKey */ public RedisService.RedisServiceStub.SaveToRedisWithKeyResponse saveToRedisWithKey( RedisService.RedisServiceStub.SaveToRedisWithKey saveToRedisWithKey) throws java.rmi.RemoteException {
org.apache.axis2.context.MessageContext _messageContext = null;
try{
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0].getName());
_operationClient.getOptions().setAction("urn:saveToRedisWithKey");
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true); addPropertyToOperationClient(_operationClient,org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,"&"); // create a message context
_messageContext = new org.apache.axis2.context.MessageContext(); // create SOAP envelope with that payload
org.apache.axiom.soap.SOAPEnvelope env = null; env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),
saveToRedisWithKey,
optimizeContent(new javax.xml.namespace.QName("http://ws.apache.org/axis2",
"saveToRedisWithKey")), new javax.xml.namespace.QName("http://ws.apache.org/axis2",
"saveToRedisWithKey")); //adding SOAP soap_headers
_serviceClient.addHeadersToEnvelope(env);
// set the message context with that soap envelope
_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() ,
RedisService.RedisServiceStub.SaveToRedisWithKeyResponse.class,
getEnvelopeNamespaces(_returnEnv)); return (RedisService.RedisServiceStub.SaveToRedisWithKeyResponse)object; }catch(org.apache.axis2.AxisFault f){ org.apache.axiom.om.OMElement faultElt = f.getDetail();
if (faultElt!=null){
if (faultExceptionNameMap.containsKey(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"saveToRedisWithKey"))){
//make the fault by reflection
try{
java.lang.String exceptionClassName = (java.lang.String)faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"saveToRedisWithKey"));
java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);
java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(String.class);
java.lang.Exception ex = (java.lang.Exception) constructor.newInstance(f.getMessage());
//message class
java.lang.String messageClassName = (java.lang.String)faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"saveToRedisWithKey"));
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) {
// we cannot intantiate the class - throw the original Axis fault
throw f;
} catch (java.lang.InstantiationException e) {
// we cannot intantiate the class - throw the original Axis fault
throw f;
}
}else{
throw f;
}
}else{
throw f;
}
} finally {
if (_messageContext.getTransportOut() != null) {
_messageContext.getTransportOut().getSender().cleanup(_messageContext);
}
}
} /**
* Auto generated method signature
*
* @see RedisService.RedisService#saveToRedis
* @param saveToRedis */ public RedisService.RedisServiceStub.SaveToRedisResponse saveToRedis( RedisService.RedisServiceStub.SaveToRedis saveToRedis) throws java.rmi.RemoteException {
org.apache.axis2.context.MessageContext _messageContext = null;
try{
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[1].getName());
_operationClient.getOptions().setAction("urn:saveToRedis");
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true); addPropertyToOperationClient(_operationClient,org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,"&"); // create a message context
_messageContext = new org.apache.axis2.context.MessageContext(); // create SOAP envelope with that payload
org.apache.axiom.soap.SOAPEnvelope env = null; env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),
saveToRedis,
optimizeContent(new javax.xml.namespace.QName("http://ws.apache.org/axis2",
"saveToRedis")), new javax.xml.namespace.QName("http://ws.apache.org/axis2",
"saveToRedis")); //adding SOAP soap_headers
_serviceClient.addHeadersToEnvelope(env);
// set the message context with that soap envelope
_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() ,
RedisService.RedisServiceStub.SaveToRedisResponse.class,
getEnvelopeNamespaces(_returnEnv)); return (RedisService.RedisServiceStub.SaveToRedisResponse)object; }catch(org.apache.axis2.AxisFault f){ org.apache.axiom.om.OMElement faultElt = f.getDetail();
if (faultElt!=null){
if (faultExceptionNameMap.containsKey(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"saveToRedis"))){
//make the fault by reflection
try{
java.lang.String exceptionClassName = (java.lang.String)faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"saveToRedis"));
java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);
java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(String.class);
java.lang.Exception ex = (java.lang.Exception) constructor.newInstance(f.getMessage());
//message class
java.lang.String messageClassName = (java.lang.String)faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"saveToRedis"));
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) {
// we cannot intantiate the class - throw the original Axis fault
throw f;
} catch (java.lang.InstantiationException e) {
// we cannot intantiate the class - throw the original Axis fault
throw f;
}
}else{
throw f;
}
}else{
throw f;
}
} finally {
if (_messageContext.getTransportOut() != null) {
_messageContext.getTransportOut().getSender().cleanup(_messageContext);
}
}
} /**
* Auto generated method signature
*
* @see RedisService.RedisService#getFromRedis
* @param getFromRedis */ public RedisService.RedisServiceStub.GetFromRedisResponse getFromRedis( RedisService.RedisServiceStub.GetFromRedis getFromRedis) throws java.rmi.RemoteException {
org.apache.axis2.context.MessageContext _messageContext = null;
try{
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[2].getName());
_operationClient.getOptions().setAction("urn:getFromRedis");
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true); addPropertyToOperationClient(_operationClient,org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,"&"); // create a message context
_messageContext = new org.apache.axis2.context.MessageContext(); // create SOAP envelope with that payload
org.apache.axiom.soap.SOAPEnvelope env = null; env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),
getFromRedis,
optimizeContent(new javax.xml.namespace.QName("http://ws.apache.org/axis2",
"getFromRedis")), new javax.xml.namespace.QName("http://ws.apache.org/axis2",
"getFromRedis")); //adding SOAP soap_headers
_serviceClient.addHeadersToEnvelope(env);
// set the message context with that soap envelope
_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() ,
RedisService.RedisServiceStub.GetFromRedisResponse.class,
getEnvelopeNamespaces(_returnEnv)); return (RedisService.RedisServiceStub.GetFromRedisResponse)object; }catch(org.apache.axis2.AxisFault f){ org.apache.axiom.om.OMElement faultElt = f.getDetail();
if (faultElt!=null){
if (faultExceptionNameMap.containsKey(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"getFromRedis"))){
//make the fault by reflection
try{
java.lang.String exceptionClassName = (java.lang.String)faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"getFromRedis"));
java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);
java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(String.class);
java.lang.Exception ex = (java.lang.Exception) constructor.newInstance(f.getMessage());
//message class
java.lang.String messageClassName = (java.lang.String)faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"getFromRedis"));
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) {
// we cannot intantiate the class - throw the original Axis fault
throw f;
} catch (java.lang.InstantiationException e) {
// we cannot intantiate the class - throw the original Axis fault
throw f;
}
}else{
throw f;
}
}else{
throw f;
}
} finally {
if (_messageContext.getTransportOut() != null) {
_messageContext.getTransportOut().getSender().cleanup(_messageContext);
}
}
} /**
* A utility method that copies the namepaces from the SOAPEnvelope
*/
private java.util.Map getEnvelopeNamespaces(org.apache.axiom.soap.SOAPEnvelope env){
java.util.Map returnMap = new java.util.HashMap();
java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces();
while (namespaceIterator.hasNext()) {
org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next();
returnMap.put(ns.getPrefix(),ns.getNamespaceURI());
}
return returnMap;
} private javax.xml.namespace.QName[] opNameArray = null;
private boolean optimizeContent(javax.xml.namespace.QName opName) { if (opNameArray == null) {
return false;
}
for (int i = 0; i < opNameArray.length; i++) {
if (opName.equals(opNameArray[i])) {
return true;
}
}
return false;
}
//http://localhost:8080/axis2/services/RedisService.RedisServiceHttpSoap12Endpoint/
public static class SaveToRedisWithKeyResponse
implements org.apache.axis2.databinding.ADBBean{ public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName(
"http://ws.apache.org/axis2",
"saveToRedisWithKeyResponse",
"ns1"); /**
* field for _return
*/ protected java.lang.String local_return ; /* This tracker boolean wil be used to detect whether the user called the set method
* for this attribute. It will be used to determine whether to include this field
* in the serialized XML
*/
protected boolean local_returnTracker = false ; public boolean is_returnSpecified(){
return local_returnTracker;
} /**
* Auto generated getter method
* @return java.lang.String
*/
public java.lang.String get_return(){
return local_return;
} /**
* Auto generated setter method
* @param param _return
*/
public void set_return(java.lang.String param){
local_returnTracker = true; this.local_return=param; } /**
*
* @param parentQName
* @param factory
* @return org.apache.axiom.om.OMElement
*/
public org.apache.axiom.om.OMElement getOMElement (
final javax.xml.namespace.QName parentQName,
final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource =
new org.apache.axis2.databinding.ADBDataSource(this,MY_QNAME);
return factory.createOMElement(dataSource,MY_QNAME); } public void serialize(final javax.xml.namespace.QName parentQName,
javax.xml.stream.XMLStreamWriter xmlWriter)
throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{
serialize(parentQName,xmlWriter,false);
} public void serialize(final javax.xml.namespace.QName parentQName,
javax.xml.stream.XMLStreamWriter xmlWriter,
boolean serializeType)
throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null;
java.lang.String namespace = null; prefix = parentQName.getPrefix();
namespace = parentQName.getNamespaceURI();
writeStartElement(prefix, namespace, parentQName.getLocalPart(), xmlWriter); if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://ws.apache.org/axis2");
if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type",
namespacePrefix+":saveToRedisWithKeyResponse",
xmlWriter);
} else {
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type",
"saveToRedisWithKeyResponse",
xmlWriter);
} }
if (local_returnTracker){
namespace = "http://ws.apache.org/axis2";
writeStartElement(null, namespace, "return", xmlWriter); if (local_return==null){
// write the nil attribute writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter); }else{ xmlWriter.writeCharacters(local_return); } xmlWriter.writeEndElement();
}
xmlWriter.writeEndElement(); } private static java.lang.String generatePrefix(java.lang.String namespace) {
if(namespace.equals("http://ws.apache.org/axis2")){
return "ns1";
}
return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
} /**
* Utility method to write an element start tag.
*/
private void writeStartElement(java.lang.String prefix, java.lang.String namespace, java.lang.String localPart,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
if (writerPrefix != null) {
xmlWriter.writeStartElement(namespace, localPart);
} else {
if (namespace.length() == 0) {
prefix = "";
} else if (prefix == null) {
prefix = generatePrefix(namespace);
} xmlWriter.writeStartElement(prefix, localPart, namespace);
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
} /**
* Util method to write an attribute with the ns prefix
*/
private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName,
java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
if (xmlWriter.getPrefix(namespace) == null) {
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
xmlWriter.writeAttribute(namespace,attName,attValue);
} /**
* Util method to write an attribute without the ns prefix
*/
private void writeAttribute(java.lang.String namespace,java.lang.String attName,
java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName,attValue);
} else {
registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace,attName,attValue);
}
} /**
* Util method to write an attribute without the ns prefix
*/
private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName,
javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI();
java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
if (attributePrefix == null) {
attributePrefix = registerPrefix(xmlWriter, attributeNamespace);
}
java.lang.String attributeValue;
if (attributePrefix.trim().length() > 0) {
attributeValue = attributePrefix + ":" + qname.getLocalPart();
} else {
attributeValue = qname.getLocalPart();
} if (namespace.equals("")) {
xmlWriter.writeAttribute(attName, attributeValue);
} else {
registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace, attName, attributeValue);
}
}
/**
* method to handle Qnames
*/ private void writeQName(javax.xml.namespace.QName qname,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String namespaceURI = qname.getNamespaceURI();
if (namespaceURI != null) {
java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
if (prefix == null) {
prefix = generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix,namespaceURI);
} if (prefix.trim().length() > 0){
xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
} else {
// i.e this is the default namespace
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
} } else {
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
} private void writeQNames(javax.xml.namespace.QName[] qnames,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) {
// we have to store this data until last moment since it is not possible to write any
// namespace data after writing the charactor data
java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer();
java.lang.String namespaceURI = null;
java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) {
if (i > 0) {
stringToWrite.append(" ");
}
namespaceURI = qnames[i].getNamespaceURI();
if (namespaceURI != null) {
prefix = xmlWriter.getPrefix(namespaceURI);
if ((prefix == null) || (prefix.length() == 0)) {
prefix = generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix,namespaceURI);
} if (prefix.trim().length() > 0){
stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
}
xmlWriter.writeCharacters(stringToWrite.toString());
} } /**
* Register a namespace prefix
*/
private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException {
java.lang.String prefix = xmlWriter.getPrefix(namespace);
if (prefix == null) {
prefix = generatePrefix(namespace);
javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext();
while (true) {
java.lang.String uri = nsContext.getNamespaceURI(prefix);
if (uri == null || uri.length() == 0) {
break;
}
prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
return prefix;
} /**
* databinding method to get an XML representation of this object
*
*/
public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)
throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList();
java.util.ArrayList attribList = new java.util.ArrayList(); if (local_returnTracker){
elementList.add(new javax.xml.namespace.QName("http://ws.apache.org/axis2",
"return")); elementList.add(local_return==null?null:
org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_return));
} return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /**
* Factory class that keeps the parse method
*/
public static class Factory{ /**
* static method to create the object
* Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable
* If this object is not an element, it is a complex type and the reader is at the event just after the outer start element
* Postcondition: If this object is an element, the reader is positioned at its end element
* If this object is a complex type, the reader is positioned at the end element of its outer element
*/
public static SaveToRedisWithKeyResponse parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{
SaveToRedisWithKeyResponse object =
new SaveToRedisWithKeyResponse(); int event;
java.lang.String nillableValue = null;
java.lang.String prefix ="";
java.lang.String namespaceuri ="";
try { while (!reader.isStartElement() && !reader.isEndElement())
reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){
java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
"type");
if (fullTypeName!=null){
java.lang.String nsPrefix = null;
if (fullTypeName.indexOf(":") > -1){
nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":"));
}
nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"saveToRedisWithKeyResponse".equals(type)){
//find namespace for the prefix
java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
return (SaveToRedisWithKeyResponse)ExtensionMapper.getTypeObject(
nsUri,type,reader);
} } } // Note all attributes that were handled. Used to differ normal attributes
// from anyAttributes.
java.util.Vector handledAttributes = new java.util.Vector(); reader.next(); while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.isStartElement() && new javax.xml.namespace.QName("http://ws.apache.org/axis2","return").equals(reader.getName())){ nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil");
if (!"true".equals(nillableValue) && !"1".equals(nillableValue)){ java.lang.String content = reader.getElementText(); object.set_return(
org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content)); } else { reader.getElementText(); // throw away text nodes if any.
} reader.next(); } // End of if for expected property start element else { } while (!reader.isStartElement() && !reader.isEndElement())
reader.next(); if (reader.isStartElement())
// A start element we are not expecting indicates a trailing invalid property
throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getName()); } catch (javax.xml.stream.XMLStreamException e) {
throw new java.lang.Exception(e);
} return object;
} }//end of factory class } public static class SaveToRedisResponse
implements org.apache.axis2.databinding.ADBBean{ public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName(
"http://ws.apache.org/axis2",
"saveToRedisResponse",
"ns1"); /**
* field for _return
*/ protected java.lang.String local_return ; /* This tracker boolean wil be used to detect whether the user called the set method
* for this attribute. It will be used to determine whether to include this field
* in the serialized XML
*/
protected boolean local_returnTracker = false ; public boolean is_returnSpecified(){
return local_returnTracker;
} /**
* Auto generated getter method
* @return java.lang.String
*/
public java.lang.String get_return(){
return local_return;
} /**
* Auto generated setter method
* @param param _return
*/
public void set_return(java.lang.String param){
local_returnTracker = true; this.local_return=param; } /**
*
* @param parentQName
* @param factory
* @return org.apache.axiom.om.OMElement
*/
public org.apache.axiom.om.OMElement getOMElement (
final javax.xml.namespace.QName parentQName,
final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource =
new org.apache.axis2.databinding.ADBDataSource(this,MY_QNAME);
return factory.createOMElement(dataSource,MY_QNAME); } public void serialize(final javax.xml.namespace.QName parentQName,
javax.xml.stream.XMLStreamWriter xmlWriter)
throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{
serialize(parentQName,xmlWriter,false);
} public void serialize(final javax.xml.namespace.QName parentQName,
javax.xml.stream.XMLStreamWriter xmlWriter,
boolean serializeType)
throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null;
java.lang.String namespace = null; prefix = parentQName.getPrefix();
namespace = parentQName.getNamespaceURI();
writeStartElement(prefix, namespace, parentQName.getLocalPart(), xmlWriter); if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://ws.apache.org/axis2");
if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type",
namespacePrefix+":saveToRedisResponse",
xmlWriter);
} else {
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type",
"saveToRedisResponse",
xmlWriter);
} }
if (local_returnTracker){
namespace = "http://ws.apache.org/axis2";
writeStartElement(null, namespace, "return", xmlWriter); if (local_return==null){
// write the nil attribute writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter); }else{ xmlWriter.writeCharacters(local_return); } xmlWriter.writeEndElement();
}
xmlWriter.writeEndElement(); } private static java.lang.String generatePrefix(java.lang.String namespace) {
if(namespace.equals("http://ws.apache.org/axis2")){
return "ns1";
}
return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
} /**
* Utility method to write an element start tag.
*/
private void writeStartElement(java.lang.String prefix, java.lang.String namespace, java.lang.String localPart,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
if (writerPrefix != null) {
xmlWriter.writeStartElement(namespace, localPart);
} else {
if (namespace.length() == 0) {
prefix = "";
} else if (prefix == null) {
prefix = generatePrefix(namespace);
} xmlWriter.writeStartElement(prefix, localPart, namespace);
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
} /**
* Util method to write an attribute with the ns prefix
*/
private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName,
java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
if (xmlWriter.getPrefix(namespace) == null) {
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
xmlWriter.writeAttribute(namespace,attName,attValue);
} /**
* Util method to write an attribute without the ns prefix
*/
private void writeAttribute(java.lang.String namespace,java.lang.String attName,
java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName,attValue);
} else {
registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace,attName,attValue);
}
} /**
* Util method to write an attribute without the ns prefix
*/
private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName,
javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI();
java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
if (attributePrefix == null) {
attributePrefix = registerPrefix(xmlWriter, attributeNamespace);
}
java.lang.String attributeValue;
if (attributePrefix.trim().length() > 0) {
attributeValue = attributePrefix + ":" + qname.getLocalPart();
} else {
attributeValue = qname.getLocalPart();
} if (namespace.equals("")) {
xmlWriter.writeAttribute(attName, attributeValue);
} else {
registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace, attName, attributeValue);
}
}
/**
* method to handle Qnames
*/ private void writeQName(javax.xml.namespace.QName qname,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String namespaceURI = qname.getNamespaceURI();
if (namespaceURI != null) {
java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
if (prefix == null) {
prefix = generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix,namespaceURI);
} if (prefix.trim().length() > 0){
xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
} else {
// i.e this is the default namespace
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
} } else {
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
} private void writeQNames(javax.xml.namespace.QName[] qnames,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) {
// we have to store this data until last moment since it is not possible to write any
// namespace data after writing the charactor data
java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer();
java.lang.String namespaceURI = null;
java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) {
if (i > 0) {
stringToWrite.append(" ");
}
namespaceURI = qnames[i].getNamespaceURI();
if (namespaceURI != null) {
prefix = xmlWriter.getPrefix(namespaceURI);
if ((prefix == null) || (prefix.length() == 0)) {
prefix = generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix,namespaceURI);
} if (prefix.trim().length() > 0){
stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
}
xmlWriter.writeCharacters(stringToWrite.toString());
} } /**
* Register a namespace prefix
*/
private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException {
java.lang.String prefix = xmlWriter.getPrefix(namespace);
if (prefix == null) {
prefix = generatePrefix(namespace);
javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext();
while (true) {
java.lang.String uri = nsContext.getNamespaceURI(prefix);
if (uri == null || uri.length() == 0) {
break;
}
prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
return prefix;
} /**
* databinding method to get an XML representation of this object
*
*/
public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)
throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList();
java.util.ArrayList attribList = new java.util.ArrayList(); if (local_returnTracker){
elementList.add(new javax.xml.namespace.QName("http://ws.apache.org/axis2",
"return")); elementList.add(local_return==null?null:
org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_return));
} return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /**
* Factory class that keeps the parse method
*/
public static class Factory{ /**
* static method to create the object
* Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable
* If this object is not an element, it is a complex type and the reader is at the event just after the outer start element
* Postcondition: If this object is an element, the reader is positioned at its end element
* If this object is a complex type, the reader is positioned at the end element of its outer element
*/
public static SaveToRedisResponse parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{
SaveToRedisResponse object =
new SaveToRedisResponse(); int event;
java.lang.String nillableValue = null;
java.lang.String prefix ="";
java.lang.String namespaceuri ="";
try { while (!reader.isStartElement() && !reader.isEndElement())
reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){
java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
"type");
if (fullTypeName!=null){
java.lang.String nsPrefix = null;
if (fullTypeName.indexOf(":") > -1){
nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":"));
}
nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"saveToRedisResponse".equals(type)){
//find namespace for the prefix
java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
return (SaveToRedisResponse)ExtensionMapper.getTypeObject(
nsUri,type,reader);
} } } // Note all attributes that were handled. Used to differ normal attributes
// from anyAttributes.
java.util.Vector handledAttributes = new java.util.Vector(); reader.next(); while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.isStartElement() && new javax.xml.namespace.QName("http://ws.apache.org/axis2","return").equals(reader.getName())){ nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil");
if (!"true".equals(nillableValue) && !"1".equals(nillableValue)){ java.lang.String content = reader.getElementText(); object.set_return(
org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content)); } else { reader.getElementText(); // throw away text nodes if any.
} reader.next(); } // End of if for expected property start element else { } while (!reader.isStartElement() && !reader.isEndElement())
reader.next(); if (reader.isStartElement())
// A start element we are not expecting indicates a trailing invalid property
throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getName()); } catch (javax.xml.stream.XMLStreamException e) {
throw new java.lang.Exception(e);
} return object;
} }//end of factory class } public static class GetFromRedisResponse
implements org.apache.axis2.databinding.ADBBean{ public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName(
"http://ws.apache.org/axis2",
"getFromRedisResponse",
"ns1"); /**
* field for _return
* This was an Array!
*/ protected ArrayOfString[] local_return ; /* This tracker boolean wil be used to detect whether the user called the set method
* for this attribute. It will be used to determine whether to include this field
* in the serialized XML
*/
protected boolean local_returnTracker = false ; public boolean is_returnSpecified(){
return local_returnTracker;
} /**
* Auto generated getter method
* @return ArrayOfString[]
*/
public ArrayOfString[] get_return(){
return local_return;
} /**
* validate the array for _return
*/
protected void validate_return(ArrayOfString[] param){ } /**
* Auto generated setter method
* @param param _return
*/
public void set_return(ArrayOfString[] param){ validate_return(param); local_returnTracker = true; this.local_return=param;
} /**
* Auto generated add method for the array for convenience
* @param param ArrayOfString
*/
public void add_return(ArrayOfString param){
if (local_return == null){
local_return = new ArrayOfString[]{};
} //update the setting tracker
local_returnTracker = true; java.util.List list =
org.apache.axis2.databinding.utils.ConverterUtil.toList(local_return);
list.add(param);
this.local_return =
(ArrayOfString[])list.toArray(
new ArrayOfString[list.size()]); } /**
*
* @param parentQName
* @param factory
* @return org.apache.axiom.om.OMElement
*/
public org.apache.axiom.om.OMElement getOMElement (
final javax.xml.namespace.QName parentQName,
final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource =
new org.apache.axis2.databinding.ADBDataSource(this,MY_QNAME);
return factory.createOMElement(dataSource,MY_QNAME); } public void serialize(final javax.xml.namespace.QName parentQName,
javax.xml.stream.XMLStreamWriter xmlWriter)
throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{
serialize(parentQName,xmlWriter,false);
} public void serialize(final javax.xml.namespace.QName parentQName,
javax.xml.stream.XMLStreamWriter xmlWriter,
boolean serializeType)
throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null;
java.lang.String namespace = null; prefix = parentQName.getPrefix();
namespace = parentQName.getNamespaceURI();
writeStartElement(prefix, namespace, parentQName.getLocalPart(), xmlWriter); if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://ws.apache.org/axis2");
if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type",
namespacePrefix+":getFromRedisResponse",
xmlWriter);
} else {
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type",
"getFromRedisResponse",
xmlWriter);
} }
if (local_returnTracker){
if (local_return!=null){
for (int i = 0;i < local_return.length;i++){
if (local_return[i] != null){
local_return[i].serialize(new javax.xml.namespace.QName("http://ws.apache.org/axis2","return"),
xmlWriter);
} else { writeStartElement(null, "http://ws.apache.org/axis2", "return", xmlWriter); // write the nil attribute
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter);
xmlWriter.writeEndElement(); } }
} else { writeStartElement(null, "http://ws.apache.org/axis2", "return", xmlWriter); // write the nil attribute
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter);
xmlWriter.writeEndElement(); }
}
xmlWriter.writeEndElement(); } private static java.lang.String generatePrefix(java.lang.String namespace) {
if(namespace.equals("http://ws.apache.org/axis2")){
return "ns1";
}
return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
} /**
* Utility method to write an element start tag.
*/
private void writeStartElement(java.lang.String prefix, java.lang.String namespace, java.lang.String localPart,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
if (writerPrefix != null) {
xmlWriter.writeStartElement(namespace, localPart);
} else {
if (namespace.length() == 0) {
prefix = "";
} else if (prefix == null) {
prefix = generatePrefix(namespace);
} xmlWriter.writeStartElement(prefix, localPart, namespace);
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
} /**
* Util method to write an attribute with the ns prefix
*/
private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName,
java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
if (xmlWriter.getPrefix(namespace) == null) {
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
xmlWriter.writeAttribute(namespace,attName,attValue);
} /**
* Util method to write an attribute without the ns prefix
*/
private void writeAttribute(java.lang.String namespace,java.lang.String attName,
java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName,attValue);
} else {
registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace,attName,attValue);
}
} /**
* Util method to write an attribute without the ns prefix
*/
private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName,
javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI();
java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
if (attributePrefix == null) {
attributePrefix = registerPrefix(xmlWriter, attributeNamespace);
}
java.lang.String attributeValue;
if (attributePrefix.trim().length() > 0) {
attributeValue = attributePrefix + ":" + qname.getLocalPart();
} else {
attributeValue = qname.getLocalPart();
} if (namespace.equals("")) {
xmlWriter.writeAttribute(attName, attributeValue);
} else {
registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace, attName, attributeValue);
}
}
/**
* method to handle Qnames
*/ private void writeQName(javax.xml.namespace.QName qname,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String namespaceURI = qname.getNamespaceURI();
if (namespaceURI != null) {
java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
if (prefix == null) {
prefix = generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix,namespaceURI);
} if (prefix.trim().length() > 0){
xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
} else {
// i.e this is the default namespace
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
} } else {
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
} private void writeQNames(javax.xml.namespace.QName[] qnames,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) {
// we have to store this data until last moment since it is not possible to write any
// namespace data after writing the charactor data
java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer();
java.lang.String namespaceURI = null;
java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) {
if (i > 0) {
stringToWrite.append(" ");
}
namespaceURI = qnames[i].getNamespaceURI();
if (namespaceURI != null) {
prefix = xmlWriter.getPrefix(namespaceURI);
if ((prefix == null) || (prefix.length() == 0)) {
prefix = generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix,namespaceURI);
} if (prefix.trim().length() > 0){
stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
}
xmlWriter.writeCharacters(stringToWrite.toString());
} } /**
* Register a namespace prefix
*/
private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException {
java.lang.String prefix = xmlWriter.getPrefix(namespace);
if (prefix == null) {
prefix = generatePrefix(namespace);
javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext();
while (true) {
java.lang.String uri = nsContext.getNamespaceURI(prefix);
if (uri == null || uri.length() == 0) {
break;
}
prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
return prefix;
} /**
* databinding method to get an XML representation of this object
*
*/
public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)
throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList();
java.util.ArrayList attribList = new java.util.ArrayList(); if (local_returnTracker){
if (local_return!=null) {
for (int i = 0;i < local_return.length;i++){ if (local_return[i] != null){
elementList.add(new javax.xml.namespace.QName("http://ws.apache.org/axis2",
"return"));
elementList.add(local_return[i]);
} else { elementList.add(new javax.xml.namespace.QName("http://ws.apache.org/axis2",
"return"));
elementList.add(null); } }
} else { elementList.add(new javax.xml.namespace.QName("http://ws.apache.org/axis2",
"return"));
elementList.add(local_return); } } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /**
* Factory class that keeps the parse method
*/
public static class Factory{ /**
* static method to create the object
* Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable
* If this object is not an element, it is a complex type and the reader is at the event just after the outer start element
* Postcondition: If this object is an element, the reader is positioned at its end element
* If this object is a complex type, the reader is positioned at the end element of its outer element
*/
public static GetFromRedisResponse parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{
GetFromRedisResponse object =
new GetFromRedisResponse(); int event;
java.lang.String nillableValue = null;
java.lang.String prefix ="";
java.lang.String namespaceuri ="";
try { while (!reader.isStartElement() && !reader.isEndElement())
reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){
java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
"type");
if (fullTypeName!=null){
java.lang.String nsPrefix = null;
if (fullTypeName.indexOf(":") > -1){
nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":"));
}
nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"getFromRedisResponse".equals(type)){
//find namespace for the prefix
java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
return (GetFromRedisResponse)ExtensionMapper.getTypeObject(
nsUri,type,reader);
} } } // Note all attributes that were handled. Used to differ normal attributes
// from anyAttributes.
java.util.Vector handledAttributes = new java.util.Vector(); reader.next(); java.util.ArrayList list1 = new java.util.ArrayList(); while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.isStartElement() && new javax.xml.namespace.QName("http://ws.apache.org/axis2","return").equals(reader.getName())){ // Process the array and step past its final element's end. nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil");
if ("true".equals(nillableValue) || "1".equals(nillableValue)){
list1.add(null);
reader.next();
} else {
list1.add(ArrayOfString.Factory.parse(reader));
}
//loop until we find a start element that is not part of this array
boolean loopDone1 = false;
while(!loopDone1){
// We should be at the end element, but make sure
while (!reader.isEndElement())
reader.next();
// Step out of this element
reader.next();
// Step to next element event.
while (!reader.isStartElement() && !reader.isEndElement())
reader.next();
if (reader.isEndElement()){
//two continuous end elements means we are exiting the xml structure
loopDone1 = true;
} else {
if (new javax.xml.namespace.QName("http://ws.apache.org/axis2","return").equals(reader.getName())){ nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil");
if ("true".equals(nillableValue) || "1".equals(nillableValue)){
list1.add(null);
reader.next();
} else {
list1.add(ArrayOfString.Factory.parse(reader));
}
}else{
loopDone1 = true;
}
}
}
// call the converter utility to convert and set the array object.set_return((ArrayOfString[])
org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(
ArrayOfString.class,
list1)); } // End of if for expected property start element else { } while (!reader.isStartElement() && !reader.isEndElement())
reader.next(); if (reader.isStartElement())
// A start element we are not expecting indicates a trailing invalid property
throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getName()); } catch (javax.xml.stream.XMLStreamException e) {
throw new java.lang.Exception(e);
} return object;
} }//end of factory class } public static class SaveToRedis
implements org.apache.axis2.databinding.ADBBean{ public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName(
"http://ws.apache.org/axis2",
"saveToRedis",
"ns1"); /**
* field for ObjectMap
* This was an Array!
*/ protected ArrayOfString[] localObjectMap ; /* This tracker boolean wil be used to detect whether the user called the set method
* for this attribute. It will be used to determine whether to include this field
* in the serialized XML
*/
protected boolean localObjectMapTracker = false ; public boolean isObjectMapSpecified(){
return localObjectMapTracker;
} /**
* Auto generated getter method
* @return ArrayOfString[]
*/
public ArrayOfString[] getObjectMap(){
return localObjectMap;
} /**
* validate the array for ObjectMap
*/
protected void validateObjectMap(ArrayOfString[] param){ } /**
* Auto generated setter method
* @param param ObjectMap
*/
public void setObjectMap(ArrayOfString[] param){ validateObjectMap(param); localObjectMapTracker = true; this.localObjectMap=param;
} /**
* Auto generated add method for the array for convenience
* @param param ArrayOfString
*/
public void addObjectMap(ArrayOfString param){
if (localObjectMap == null){
localObjectMap = new ArrayOfString[]{};
} //update the setting tracker
localObjectMapTracker = true; java.util.List list =
org.apache.axis2.databinding.utils.ConverterUtil.toList(localObjectMap);
list.add(param);
this.localObjectMap =
(ArrayOfString[])list.toArray(
new ArrayOfString[list.size()]); } /**
*
* @param parentQName
* @param factory
* @return org.apache.axiom.om.OMElement
*/
public org.apache.axiom.om.OMElement getOMElement (
final javax.xml.namespace.QName parentQName,
final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource =
new org.apache.axis2.databinding.ADBDataSource(this,MY_QNAME);
return factory.createOMElement(dataSource,MY_QNAME); } public void serialize(final javax.xml.namespace.QName parentQName,
javax.xml.stream.XMLStreamWriter xmlWriter)
throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{
serialize(parentQName,xmlWriter,false);
} public void serialize(final javax.xml.namespace.QName parentQName,
javax.xml.stream.XMLStreamWriter xmlWriter,
boolean serializeType)
throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null;
java.lang.String namespace = null; prefix = parentQName.getPrefix();
namespace = parentQName.getNamespaceURI();
writeStartElement(prefix, namespace, parentQName.getLocalPart(), xmlWriter); if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://ws.apache.org/axis2");
if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type",
namespacePrefix+":saveToRedis",
xmlWriter);
} else {
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type",
"saveToRedis",
xmlWriter);
} }
if (localObjectMapTracker){
if (localObjectMap!=null){
for (int i = 0;i < localObjectMap.length;i++){
if (localObjectMap[i] != null){
localObjectMap[i].serialize(new javax.xml.namespace.QName("http://ws.apache.org/axis2","ObjectMap"),
xmlWriter);
} else { writeStartElement(null, "http://ws.apache.org/axis2", "ObjectMap", xmlWriter); // write the nil attribute
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter);
xmlWriter.writeEndElement(); } }
} else { writeStartElement(null, "http://ws.apache.org/axis2", "ObjectMap", xmlWriter); // write the nil attribute
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter);
xmlWriter.writeEndElement(); }
}
xmlWriter.writeEndElement(); } private static java.lang.String generatePrefix(java.lang.String namespace) {
if(namespace.equals("http://ws.apache.org/axis2")){
return "ns1";
}
return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
} /**
* Utility method to write an element start tag.
*/
private void writeStartElement(java.lang.String prefix, java.lang.String namespace, java.lang.String localPart,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
if (writerPrefix != null) {
xmlWriter.writeStartElement(namespace, localPart);
} else {
if (namespace.length() == 0) {
prefix = "";
} else if (prefix == null) {
prefix = generatePrefix(namespace);
} xmlWriter.writeStartElement(prefix, localPart, namespace);
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
} /**
* Util method to write an attribute with the ns prefix
*/
private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName,
java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
if (xmlWriter.getPrefix(namespace) == null) {
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
xmlWriter.writeAttribute(namespace,attName,attValue);
} /**
* Util method to write an attribute without the ns prefix
*/
private void writeAttribute(java.lang.String namespace,java.lang.String attName,
java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName,attValue);
} else {
registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace,attName,attValue);
}
} /**
* Util method to write an attribute without the ns prefix
*/
private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName,
javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI();
java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
if (attributePrefix == null) {
attributePrefix = registerPrefix(xmlWriter, attributeNamespace);
}
java.lang.String attributeValue;
if (attributePrefix.trim().length() > 0) {
attributeValue = attributePrefix + ":" + qname.getLocalPart();
} else {
attributeValue = qname.getLocalPart();
} if (namespace.equals("")) {
xmlWriter.writeAttribute(attName, attributeValue);
} else {
registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace, attName, attributeValue);
}
}
/**
* method to handle Qnames
*/ private void writeQName(javax.xml.namespace.QName qname,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String namespaceURI = qname.getNamespaceURI();
if (namespaceURI != null) {
java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
if (prefix == null) {
prefix = generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix,namespaceURI);
} if (prefix.trim().length() > 0){
xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
} else {
// i.e this is the default namespace
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
} } else {
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
} private void writeQNames(javax.xml.namespace.QName[] qnames,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) {
// we have to store this data until last moment since it is not possible to write any
// namespace data after writing the charactor data
java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer();
java.lang.String namespaceURI = null;
java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) {
if (i > 0) {
stringToWrite.append(" ");
}
namespaceURI = qnames[i].getNamespaceURI();
if (namespaceURI != null) {
prefix = xmlWriter.getPrefix(namespaceURI);
if ((prefix == null) || (prefix.length() == 0)) {
prefix = generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix,namespaceURI);
} if (prefix.trim().length() > 0){
stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
}
xmlWriter.writeCharacters(stringToWrite.toString());
} } /**
* Register a namespace prefix
*/
private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException {
java.lang.String prefix = xmlWriter.getPrefix(namespace);
if (prefix == null) {
prefix = generatePrefix(namespace);
javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext();
while (true) {
java.lang.String uri = nsContext.getNamespaceURI(prefix);
if (uri == null || uri.length() == 0) {
break;
}
prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
return prefix;
} /**
* databinding method to get an XML representation of this object
*
*/
public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)
throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList();
java.util.ArrayList attribList = new java.util.ArrayList(); if (localObjectMapTracker){
if (localObjectMap!=null) {
for (int i = 0;i < localObjectMap.length;i++){ if (localObjectMap[i] != null){
elementList.add(new javax.xml.namespace.QName("http://ws.apache.org/axis2",
"ObjectMap"));
elementList.add(localObjectMap[i]);
} else { elementList.add(new javax.xml.namespace.QName("http://ws.apache.org/axis2",
"ObjectMap"));
elementList.add(null); } }
} else { elementList.add(new javax.xml.namespace.QName("http://ws.apache.org/axis2",
"ObjectMap"));
elementList.add(localObjectMap); } } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /**
* Factory class that keeps the parse method
*/
public static class Factory{ /**
* static method to create the object
* Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable
* If this object is not an element, it is a complex type and the reader is at the event just after the outer start element
* Postcondition: If this object is an element, the reader is positioned at its end element
* If this object is a complex type, the reader is positioned at the end element of its outer element
*/
public static SaveToRedis parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{
SaveToRedis object =
new SaveToRedis(); int event;
java.lang.String nillableValue = null;
java.lang.String prefix ="";
java.lang.String namespaceuri ="";
try { while (!reader.isStartElement() && !reader.isEndElement())
reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){
java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
"type");
if (fullTypeName!=null){
java.lang.String nsPrefix = null;
if (fullTypeName.indexOf(":") > -1){
nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":"));
}
nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"saveToRedis".equals(type)){
//find namespace for the prefix
java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
return (SaveToRedis)ExtensionMapper.getTypeObject(
nsUri,type,reader);
} } } // Note all attributes that were handled. Used to differ normal attributes
// from anyAttributes.
java.util.Vector handledAttributes = new java.util.Vector(); reader.next(); java.util.ArrayList list1 = new java.util.ArrayList(); while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.isStartElement() && new javax.xml.namespace.QName("http://ws.apache.org/axis2","ObjectMap").equals(reader.getName())){ // Process the array and step past its final element's end. nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil");
if ("true".equals(nillableValue) || "1".equals(nillableValue)){
list1.add(null);
reader.next();
} else {
list1.add(ArrayOfString.Factory.parse(reader));
}
//loop until we find a start element that is not part of this array
boolean loopDone1 = false;
while(!loopDone1){
// We should be at the end element, but make sure
while (!reader.isEndElement())
reader.next();
// Step out of this element
reader.next();
// Step to next element event.
while (!reader.isStartElement() && !reader.isEndElement())
reader.next();
if (reader.isEndElement()){
//two continuous end elements means we are exiting the xml structure
loopDone1 = true;
} else {
if (new javax.xml.namespace.QName("http://ws.apache.org/axis2","ObjectMap").equals(reader.getName())){ nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil");
if ("true".equals(nillableValue) || "1".equals(nillableValue)){
list1.add(null);
reader.next();
} else {
list1.add(ArrayOfString.Factory.parse(reader));
}
}else{
loopDone1 = true;
}
}
}
// call the converter utility to convert and set the array object.setObjectMap((ArrayOfString[])
org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(
ArrayOfString.class,
list1)); } // End of if for expected property start element else { } while (!reader.isStartElement() && !reader.isEndElement())
reader.next(); if (reader.isStartElement())
// A start element we are not expecting indicates a trailing invalid property
throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getName()); } catch (javax.xml.stream.XMLStreamException e) {
throw new java.lang.Exception(e);
} return object;
} }//end of factory class } public static class ArrayOfString
implements org.apache.axis2.databinding.ADBBean{
/* This type was generated from the piece of schema that had
name = ArrayOfString
Namespace URI = http://ws.apache.org/axis2
Namespace Prefix = ns1
*/ /**
* field for Array
* This was an Array!
*/ protected java.lang.String[] localArray ; /* This tracker boolean wil be used to detect whether the user called the set method
* for this attribute. It will be used to determine whether to include this field
* in the serialized XML
*/
protected boolean localArrayTracker = false ; public boolean isArraySpecified(){
return localArrayTracker;
} /**
* Auto generated getter method
* @return java.lang.String[]
*/
public java.lang.String[] getArray(){
return localArray;
} /**
* validate the array for Array
*/
protected void validateArray(java.lang.String[] param){ } /**
* Auto generated setter method
* @param param Array
*/
public void setArray(java.lang.String[] param){ validateArray(param); localArrayTracker = true; this.localArray=param;
} /**
* Auto generated add method for the array for convenience
* @param param java.lang.String
*/
public void addArray(java.lang.String param){
if (localArray == null){
localArray = new java.lang.String[]{};
} //update the setting tracker
localArrayTracker = true; java.util.List list =
org.apache.axis2.databinding.utils.ConverterUtil.toList(localArray);
list.add(param);
this.localArray =
(java.lang.String[])list.toArray(
new java.lang.String[list.size()]); } /**
*
* @param parentQName
* @param factory
* @return org.apache.axiom.om.OMElement
*/
public org.apache.axiom.om.OMElement getOMElement (
final javax.xml.namespace.QName parentQName,
final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource =
new org.apache.axis2.databinding.ADBDataSource(this,parentQName);
return factory.createOMElement(dataSource,parentQName); } public void serialize(final javax.xml.namespace.QName parentQName,
javax.xml.stream.XMLStreamWriter xmlWriter)
throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{
serialize(parentQName,xmlWriter,false);
} public void serialize(final javax.xml.namespace.QName parentQName,
javax.xml.stream.XMLStreamWriter xmlWriter,
boolean serializeType)
throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null;
java.lang.String namespace = null; prefix = parentQName.getPrefix();
namespace = parentQName.getNamespaceURI();
writeStartElement(prefix, namespace, parentQName.getLocalPart(), xmlWriter); if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://ws.apache.org/axis2");
if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type",
namespacePrefix+":ArrayOfString",
xmlWriter);
} else {
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type",
"ArrayOfString",
xmlWriter);
} }
if (localArrayTracker){
if (localArray!=null) {
namespace = "http://ws.apache.org/axis2";
for (int i = 0;i < localArray.length;i++){ if (localArray[i] != null){ writeStartElement(null, namespace, "array", xmlWriter); xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localArray[i])); xmlWriter.writeEndElement(); } else { // write null attribute
namespace = "http://ws.apache.org/axis2";
writeStartElement(null, namespace, "array", xmlWriter);
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter);
xmlWriter.writeEndElement(); } }
} else { // write the null attribute
// write null attribute
writeStartElement(null, "http://ws.apache.org/axis2", "array", xmlWriter); // write the nil attribute
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter);
xmlWriter.writeEndElement(); } }
xmlWriter.writeEndElement(); } private static java.lang.String generatePrefix(java.lang.String namespace) {
if(namespace.equals("http://ws.apache.org/axis2")){
return "ns1";
}
return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
} /**
* Utility method to write an element start tag.
*/
private void writeStartElement(java.lang.String prefix, java.lang.String namespace, java.lang.String localPart,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
if (writerPrefix != null) {
xmlWriter.writeStartElement(namespace, localPart);
} else {
if (namespace.length() == 0) {
prefix = "";
} else if (prefix == null) {
prefix = generatePrefix(namespace);
} xmlWriter.writeStartElement(prefix, localPart, namespace);
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
} /**
* Util method to write an attribute with the ns prefix
*/
private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName,
java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
if (xmlWriter.getPrefix(namespace) == null) {
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
xmlWriter.writeAttribute(namespace,attName,attValue);
} /**
* Util method to write an attribute without the ns prefix
*/
private void writeAttribute(java.lang.String namespace,java.lang.String attName,
java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName,attValue);
} else {
registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace,attName,attValue);
}
} /**
* Util method to write an attribute without the ns prefix
*/
private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName,
javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI();
java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
if (attributePrefix == null) {
attributePrefix = registerPrefix(xmlWriter, attributeNamespace);
}
java.lang.String attributeValue;
if (attributePrefix.trim().length() > 0) {
attributeValue = attributePrefix + ":" + qname.getLocalPart();
} else {
attributeValue = qname.getLocalPart();
} if (namespace.equals("")) {
xmlWriter.writeAttribute(attName, attributeValue);
} else {
registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace, attName, attributeValue);
}
}
/**
* method to handle Qnames
*/ private void writeQName(javax.xml.namespace.QName qname,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String namespaceURI = qname.getNamespaceURI();
if (namespaceURI != null) {
java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
if (prefix == null) {
prefix = generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix,namespaceURI);
} if (prefix.trim().length() > 0){
xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
} else {
// i.e this is the default namespace
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
} } else {
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
} private void writeQNames(javax.xml.namespace.QName[] qnames,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) {
// we have to store this data until last moment since it is not possible to write any
// namespace data after writing the charactor data
java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer();
java.lang.String namespaceURI = null;
java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) {
if (i > 0) {
stringToWrite.append(" ");
}
namespaceURI = qnames[i].getNamespaceURI();
if (namespaceURI != null) {
prefix = xmlWriter.getPrefix(namespaceURI);
if ((prefix == null) || (prefix.length() == 0)) {
prefix = generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix,namespaceURI);
} if (prefix.trim().length() > 0){
stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
}
xmlWriter.writeCharacters(stringToWrite.toString());
} } /**
* Register a namespace prefix
*/
private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException {
java.lang.String prefix = xmlWriter.getPrefix(namespace);
if (prefix == null) {
prefix = generatePrefix(namespace);
javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext();
while (true) {
java.lang.String uri = nsContext.getNamespaceURI(prefix);
if (uri == null || uri.length() == 0) {
break;
}
prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
return prefix;
} /**
* databinding method to get an XML representation of this object
*
*/
public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)
throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList();
java.util.ArrayList attribList = new java.util.ArrayList(); if (localArrayTracker){
if (localArray!=null){
for (int i = 0;i < localArray.length;i++){ if (localArray[i] != null){
elementList.add(new javax.xml.namespace.QName("http://ws.apache.org/axis2",
"array"));
elementList.add(
org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localArray[i]));
} else { elementList.add(new javax.xml.namespace.QName("http://ws.apache.org/axis2",
"array"));
elementList.add(null); } }
} else { elementList.add(new javax.xml.namespace.QName("http://ws.apache.org/axis2",
"array"));
elementList.add(null); } } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /**
* Factory class that keeps the parse method
*/
public static class Factory{ /**
* static method to create the object
* Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable
* If this object is not an element, it is a complex type and the reader is at the event just after the outer start element
* Postcondition: If this object is an element, the reader is positioned at its end element
* If this object is a complex type, the reader is positioned at the end element of its outer element
*/
public static ArrayOfString parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{
ArrayOfString object =
new ArrayOfString(); int event;
java.lang.String nillableValue = null;
java.lang.String prefix ="";
java.lang.String namespaceuri ="";
try { while (!reader.isStartElement() && !reader.isEndElement())
reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){
java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
"type");
if (fullTypeName!=null){
java.lang.String nsPrefix = null;
if (fullTypeName.indexOf(":") > -1){
nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":"));
}
nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"ArrayOfString".equals(type)){
//find namespace for the prefix
java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
return (ArrayOfString)ExtensionMapper.getTypeObject(
nsUri,type,reader);
} } } // Note all attributes that were handled. Used to differ normal attributes
// from anyAttributes.
java.util.Vector handledAttributes = new java.util.Vector(); reader.next(); java.util.ArrayList list1 = new java.util.ArrayList(); while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.isStartElement() && new javax.xml.namespace.QName("http://ws.apache.org/axis2","array").equals(reader.getName())){ // Process the array and step past its final element's end. nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil");
if ("true".equals(nillableValue) || "1".equals(nillableValue)){
list1.add(null); reader.next();
} else {
list1.add(reader.getElementText());
}
//loop until we find a start element that is not part of this array
boolean loopDone1 = false;
while(!loopDone1){
// Ensure we are at the EndElement
while (!reader.isEndElement()){
reader.next();
}
// Step out of this element
reader.next();
// Step to next element event.
while (!reader.isStartElement() && !reader.isEndElement())
reader.next();
if (reader.isEndElement()){
//two continuous end elements means we are exiting the xml structure
loopDone1 = true;
} else {
if (new javax.xml.namespace.QName("http://ws.apache.org/axis2","array").equals(reader.getName())){ nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil");
if ("true".equals(nillableValue) || "1".equals(nillableValue)){
list1.add(null); reader.next();
} else {
list1.add(reader.getElementText());
}
}else{
loopDone1 = true;
}
}
}
// call the converter utility to convert and set the array object.setArray((java.lang.String[])
list1.toArray(new java.lang.String[list1.size()])); } // End of if for expected property start element else { } while (!reader.isStartElement() && !reader.isEndElement())
reader.next(); if (reader.isStartElement())
// A start element we are not expecting indicates a trailing invalid property
throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getName()); } catch (javax.xml.stream.XMLStreamException e) {
throw new java.lang.Exception(e);
} return object;
} }//end of factory class } public static class ExtensionMapper{ public static java.lang.Object getTypeObject(java.lang.String namespaceURI,
java.lang.String typeName,
javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ if (
"http://ws.apache.org/axis2".equals(namespaceURI) &&
"ArrayOfString".equals(typeName)){ return ArrayOfString.Factory.parse(reader); } throw new org.apache.axis2.databinding.ADBException("Unsupported type " + namespaceURI + " " + typeName);
} } public static class GetFromRedis
implements org.apache.axis2.databinding.ADBBean{ public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName(
"http://ws.apache.org/axis2",
"getFromRedis",
"ns1"); /**
* field for Key
*/ protected java.lang.String localKey ; /* This tracker boolean wil be used to detect whether the user called the set method
* for this attribute. It will be used to determine whether to include this field
* in the serialized XML
*/
protected boolean localKeyTracker = false ; public boolean isKeySpecified(){
return localKeyTracker;
} /**
* Auto generated getter method
* @return java.lang.String
*/
public java.lang.String getKey(){
return localKey;
} /**
* Auto generated setter method
* @param param Key
*/
public void setKey(java.lang.String param){
localKeyTracker = true; this.localKey=param; } /**
*
* @param parentQName
* @param factory
* @return org.apache.axiom.om.OMElement
*/
public org.apache.axiom.om.OMElement getOMElement (
final javax.xml.namespace.QName parentQName,
final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource =
new org.apache.axis2.databinding.ADBDataSource(this,MY_QNAME);
return factory.createOMElement(dataSource,MY_QNAME); } public void serialize(final javax.xml.namespace.QName parentQName,
javax.xml.stream.XMLStreamWriter xmlWriter)
throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{
serialize(parentQName,xmlWriter,false);
} public void serialize(final javax.xml.namespace.QName parentQName,
javax.xml.stream.XMLStreamWriter xmlWriter,
boolean serializeType)
throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null;
java.lang.String namespace = null; prefix = parentQName.getPrefix();
namespace = parentQName.getNamespaceURI();
writeStartElement(prefix, namespace, parentQName.getLocalPart(), xmlWriter); if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://ws.apache.org/axis2");
if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type",
namespacePrefix+":getFromRedis",
xmlWriter);
} else {
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type",
"getFromRedis",
xmlWriter);
} }
if (localKeyTracker){
namespace = "http://ws.apache.org/axis2";
writeStartElement(null, namespace, "key", xmlWriter); if (localKey==null){
// write the nil attribute writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter); }else{ xmlWriter.writeCharacters(localKey); } xmlWriter.writeEndElement();
}
xmlWriter.writeEndElement(); } private static java.lang.String generatePrefix(java.lang.String namespace) {
if(namespace.equals("http://ws.apache.org/axis2")){
return "ns1";
}
return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
} /**
* Utility method to write an element start tag.
*/
private void writeStartElement(java.lang.String prefix, java.lang.String namespace, java.lang.String localPart,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
if (writerPrefix != null) {
xmlWriter.writeStartElement(namespace, localPart);
} else {
if (namespace.length() == 0) {
prefix = "";
} else if (prefix == null) {
prefix = generatePrefix(namespace);
} xmlWriter.writeStartElement(prefix, localPart, namespace);
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
} /**
* Util method to write an attribute with the ns prefix
*/
private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName,
java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
if (xmlWriter.getPrefix(namespace) == null) {
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
xmlWriter.writeAttribute(namespace,attName,attValue);
} /**
* Util method to write an attribute without the ns prefix
*/
private void writeAttribute(java.lang.String namespace,java.lang.String attName,
java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName,attValue);
} else {
registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace,attName,attValue);
}
} /**
* Util method to write an attribute without the ns prefix
*/
private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName,
javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI();
java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
if (attributePrefix == null) {
attributePrefix = registerPrefix(xmlWriter, attributeNamespace);
}
java.lang.String attributeValue;
if (attributePrefix.trim().length() > 0) {
attributeValue = attributePrefix + ":" + qname.getLocalPart();
} else {
attributeValue = qname.getLocalPart();
} if (namespace.equals("")) {
xmlWriter.writeAttribute(attName, attributeValue);
} else {
registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace, attName, attributeValue);
}
}
/**
* method to handle Qnames
*/ private void writeQName(javax.xml.namespace.QName qname,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String namespaceURI = qname.getNamespaceURI();
if (namespaceURI != null) {
java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
if (prefix == null) {
prefix = generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix,namespaceURI);
} if (prefix.trim().length() > 0){
xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
} else {
// i.e this is the default namespace
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
} } else {
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
} private void writeQNames(javax.xml.namespace.QName[] qnames,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) {
// we have to store this data until last moment since it is not possible to write any
// namespace data after writing the charactor data
java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer();
java.lang.String namespaceURI = null;
java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) {
if (i > 0) {
stringToWrite.append(" ");
}
namespaceURI = qnames[i].getNamespaceURI();
if (namespaceURI != null) {
prefix = xmlWriter.getPrefix(namespaceURI);
if ((prefix == null) || (prefix.length() == 0)) {
prefix = generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix,namespaceURI);
} if (prefix.trim().length() > 0){
stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
}
xmlWriter.writeCharacters(stringToWrite.toString());
} } /**
* Register a namespace prefix
*/
private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException {
java.lang.String prefix = xmlWriter.getPrefix(namespace);
if (prefix == null) {
prefix = generatePrefix(namespace);
javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext();
while (true) {
java.lang.String uri = nsContext.getNamespaceURI(prefix);
if (uri == null || uri.length() == 0) {
break;
}
prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
return prefix;
} /**
* databinding method to get an XML representation of this object
*
*/
public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)
throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList();
java.util.ArrayList attribList = new java.util.ArrayList(); if (localKeyTracker){
elementList.add(new javax.xml.namespace.QName("http://ws.apache.org/axis2",
"key")); elementList.add(localKey==null?null:
org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localKey));
} return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /**
* Factory class that keeps the parse method
*/
public static class Factory{ /**
* static method to create the object
* Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable
* If this object is not an element, it is a complex type and the reader is at the event just after the outer start element
* Postcondition: If this object is an element, the reader is positioned at its end element
* If this object is a complex type, the reader is positioned at the end element of its outer element
*/
public static GetFromRedis parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{
GetFromRedis object =
new GetFromRedis(); int event;
java.lang.String nillableValue = null;
java.lang.String prefix ="";
java.lang.String namespaceuri ="";
try { while (!reader.isStartElement() && !reader.isEndElement())
reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){
java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
"type");
if (fullTypeName!=null){
java.lang.String nsPrefix = null;
if (fullTypeName.indexOf(":") > -1){
nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":"));
}
nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"getFromRedis".equals(type)){
//find namespace for the prefix
java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
return (GetFromRedis)ExtensionMapper.getTypeObject(
nsUri,type,reader);
} } } // Note all attributes that were handled. Used to differ normal attributes
// from anyAttributes.
java.util.Vector handledAttributes = new java.util.Vector(); reader.next(); while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.isStartElement() && new javax.xml.namespace.QName("http://ws.apache.org/axis2","key").equals(reader.getName())){ nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil");
if (!"true".equals(nillableValue) && !"1".equals(nillableValue)){ java.lang.String content = reader.getElementText(); object.setKey(
org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content)); } else { reader.getElementText(); // throw away text nodes if any.
} reader.next(); } // End of if for expected property start element else { } while (!reader.isStartElement() && !reader.isEndElement())
reader.next(); if (reader.isStartElement())
// A start element we are not expecting indicates a trailing invalid property
throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getName()); } catch (javax.xml.stream.XMLStreamException e) {
throw new java.lang.Exception(e);
} return object;
} }//end of factory class } public static class SaveToRedisWithKey
implements org.apache.axis2.databinding.ADBBean{ public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName(
"http://ws.apache.org/axis2",
"saveToRedisWithKey",
"ns1"); /**
* field for Key
*/ protected java.lang.String localKey ; /* This tracker boolean wil be used to detect whether the user called the set method
* for this attribute. It will be used to determine whether to include this field
* in the serialized XML
*/
protected boolean localKeyTracker = false ; public boolean isKeySpecified(){
return localKeyTracker;
} /**
* Auto generated getter method
* @return java.lang.String
*/
public java.lang.String getKey(){
return localKey;
} /**
* Auto generated setter method
* @param param Key
*/
public void setKey(java.lang.String param){
localKeyTracker = true; this.localKey=param; } /**
* field for ObjectMap
* This was an Array!
*/ protected ArrayOfString[] localObjectMap ; /* This tracker boolean wil be used to detect whether the user called the set method
* for this attribute. It will be used to determine whether to include this field
* in the serialized XML
*/
protected boolean localObjectMapTracker = false ; public boolean isObjectMapSpecified(){
return localObjectMapTracker;
} /**
* Auto generated getter method
* @return ArrayOfString[]
*/
public ArrayOfString[] getObjectMap(){
return localObjectMap;
} /**
* validate the array for ObjectMap
*/
protected void validateObjectMap(ArrayOfString[] param){ } /**
* Auto generated setter method
* @param param ObjectMap
*/
public void setObjectMap(ArrayOfString[] param){ validateObjectMap(param); localObjectMapTracker = true; this.localObjectMap=param;
} /**
* Auto generated add method for the array for convenience
* @param param ArrayOfString
*/
public void addObjectMap(ArrayOfString param){
if (localObjectMap == null){
localObjectMap = new ArrayOfString[]{};
} //update the setting tracker
localObjectMapTracker = true; java.util.List list =
org.apache.axis2.databinding.utils.ConverterUtil.toList(localObjectMap);
list.add(param);
this.localObjectMap =
(ArrayOfString[])list.toArray(
new ArrayOfString[list.size()]); } /**
*
* @param parentQName
* @param factory
* @return org.apache.axiom.om.OMElement
*/
public org.apache.axiom.om.OMElement getOMElement (
final javax.xml.namespace.QName parentQName,
final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource =
new org.apache.axis2.databinding.ADBDataSource(this,MY_QNAME);
return factory.createOMElement(dataSource,MY_QNAME); } public void serialize(final javax.xml.namespace.QName parentQName,
javax.xml.stream.XMLStreamWriter xmlWriter)
throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{
serialize(parentQName,xmlWriter,false);
} public void serialize(final javax.xml.namespace.QName parentQName,
javax.xml.stream.XMLStreamWriter xmlWriter,
boolean serializeType)
throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null;
java.lang.String namespace = null; prefix = parentQName.getPrefix();
namespace = parentQName.getNamespaceURI();
writeStartElement(prefix, namespace, parentQName.getLocalPart(), xmlWriter); if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://ws.apache.org/axis2");
if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type",
namespacePrefix+":saveToRedisWithKey",
xmlWriter);
} else {
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type",
"saveToRedisWithKey",
xmlWriter);
} }
if (localKeyTracker){
namespace = "http://ws.apache.org/axis2";
writeStartElement(null, namespace, "key", xmlWriter); if (localKey==null){
// write the nil attribute writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter); }else{ xmlWriter.writeCharacters(localKey); } xmlWriter.writeEndElement();
} if (localObjectMapTracker){
if (localObjectMap!=null){
for (int i = 0;i < localObjectMap.length;i++){
if (localObjectMap[i] != null){
localObjectMap[i].serialize(new javax.xml.namespace.QName("http://ws.apache.org/axis2","ObjectMap"),
xmlWriter);
} else { writeStartElement(null, "http://ws.apache.org/axis2", "ObjectMap", xmlWriter); // write the nil attribute
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter);
xmlWriter.writeEndElement(); } }
} else { writeStartElement(null, "http://ws.apache.org/axis2", "ObjectMap", xmlWriter); // write the nil attribute
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter);
xmlWriter.writeEndElement(); }
}
xmlWriter.writeEndElement(); } private static java.lang.String generatePrefix(java.lang.String namespace) {
if(namespace.equals("http://ws.apache.org/axis2")){
return "ns1";
}
return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
} /**
* Utility method to write an element start tag.
*/
private void writeStartElement(java.lang.String prefix, java.lang.String namespace, java.lang.String localPart,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
if (writerPrefix != null) {
xmlWriter.writeStartElement(namespace, localPart);
} else {
if (namespace.length() == 0) {
prefix = "";
} else if (prefix == null) {
prefix = generatePrefix(namespace);
} xmlWriter.writeStartElement(prefix, localPart, namespace);
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
} /**
* Util method to write an attribute with the ns prefix
*/
private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName,
java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
if (xmlWriter.getPrefix(namespace) == null) {
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
xmlWriter.writeAttribute(namespace,attName,attValue);
} /**
* Util method to write an attribute without the ns prefix
*/
private void writeAttribute(java.lang.String namespace,java.lang.String attName,
java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName,attValue);
} else {
registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace,attName,attValue);
}
} /**
* Util method to write an attribute without the ns prefix
*/
private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName,
javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI();
java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
if (attributePrefix == null) {
attributePrefix = registerPrefix(xmlWriter, attributeNamespace);
}
java.lang.String attributeValue;
if (attributePrefix.trim().length() > 0) {
attributeValue = attributePrefix + ":" + qname.getLocalPart();
} else {
attributeValue = qname.getLocalPart();
} if (namespace.equals("")) {
xmlWriter.writeAttribute(attName, attributeValue);
} else {
registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace, attName, attributeValue);
}
}
/**
* method to handle Qnames
*/ private void writeQName(javax.xml.namespace.QName qname,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String namespaceURI = qname.getNamespaceURI();
if (namespaceURI != null) {
java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
if (prefix == null) {
prefix = generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix,namespaceURI);
} if (prefix.trim().length() > 0){
xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
} else {
// i.e this is the default namespace
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
} } else {
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
} private void writeQNames(javax.xml.namespace.QName[] qnames,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) {
// we have to store this data until last moment since it is not possible to write any
// namespace data after writing the charactor data
java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer();
java.lang.String namespaceURI = null;
java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) {
if (i > 0) {
stringToWrite.append(" ");
}
namespaceURI = qnames[i].getNamespaceURI();
if (namespaceURI != null) {
prefix = xmlWriter.getPrefix(namespaceURI);
if ((prefix == null) || (prefix.length() == 0)) {
prefix = generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix,namespaceURI);
} if (prefix.trim().length() > 0){
stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
}
xmlWriter.writeCharacters(stringToWrite.toString());
} } /**
* Register a namespace prefix
*/
private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException {
java.lang.String prefix = xmlWriter.getPrefix(namespace);
if (prefix == null) {
prefix = generatePrefix(namespace);
javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext();
while (true) {
java.lang.String uri = nsContext.getNamespaceURI(prefix);
if (uri == null || uri.length() == 0) {
break;
}
prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
return prefix;
} /**
* databinding method to get an XML representation of this object
*
*/
public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)
throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList();
java.util.ArrayList attribList = new java.util.ArrayList(); if (localKeyTracker){
elementList.add(new javax.xml.namespace.QName("http://ws.apache.org/axis2",
"key")); elementList.add(localKey==null?null:
org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localKey));
} if (localObjectMapTracker){
if (localObjectMap!=null) {
for (int i = 0;i < localObjectMap.length;i++){ if (localObjectMap[i] != null){
elementList.add(new javax.xml.namespace.QName("http://ws.apache.org/axis2",
"ObjectMap"));
elementList.add(localObjectMap[i]);
} else { elementList.add(new javax.xml.namespace.QName("http://ws.apache.org/axis2",
"ObjectMap"));
elementList.add(null); } }
} else { elementList.add(new javax.xml.namespace.QName("http://ws.apache.org/axis2",
"ObjectMap"));
elementList.add(localObjectMap); } } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /**
* Factory class that keeps the parse method
*/
public static class Factory{ /**
* static method to create the object
* Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable
* If this object is not an element, it is a complex type and the reader is at the event just after the outer start element
* Postcondition: If this object is an element, the reader is positioned at its end element
* If this object is a complex type, the reader is positioned at the end element of its outer element
*/
public static SaveToRedisWithKey parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{
SaveToRedisWithKey object =
new SaveToRedisWithKey(); int event;
java.lang.String nillableValue = null;
java.lang.String prefix ="";
java.lang.String namespaceuri ="";
try { while (!reader.isStartElement() && !reader.isEndElement())
reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){
java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
"type");
if (fullTypeName!=null){
java.lang.String nsPrefix = null;
if (fullTypeName.indexOf(":") > -1){
nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":"));
}
nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"saveToRedisWithKey".equals(type)){
//find namespace for the prefix
java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
return (SaveToRedisWithKey)ExtensionMapper.getTypeObject(
nsUri,type,reader);
} } } // Note all attributes that were handled. Used to differ normal attributes
// from anyAttributes.
java.util.Vector handledAttributes = new java.util.Vector(); reader.next(); java.util.ArrayList list2 = new java.util.ArrayList(); while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.isStartElement() && new javax.xml.namespace.QName("http://ws.apache.org/axis2","key").equals(reader.getName())){ nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil");
if (!"true".equals(nillableValue) && !"1".equals(nillableValue)){ java.lang.String content = reader.getElementText(); object.setKey(
org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content)); } else { reader.getElementText(); // throw away text nodes if any.
} reader.next(); } // End of if for expected property start element else { } while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.isStartElement() && new javax.xml.namespace.QName("http://ws.apache.org/axis2","ObjectMap").equals(reader.getName())){ // Process the array and step past its final element's end. nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil");
if ("true".equals(nillableValue) || "1".equals(nillableValue)){
list2.add(null);
reader.next();
} else {
list2.add(ArrayOfString.Factory.parse(reader));
}
//loop until we find a start element that is not part of this array
boolean loopDone2 = false;
while(!loopDone2){
// We should be at the end element, but make sure
while (!reader.isEndElement())
reader.next();
// Step out of this element
reader.next();
// Step to next element event.
while (!reader.isStartElement() && !reader.isEndElement())
reader.next();
if (reader.isEndElement()){
//two continuous end elements means we are exiting the xml structure
loopDone2 = true;
} else {
if (new javax.xml.namespace.QName("http://ws.apache.org/axis2","ObjectMap").equals(reader.getName())){ nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil");
if ("true".equals(nillableValue) || "1".equals(nillableValue)){
list2.add(null);
reader.next();
} else {
list2.add(ArrayOfString.Factory.parse(reader));
}
}else{
loopDone2 = true;
}
}
}
// call the converter utility to convert and set the array object.setObjectMap((ArrayOfString[])
org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(
ArrayOfString.class,
list2)); } // End of if for expected property start element else { } while (!reader.isStartElement() && !reader.isEndElement())
reader.next(); if (reader.isStartElement())
// A start element we are not expecting indicates a trailing invalid property
throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getName()); } catch (javax.xml.stream.XMLStreamException e) {
throw new java.lang.Exception(e);
} return object;
} }//end of factory class } private org.apache.axiom.om.OMElement toOM(RedisService.RedisServiceStub.SaveToRedisWithKey param, boolean optimizeContent)
throws org.apache.axis2.AxisFault { try{
return param.getOMElement(RedisService.RedisServiceStub.SaveToRedisWithKey.MY_QNAME,
org.apache.axiom.om.OMAbstractFactory.getOMFactory());
} catch(org.apache.axis2.databinding.ADBException e){
throw org.apache.axis2.AxisFault.makeFault(e);
} } private org.apache.axiom.om.OMElement toOM(RedisService.RedisServiceStub.SaveToRedisWithKeyResponse param, boolean optimizeContent)
throws org.apache.axis2.AxisFault { try{
return param.getOMElement(RedisService.RedisServiceStub.SaveToRedisWithKeyResponse.MY_QNAME,
org.apache.axiom.om.OMAbstractFactory.getOMFactory());
} catch(org.apache.axis2.databinding.ADBException e){
throw org.apache.axis2.AxisFault.makeFault(e);
} } private org.apache.axiom.om.OMElement toOM(RedisService.RedisServiceStub.SaveToRedis param, boolean optimizeContent)
throws org.apache.axis2.AxisFault { try{
return param.getOMElement(RedisService.RedisServiceStub.SaveToRedis.MY_QNAME,
org.apache.axiom.om.OMAbstractFactory.getOMFactory());
} catch(org.apache.axis2.databinding.ADBException e){
throw org.apache.axis2.AxisFault.makeFault(e);
} } private org.apache.axiom.om.OMElement toOM(RedisService.RedisServiceStub.SaveToRedisResponse param, boolean optimizeContent)
throws org.apache.axis2.AxisFault { try{
return param.getOMElement(RedisService.RedisServiceStub.SaveToRedisResponse.MY_QNAME,
org.apache.axiom.om.OMAbstractFactory.getOMFactory());
} catch(org.apache.axis2.databinding.ADBException e){
throw org.apache.axis2.AxisFault.makeFault(e);
} } private org.apache.axiom.om.OMElement toOM(RedisService.RedisServiceStub.GetFromRedis param, boolean optimizeContent)
throws org.apache.axis2.AxisFault { try{
return param.getOMElement(RedisService.RedisServiceStub.GetFromRedis.MY_QNAME,
org.apache.axiom.om.OMAbstractFactory.getOMFactory());
} catch(org.apache.axis2.databinding.ADBException e){
throw org.apache.axis2.AxisFault.makeFault(e);
} } private org.apache.axiom.om.OMElement toOM(RedisService.RedisServiceStub.GetFromRedisResponse param, boolean optimizeContent)
throws org.apache.axis2.AxisFault { try{
return param.getOMElement(RedisService.RedisServiceStub.GetFromRedisResponse.MY_QNAME,
org.apache.axiom.om.OMAbstractFactory.getOMFactory());
} catch(org.apache.axis2.databinding.ADBException e){
throw org.apache.axis2.AxisFault.makeFault(e);
} } private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, RedisService.RedisServiceStub.SaveToRedisWithKey param, boolean optimizeContent, javax.xml.namespace.QName methodQName)
throws org.apache.axis2.AxisFault{ try{ org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
emptyEnvelope.getBody().addChild(param.getOMElement(RedisService.RedisServiceStub.SaveToRedisWithKey.MY_QNAME,factory));
return emptyEnvelope;
} catch(org.apache.axis2.databinding.ADBException e){
throw org.apache.axis2.AxisFault.makeFault(e);
} } /* methods to provide back word compatibility */ private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, RedisService.RedisServiceStub.SaveToRedis param, boolean optimizeContent, javax.xml.namespace.QName methodQName)
throws org.apache.axis2.AxisFault{ try{ org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
emptyEnvelope.getBody().addChild(param.getOMElement(RedisService.RedisServiceStub.SaveToRedis.MY_QNAME,factory));
return emptyEnvelope;
} catch(org.apache.axis2.databinding.ADBException e){
throw org.apache.axis2.AxisFault.makeFault(e);
} } /* methods to provide back word compatibility */ private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, RedisService.RedisServiceStub.GetFromRedis param, boolean optimizeContent, javax.xml.namespace.QName methodQName)
throws org.apache.axis2.AxisFault{ try{ org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
emptyEnvelope.getBody().addChild(param.getOMElement(RedisService.RedisServiceStub.GetFromRedis.MY_QNAME,factory));
return emptyEnvelope;
} catch(org.apache.axis2.databinding.ADBException e){
throw org.apache.axis2.AxisFault.makeFault(e);
} } /* methods to provide back word compatibility */ /**
* get the default envelope
*/
private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory){
return factory.getDefaultEnvelope();
} private java.lang.Object fromOM(
org.apache.axiom.om.OMElement param,
java.lang.Class type,
java.util.Map extraNamespaces) throws org.apache.axis2.AxisFault{ try { if (RedisService.RedisServiceStub.SaveToRedisWithKey.class.equals(type)){ return RedisService.RedisServiceStub.SaveToRedisWithKey.Factory.parse(param.getXMLStreamReaderWithoutCaching()); } if (RedisService.RedisServiceStub.SaveToRedisWithKeyResponse.class.equals(type)){ return RedisService.RedisServiceStub.SaveToRedisWithKeyResponse.Factory.parse(param.getXMLStreamReaderWithoutCaching()); } if (RedisService.RedisServiceStub.SaveToRedis.class.equals(type)){ return RedisService.RedisServiceStub.SaveToRedis.Factory.parse(param.getXMLStreamReaderWithoutCaching()); } if (RedisService.RedisServiceStub.SaveToRedisResponse.class.equals(type)){ return RedisService.RedisServiceStub.SaveToRedisResponse.Factory.parse(param.getXMLStreamReaderWithoutCaching()); } if (RedisService.RedisServiceStub.GetFromRedis.class.equals(type)){ return RedisService.RedisServiceStub.GetFromRedis.Factory.parse(param.getXMLStreamReaderWithoutCaching()); } if (RedisService.RedisServiceStub.GetFromRedisResponse.class.equals(type)){ return RedisService.RedisServiceStub.GetFromRedisResponse.Factory.parse(param.getXMLStreamReaderWithoutCaching()); } } catch (java.lang.Exception e) {
throw org.apache.axis2.AxisFault.makeFault(e);
}
return null;
} }
客户端测试用的代码
package RedisService; import java.rmi.RemoteException; import javax.xml.namespace.QName; import org.apache.axis2.AxisFault;
import org.apache.axis2.databinding.ADBException; import Myservice5.MyService5Stub.ArrayOfStringE;
import RedisService.RedisServiceStub.ArrayOfString;
import RedisService.RedisServiceStub.GetFromRedis;
import RedisService.RedisServiceStub.GetFromRedisResponse;
import RedisService.RedisServiceStub.SaveToRedis;
import RedisService.RedisServiceStub.SaveToRedisResponse;
import RedisService.RedisServiceStub.SaveToRedisWithKey; public class Test { /**
* @param args
* @throws ADBException
*/
public static void main(String[] args) throws ADBException {
GetFromRedisResponse getFromRedisString = new GetFromRedisResponse();
SaveToRedisResponse saveToRedisResponse = new SaveToRedisResponse();
// TODO Auto-generated method stub
//String[][] arr = {{"1","2"},{"3","4"}}; //Test SaveToRedis
ArrayOfStringE arrfsNoKey = new ArrayOfStringE();
ArrayOfStringE arrfsNoKey1 = new ArrayOfStringE();
String[] ArrayOfStringNoKey = {"11","22"};
String[] ArrayOfStringNoKey1 = {"33","44"};
arrfsNoKey.setArray(ArrayOfStringNoKey);
arrfsNoKey1.setArray(ArrayOfStringNoKey1);
ArrayOfStringE arrFSNoKey[] = new ArrayOfStringE[2];
arrFSNoKey[0] = arrfsNoKey;
arrFSNoKey[1] = arrfsNoKey1; //Test SaveToRedisWithKey
ArrayOfString arrfs = new ArrayOfString();
ArrayOfString arrfs1 = new ArrayOfString();
String[] ArrayOfString = {"1","2"};
String[] ArrayOfString1 = {"3","4"};
arrfs.setArray(ArrayOfString);
arrfs1.setArray(ArrayOfString1);
ArrayOfString arrFS[] = new ArrayOfString[2];
arrFS[0] = arrfs;
arrFS[1] = arrfs1;
String key;
// String [][] newOrder = new String [3][2];
// newOrder[0][0] = "net_type";
// newOrder[0][1] = "net_type";
// newOrder[1][0] = "serial_no";
// newOrder[1][1] = "serial_no";
// newOrder[2][0] = "user_id";
// newOrder[2][1] = "user_id";
// BaseDTO baseDTO = new BaseDTO();
// baseDTO.setObjectMap(arrFS);
//
// System.out.println(baseDTO.getObjectMap().length);
// ArrayOfString[] array = new ArrayOfString[baseDTO.getObjectMap().length];
// array = baseDTO.getObjectMap();
// ArrayOfString arrayOfString = new ArrayOfString();
// arrayOfString =array[0];
// String[] arra = new String[2];
// arra = arrayOfString.getArray();
// for(int i=0;i<arra.length;i++){
// System.out.println(arra[i]);
// }
// System.out.println(arra);
//Test SaveToRedis
SaveToRedis save = new SaveToRedis();
save.setObjectMap(arrFS);
//Test SaveToRedisWithKey
SaveToRedisWithKey saveKey = new SaveToRedisWithKey();
saveKey.setKey("0987654321");
saveKey.setObjectMap(arrFS);
GetFromRedis get = new GetFromRedis();
get.setKey("1427683519318");
//save.localObjectMap = arr;
//String[] returnKey = new String[5];
try {
RedisServiceStub stub = new RedisServiceStub();
try {
saveToRedisResponse = stub.saveToRedis(save);
System.out.println(saveToRedisResponse.get_return());
stub.saveToRedisWithKey(saveKey);
//getFromRedisString = stub.getFromRedis(get);
// QName net_type = new QName("net_type");
// System.out.println(getFromRedisString.getPullParser(net_type));
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (AxisFault e) {
// TODO Auto-generated catch block
e.printStackTrace();
} } }
webservice 使用axis2实现的更多相关文章
- webservice的Axis2入门教程java版
本文转自百度文库 Axis2是一套崭新的WebService引擎,该版本是对Axis1.x重新设计的产物.Axis2不仅支持SOAP1.1和SOAP1.2,还集成了非常流行的REST WebServi ...
- WebService之Axis2 (3):使用services.xml文件发布WebService
用Axis2实现Web Service,虽然可以将POJO类放在axis2\WEB-INF\pojo目录中直接发布成Web Service,这样做不需要进行任何配置,但这些POJO类不能在任何包中.这 ...
- webservice wsdl axis2报错 Provider com.bea.xml.stream.MXParserFactory not found
错误信息: Exception in thread "main" javax.xml.stream.FactoryConfigurationError: Provider com. ...
- WebService之Axis2 后续(6)~(10)目录
WebService大讲堂之Axis2(6):跨服务会话(Session)管理 WebService大讲堂之Axis2(7):将Spring的装配JavaBean发布成WebService WebSe ...
- WebService之Axis2(5):会话(Session)管理
WebService给人最直观的感觉就是由一个个方法组成,并在客户端通过SOAP协议调用这些方法.这些方法可能有返回值,也可能没有返回值.虽然这样可以完成一些工具,但这些被调用的方法是孤立的,当一个方 ...
- WebService之Axis2(4):二进制文件传输
在<WebService大讲堂之Axis2(2):复合类型数据的传递>中讲过,如果要传递二进制文件(如图像.音频文件等),可以使用byte[]作为数据类型进行传递,然后客户端使用RPC方式 ...
- Java动态调用webService,axis2动态调用webService
Java动态调用webService axis2动态调用webService >>>>>>>>>>>>>>>& ...
- WebService之Axis2
写在前面 本文只说Axis2的用法. 1.下载与部署 需要下载两个文件: 下载地址:http://mirrors.cnnic.cn/apache/axis/axis2/java/core/1.7.1/ ...
- Axis2 WebService客户端Axis2调用
第一RPC方式,不生成客户端代码 第二,document方式,不生成客户端代码 第三,用wsdl2java工具,生成客户端方式调用 package samples.quickstart.client; ...
- WebService之Axis2(2):复合类型数据的传递
在实际的应用中,不仅需要使用WebService来传递简单类型的数据,有时也需要传递更复杂的数据,这些数据可以被称为复合类型的数据.数组与类(接口)是比较常用的复合类型.在Axis2中可以直接使用将W ...
随机推荐
- Oracle OS认证 口令文件 密码丢失处理
Oracle OS认证 口令文件 密码丢失处理 分类: Oracle Basic Knowledge2009-10-19 14:24 5031人阅读 评论(9) 收藏 举报 oracleos数据库sq ...
- SQL Server 高性能写入的一些经验总结
转自:http://www.jb51.net/article/31162.htm 本篇博文将针对一些常用的数据库性能调休方法进行介绍,而且,为了编写高效的SQL代码,我们需要掌握一些基本代码优化的技巧 ...
- 微信小程序 - bindcontroltap和control的关系(map)
听说最近要废弃control,用cover-image和cover-view替代它,层级问题(我们此等萌新们还在想图标怎么显示在地图上(-.-)) 粗略的来说,一个展示(control),一个触发(b ...
- Objective-C学习笔记(二十一)——函数的返回值与參数类型
我们在之前的博客中涉及到的函数都没有參数,同一时候返回值也为void,即不须要返回值. 可是在以后的开发中.函数返回值和參数是必须涉及到的. 所以如今我们来讨论这个问题.我们还是以People类为例. ...
- c++ 银行管理系统及报告
1.题目描写叙述: 本代码为银行管理系统,总体分为管理员模式和普通用户模式: (1)在管理员模式中能完毕 ①用户信息录入 ②改动管理员password ③改动指定账户信息 ④信息管理业务 (2)在普通 ...
- C++——动态分配内存问题
class Obj { public: float score; ]; }; class Result { public: int id; ]; Obj obj[]; }; 合法,可动态分配内存给Re ...
- 【Java】Java_09 类型转换
1.自动类型转换 自动类型转换:容量小的数据类型可以自动转换为容量大的数据类型.在图中,黑色的实线表示无数据丢失的自动类型转换,而红色的虚线表示在转换时可能会精度的损失. 特例: 可以将整型常量直接赋 ...
- Matlab、R向量与矩阵操作
Matlab.R向量与矩阵操作 描 述 Matlab R 1 建立行向量v=[1 2 3 4] v=[1 2 3 4] v<-c(1,2,3,4)或v<-scan(),然后输入 ...
- NSDate相差8小时
NSDate *date = [NSDate date]; NSTimeZone *zone = [NSTimeZone systemTimeZone]; NSInteger interval = ...
- URL.createObjectURL()
URL.createObjectURL() 静态方法会创建一个 DOMString,其中包含一个表示参数中给出的对象的URL.这个 URL 的生命周期和创建它的窗口中的 document 绑定.这个新 ...