|
|
|
|
/**
|
|
|
|
|
* MobileCodeWSStub.java
|
|
|
|
|
* <p>
|
|
|
|
|
* This file was auto-generated from WSDL
|
|
|
|
|
* by the Apache Axis2 version: 1.7.3 Built on : May 30, 2016 (04:08:57 BST)
|
|
|
|
|
*/
|
|
|
|
|
package mobile;
|
|
|
|
|
|
|
|
|
|
import javax.xml.namespace.QName;
|
|
|
|
|
import javax.xml.stream.XMLStreamException;
|
|
|
|
|
import javax.xml.stream.XMLStreamReader;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* MobileCodeWSStub java implementation
|
|
|
|
|
*/
|
|
|
|
|
public class MobileCodeWSStub extends org.apache.axis2.client.Stub {
|
|
|
|
|
private static int counter = 0;
|
|
|
|
|
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 QName[] opNameArray = null;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructor that takes in a configContext
|
|
|
|
|
*/
|
|
|
|
|
public MobileCodeWSStub(
|
|
|
|
|
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 MobileCodeWSStub(
|
|
|
|
|
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 MobileCodeWSStub(
|
|
|
|
|
org.apache.axis2.context.ConfigurationContext configurationContext)
|
|
|
|
|
throws org.apache.axis2.AxisFault {
|
|
|
|
|
this(configurationContext,
|
|
|
|
|
"http://www.webxml.com.cn/WebServices/MobileCodeWS.asmx");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Default Constructor
|
|
|
|
|
*/
|
|
|
|
|
public MobileCodeWSStub() throws org.apache.axis2.AxisFault {
|
|
|
|
|
this("http://www.webxml.com.cn/WebServices/MobileCodeWS.asmx");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructor taking the target endpoint
|
|
|
|
|
*/
|
|
|
|
|
public MobileCodeWSStub(java.lang.String targetEndpoint)
|
|
|
|
|
throws org.apache.axis2.AxisFault {
|
|
|
|
|
this(null, targetEndpoint);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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 Long.toString(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("MobileCodeWS" +
|
|
|
|
|
getUniqueSuffix());
|
|
|
|
|
addAnonymousOperations();
|
|
|
|
|
|
|
|
|
|
//creating the operations
|
|
|
|
|
org.apache.axis2.description.AxisOperation __operation;
|
|
|
|
|
|
|
|
|
|
_operations = new org.apache.axis2.description.AxisOperation[2];
|
|
|
|
|
|
|
|
|
|
__operation = new org.apache.axis2.description.OutInAxisOperation();
|
|
|
|
|
|
|
|
|
|
__operation.setName(new QName(
|
|
|
|
|
"http://WebXml.com.cn/", "getDatabaseInfo"));
|
|
|
|
|
_service.addOperation(__operation);
|
|
|
|
|
|
|
|
|
|
_operations[0] = __operation;
|
|
|
|
|
|
|
|
|
|
__operation = new org.apache.axis2.description.OutInAxisOperation();
|
|
|
|
|
|
|
|
|
|
__operation.setName(new QName(
|
|
|
|
|
"http://WebXml.com.cn/", "getMobileCodeInfo"));
|
|
|
|
|
_service.addOperation(__operation);
|
|
|
|
|
|
|
|
|
|
_operations[1] = __operation;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//populates the faults
|
|
|
|
|
private void populateFaults() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Auto generated method signature
|
|
|
|
|
* <br /><h3>获得国内手机号码归属地数据库信息</h3><p>输入参数:无;返回数据:<EFBFBD>?<EFBFBD><EFBFBD>字符串数组(省份 城市 记录数量)<EFBFBD>?</p><br />
|
|
|
|
|
*
|
|
|
|
|
* @param getDatabaseInfo0
|
|
|
|
|
* @see mobile.MobileCodeWS#getDatabaseInfo
|
|
|
|
|
*/
|
|
|
|
|
public GetDatabaseInfoResponse getDatabaseInfo(
|
|
|
|
|
GetDatabaseInfo getDatabaseInfo0)
|
|
|
|
|
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("http://WebXml.com.cn/getDatabaseInfo");
|
|
|
|
|
_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()),
|
|
|
|
|
getDatabaseInfo0,
|
|
|
|
|
optimizeContent(
|
|
|
|
|
new QName("http://WebXml.com.cn/",
|
|
|
|
|
"getDatabaseInfo")),
|
|
|
|
|
new QName("http://WebXml.com.cn/",
|
|
|
|
|
"getDatabaseInfo"));
|
|
|
|
|
|
|
|
|
|
//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();
|
|
|
|
|
|
|
|
|
|
Object object = fromOM(_returnEnv.getBody()
|
|
|
|
|
.getFirstElement(),
|
|
|
|
|
GetDatabaseInfoResponse.class);
|
|
|
|
|
|
|
|
|
|
return (GetDatabaseInfoResponse) 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(), "getDatabaseInfo"))) {
|
|
|
|
|
//make the fault by reflection
|
|
|
|
|
try {
|
|
|
|
|
java.lang.String exceptionClassName = (java.lang.String) faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(
|
|
|
|
|
faultElt.getQName(), "getDatabaseInfo"));
|
|
|
|
|
Class exceptionClass = Class.forName(exceptionClassName);
|
|
|
|
|
java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(new Class[]{java.lang.String.class});
|
|
|
|
|
Exception ex = (Exception) constructor.newInstance(new Object[]{f.getMessage()});
|
|
|
|
|
|
|
|
|
|
//message class
|
|
|
|
|
java.lang.String messageClassName = (java.lang.String) faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(
|
|
|
|
|
faultElt.getQName(), "getDatabaseInfo"));
|
|
|
|
|
Class messageClass = Class.forName(messageClassName);
|
|
|
|
|
Object messageObject = fromOM(faultElt,
|
|
|
|
|
messageClass);
|
|
|
|
|
java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage",
|
|
|
|
|
new Class[]{messageClass});
|
|
|
|
|
m.invoke(ex, new Object[]{messageObject});
|
|
|
|
|
|
|
|
|
|
throw new java.rmi.RemoteException(ex.getMessage(), ex);
|
|
|
|
|
} catch (ClassCastException e) {
|
|
|
|
|
// we cannot intantiate the class - throw the original Axis fault
|
|
|
|
|
throw f;
|
|
|
|
|
} catch (ClassNotFoundException e) {
|
|
|
|
|
// we cannot intantiate the class - throw the original Axis fault
|
|
|
|
|
throw f;
|
|
|
|
|
} catch (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 (IllegalAccessException e) {
|
|
|
|
|
// we cannot intantiate the class - throw the original Axis fault
|
|
|
|
|
throw f;
|
|
|
|
|
} catch (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 for Asynchronous Invocations
|
|
|
|
|
* <br /><h3>获得国内手机号码归属地数据库信息</h3><p>输入参数:无;返回数据:<EFBFBD>?<EFBFBD><EFBFBD>字符串数组(省份 城市 记录数量)<EFBFBD>?</p><br />
|
|
|
|
|
*
|
|
|
|
|
* @param getDatabaseInfo0
|
|
|
|
|
* @see mobile.MobileCodeWS#startgetDatabaseInfo
|
|
|
|
|
*/
|
|
|
|
|
public void startgetDatabaseInfo(
|
|
|
|
|
GetDatabaseInfo getDatabaseInfo0,
|
|
|
|
|
final MobileCodeWSCallbackHandler callback)
|
|
|
|
|
throws java.rmi.RemoteException {
|
|
|
|
|
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0].getName());
|
|
|
|
|
_operationClient.getOptions()
|
|
|
|
|
.setAction("http://WebXml.com.cn/getDatabaseInfo");
|
|
|
|
|
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
|
|
|
|
|
|
|
|
|
|
addPropertyToOperationClient(_operationClient,
|
|
|
|
|
org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,
|
|
|
|
|
"&");
|
|
|
|
|
|
|
|
|
|
// create SOAP envelope with that payload
|
|
|
|
|
org.apache.axiom.soap.SOAPEnvelope env = null;
|
|
|
|
|
final org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext();
|
|
|
|
|
|
|
|
|
|
//Style is Doc.
|
|
|
|
|
env = toEnvelope(getFactory(_operationClient.getOptions()
|
|
|
|
|
.getSoapVersionURI()),
|
|
|
|
|
getDatabaseInfo0,
|
|
|
|
|
optimizeContent(
|
|
|
|
|
new QName("http://WebXml.com.cn/",
|
|
|
|
|
"getDatabaseInfo")),
|
|
|
|
|
new QName("http://WebXml.com.cn/",
|
|
|
|
|
"getDatabaseInfo"));
|
|
|
|
|
|
|
|
|
|
// adding SOAP soap_headers
|
|
|
|
|
_serviceClient.addHeadersToEnvelope(env);
|
|
|
|
|
// create message context with that soap envelope
|
|
|
|
|
_messageContext.setEnvelope(env);
|
|
|
|
|
|
|
|
|
|
// add the message context to the operation client
|
|
|
|
|
_operationClient.addMessageContext(_messageContext);
|
|
|
|
|
|
|
|
|
|
_operationClient.setCallback(new org.apache.axis2.client.async.AxisCallback() {
|
|
|
|
|
public void onMessage(
|
|
|
|
|
org.apache.axis2.context.MessageContext resultContext) {
|
|
|
|
|
try {
|
|
|
|
|
org.apache.axiom.soap.SOAPEnvelope resultEnv = resultContext.getEnvelope();
|
|
|
|
|
|
|
|
|
|
Object object = fromOM(resultEnv.getBody()
|
|
|
|
|
.getFirstElement(),
|
|
|
|
|
GetDatabaseInfoResponse.class);
|
|
|
|
|
callback.receiveResultgetDatabaseInfo((GetDatabaseInfoResponse) object);
|
|
|
|
|
} catch (org.apache.axis2.AxisFault e) {
|
|
|
|
|
callback.receiveErrorgetDatabaseInfo(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void onError(Exception error) {
|
|
|
|
|
if (error instanceof org.apache.axis2.AxisFault) {
|
|
|
|
|
org.apache.axis2.AxisFault f = (org.apache.axis2.AxisFault) error;
|
|
|
|
|
org.apache.axiom.om.OMElement faultElt = f.getDetail();
|
|
|
|
|
|
|
|
|
|
if (faultElt != null) {
|
|
|
|
|
if (faultExceptionNameMap.containsKey(
|
|
|
|
|
new org.apache.axis2.client.FaultMapKey(
|
|
|
|
|
faultElt.getQName(),
|
|
|
|
|
"getDatabaseInfo"))) {
|
|
|
|
|
//make the fault by reflection
|
|
|
|
|
try {
|
|
|
|
|
java.lang.String exceptionClassName = (java.lang.String) faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(
|
|
|
|
|
faultElt.getQName(),
|
|
|
|
|
"getDatabaseInfo"));
|
|
|
|
|
Class exceptionClass = Class.forName(exceptionClassName);
|
|
|
|
|
java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(new Class[]{java.lang.String.class});
|
|
|
|
|
Exception ex = (Exception) constructor.newInstance(new Object[]{f.getMessage()});
|
|
|
|
|
|
|
|
|
|
//message class
|
|
|
|
|
java.lang.String messageClassName = (java.lang.String) faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(
|
|
|
|
|
faultElt.getQName(),
|
|
|
|
|
"getDatabaseInfo"));
|
|
|
|
|
Class messageClass = Class.forName(messageClassName);
|
|
|
|
|
Object messageObject = fromOM(faultElt,
|
|
|
|
|
messageClass);
|
|
|
|
|
java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage",
|
|
|
|
|
new Class[]{messageClass});
|
|
|
|
|
m.invoke(ex,
|
|
|
|
|
new Object[]{messageObject});
|
|
|
|
|
|
|
|
|
|
callback.receiveErrorgetDatabaseInfo(new java.rmi.RemoteException(
|
|
|
|
|
ex.getMessage(), ex));
|
|
|
|
|
} catch (ClassCastException e) {
|
|
|
|
|
// we cannot intantiate the class - throw the original Axis fault
|
|
|
|
|
callback.receiveErrorgetDatabaseInfo(f);
|
|
|
|
|
} catch (ClassNotFoundException e) {
|
|
|
|
|
// we cannot intantiate the class - throw the original Axis fault
|
|
|
|
|
callback.receiveErrorgetDatabaseInfo(f);
|
|
|
|
|
} catch (NoSuchMethodException e) {
|
|
|
|
|
// we cannot intantiate the class - throw the original Axis fault
|
|
|
|
|
callback.receiveErrorgetDatabaseInfo(f);
|
|
|
|
|
} catch (java.lang.reflect.InvocationTargetException e) {
|
|
|
|
|
// we cannot intantiate the class - throw the original Axis fault
|
|
|
|
|
callback.receiveErrorgetDatabaseInfo(f);
|
|
|
|
|
} catch (IllegalAccessException e) {
|
|
|
|
|
// we cannot intantiate the class - throw the original Axis fault
|
|
|
|
|
callback.receiveErrorgetDatabaseInfo(f);
|
|
|
|
|
} catch (InstantiationException e) {
|
|
|
|
|
// we cannot intantiate the class - throw the original Axis fault
|
|
|
|
|
callback.receiveErrorgetDatabaseInfo(f);
|
|
|
|
|
} catch (org.apache.axis2.AxisFault e) {
|
|
|
|
|
// we cannot intantiate the class - throw the original Axis fault
|
|
|
|
|
callback.receiveErrorgetDatabaseInfo(f);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
callback.receiveErrorgetDatabaseInfo(f);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
callback.receiveErrorgetDatabaseInfo(f);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
callback.receiveErrorgetDatabaseInfo(error);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void onFault(
|
|
|
|
|
org.apache.axis2.context.MessageContext faultContext) {
|
|
|
|
|
org.apache.axis2.AxisFault fault = org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(faultContext);
|
|
|
|
|
onError(fault);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void onComplete() {
|
|
|
|
|
try {
|
|
|
|
|
_messageContext.getTransportOut().getSender()
|
|
|
|
|
.cleanup(_messageContext);
|
|
|
|
|
} catch (org.apache.axis2.AxisFault axisFault) {
|
|
|
|
|
callback.receiveErrorgetDatabaseInfo(axisFault);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
org.apache.axis2.util.CallbackReceiver _callbackReceiver = null;
|
|
|
|
|
|
|
|
|
|
if ((_operations[0].getMessageReceiver() == null) &&
|
|
|
|
|
_operationClient.getOptions().isUseSeparateListener()) {
|
|
|
|
|
_callbackReceiver = new org.apache.axis2.util.CallbackReceiver();
|
|
|
|
|
_operations[0].setMessageReceiver(_callbackReceiver);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//execute the operation client
|
|
|
|
|
_operationClient.execute(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Auto generated method signature
|
|
|
|
|
* <br /><h3>获得国内手机号码归属地省份<EFBFBD>?地区和手机卡类型信息</h3><p>输入参数:mobileCode = 字符串(手机号码,最少前7位数字),userID = 字符串(商业用户ID<EFBFBD>?免费用户为空字符串;返回数据:字符串(手机号码:省份 城市 手机卡类型)<EFBFBD>?lt;/p><br />
|
|
|
|
|
*
|
|
|
|
|
* @param getMobileCodeInfo2
|
|
|
|
|
* @see mobile.MobileCodeWS#getMobileCodeInfo
|
|
|
|
|
*/
|
|
|
|
|
public GetMobileCodeInfoResponse getMobileCodeInfo(
|
|
|
|
|
GetMobileCodeInfo getMobileCodeInfo2)
|
|
|
|
|
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("http://WebXml.com.cn/getMobileCodeInfo");
|
|
|
|
|
_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()),
|
|
|
|
|
getMobileCodeInfo2,
|
|
|
|
|
optimizeContent(
|
|
|
|
|
new QName("http://WebXml.com.cn/",
|
|
|
|
|
"getMobileCodeInfo")),
|
|
|
|
|
new QName("http://WebXml.com.cn/",
|
|
|
|
|
"getMobileCodeInfo"));
|
|
|
|
|
|
|
|
|
|
//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();
|
|
|
|
|
|
|
|
|
|
Object object = fromOM(_returnEnv.getBody()
|
|
|
|
|
.getFirstElement(),
|
|
|
|
|
GetMobileCodeInfoResponse.class);
|
|
|
|
|
|
|
|
|
|
return (GetMobileCodeInfoResponse) 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(), "getMobileCodeInfo"))) {
|
|
|
|
|
//make the fault by reflection
|
|
|
|
|
try {
|
|
|
|
|
java.lang.String exceptionClassName = (java.lang.String) faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(
|
|
|
|
|
faultElt.getQName(), "getMobileCodeInfo"));
|
|
|
|
|
Class exceptionClass = Class.forName(exceptionClassName);
|
|
|
|
|
java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(new Class[]{java.lang.String.class});
|
|
|
|
|
Exception ex = (Exception) constructor.newInstance(new Object[]{new Object[]{f.getMessage()}});
|
|
|
|
|
|
|
|
|
|
//message class
|
|
|
|
|
java.lang.String messageClassName = (java.lang.String) faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(
|
|
|
|
|
faultElt.getQName(), "getMobileCodeInfo"));
|
|
|
|
|
Class messageClass = Class.forName(messageClassName);
|
|
|
|
|
Object messageObject = fromOM(faultElt,
|
|
|
|
|
messageClass);
|
|
|
|
|
java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage",
|
|
|
|
|
new Class[]{messageClass});
|
|
|
|
|
m.invoke(ex, new Object[]{messageObject});
|
|
|
|
|
|
|
|
|
|
throw new java.rmi.RemoteException(ex.getMessage(), ex);
|
|
|
|
|
} catch (ClassCastException e) {
|
|
|
|
|
// we cannot intantiate the class - throw the original Axis fault
|
|
|
|
|
throw f;
|
|
|
|
|
} catch (ClassNotFoundException e) {
|
|
|
|
|
// we cannot intantiate the class - throw the original Axis fault
|
|
|
|
|
throw f;
|
|
|
|
|
} catch (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 (IllegalAccessException e) {
|
|
|
|
|
// we cannot intantiate the class - throw the original Axis fault
|
|
|
|
|
throw f;
|
|
|
|
|
} catch (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 for Asynchronous Invocations
|
|
|
|
|
* <br /><h3>获得国内手机号码归属地省份<EFBFBD>?地区和手机卡类型信息</h3><p>输入参数:mobileCode = 字符串(手机号码,最少前7位数字),userID = 字符串(商业用户ID<EFBFBD>?免费用户为空字符串;返回数据:字符串(手机号码:省份 城市 手机卡类型)<EFBFBD>?lt;/p><br />
|
|
|
|
|
*
|
|
|
|
|
* @param getMobileCodeInfo2
|
|
|
|
|
* @see mobile.MobileCodeWS#startgetMobileCodeInfo
|
|
|
|
|
*/
|
|
|
|
|
public void startgetMobileCodeInfo(
|
|
|
|
|
GetMobileCodeInfo getMobileCodeInfo2,
|
|
|
|
|
final MobileCodeWSCallbackHandler callback)
|
|
|
|
|
throws java.rmi.RemoteException {
|
|
|
|
|
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[1].getName());
|
|
|
|
|
_operationClient.getOptions()
|
|
|
|
|
.setAction("http://WebXml.com.cn/getMobileCodeInfo");
|
|
|
|
|
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
|
|
|
|
|
|
|
|
|
|
addPropertyToOperationClient(_operationClient,
|
|
|
|
|
org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,
|
|
|
|
|
"&");
|
|
|
|
|
|
|
|
|
|
// create SOAP envelope with that payload
|
|
|
|
|
org.apache.axiom.soap.SOAPEnvelope env = null;
|
|
|
|
|
final org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext();
|
|
|
|
|
|
|
|
|
|
//Style is Doc.
|
|
|
|
|
env = toEnvelope(getFactory(_operationClient.getOptions()
|
|
|
|
|
.getSoapVersionURI()),
|
|
|
|
|
getMobileCodeInfo2,
|
|
|
|
|
optimizeContent(
|
|
|
|
|
new QName("http://WebXml.com.cn/",
|
|
|
|
|
"getMobileCodeInfo")),
|
|
|
|
|
new QName("http://WebXml.com.cn/",
|
|
|
|
|
"getMobileCodeInfo"));
|
|
|
|
|
|
|
|
|
|
// adding SOAP soap_headers
|
|
|
|
|
_serviceClient.addHeadersToEnvelope(env);
|
|
|
|
|
// create message context with that soap envelope
|
|
|
|
|
_messageContext.setEnvelope(env);
|
|
|
|
|
|
|
|
|
|
// add the message context to the operation client
|
|
|
|
|
_operationClient.addMessageContext(_messageContext);
|
|
|
|
|
|
|
|
|
|
_operationClient.setCallback(new org.apache.axis2.client.async.AxisCallback() {
|
|
|
|
|
public void onMessage(
|
|
|
|
|
org.apache.axis2.context.MessageContext resultContext) {
|
|
|
|
|
try {
|
|
|
|
|
org.apache.axiom.soap.SOAPEnvelope resultEnv = resultContext.getEnvelope();
|
|
|
|
|
|
|
|
|
|
Object object = fromOM(resultEnv.getBody()
|
|
|
|
|
.getFirstElement(),
|
|
|
|
|
GetMobileCodeInfoResponse.class);
|
|
|
|
|
callback.receiveResultgetMobileCodeInfo((GetMobileCodeInfoResponse) object);
|
|
|
|
|
} catch (org.apache.axis2.AxisFault e) {
|
|
|
|
|
callback.receiveErrorgetMobileCodeInfo(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void onError(Exception error) {
|
|
|
|
|
if (error instanceof org.apache.axis2.AxisFault) {
|
|
|
|
|
org.apache.axis2.AxisFault f = (org.apache.axis2.AxisFault) error;
|
|
|
|
|
org.apache.axiom.om.OMElement faultElt = f.getDetail();
|
|
|
|
|
|
|
|
|
|
if (faultElt != null) {
|
|
|
|
|
if (faultExceptionNameMap.containsKey(
|
|
|
|
|
new org.apache.axis2.client.FaultMapKey(
|
|
|
|
|
faultElt.getQName(),
|
|
|
|
|
"getMobileCodeInfo"))) {
|
|
|
|
|
//make the fault by reflection
|
|
|
|
|
try {
|
|
|
|
|
java.lang.String exceptionClassName = (java.lang.String) faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(
|
|
|
|
|
faultElt.getQName(),
|
|
|
|
|
"getMobileCodeInfo"));
|
|
|
|
|
Class exceptionClass = Class.forName(exceptionClassName);
|
|
|
|
|
java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(new Class[]{java.lang.String.class});
|
|
|
|
|
Exception ex = (Exception) constructor.newInstance(new Object[]{f.getMessage()});
|
|
|
|
|
|
|
|
|
|
//message class
|
|
|
|
|
java.lang.String messageClassName = (java.lang.String) faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(
|
|
|
|
|
faultElt.getQName(),
|
|
|
|
|
"getMobileCodeInfo"));
|
|
|
|
|
Class messageClass = Class.forName(messageClassName);
|
|
|
|
|
Object messageObject = fromOM(faultElt,
|
|
|
|
|
messageClass);
|
|
|
|
|
java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage",
|
|
|
|
|
new Class[]{messageClass});
|
|
|
|
|
m.invoke(ex,
|
|
|
|
|
new Object[]{messageObject});
|
|
|
|
|
|
|
|
|
|
callback.receiveErrorgetMobileCodeInfo(new java.rmi.RemoteException(
|
|
|
|
|
ex.getMessage(), ex));
|
|
|
|
|
} catch (ClassCastException e) {
|
|
|
|
|
// we cannot intantiate the class - throw the original Axis fault
|
|
|
|
|
callback.receiveErrorgetMobileCodeInfo(f);
|
|
|
|
|
} catch (ClassNotFoundException e) {
|
|
|
|
|
// we cannot intantiate the class - throw the original Axis fault
|
|
|
|
|
callback.receiveErrorgetMobileCodeInfo(f);
|
|
|
|
|
} catch (NoSuchMethodException e) {
|
|
|
|
|
// we cannot intantiate the class - throw the original Axis fault
|
|
|
|
|
callback.receiveErrorgetMobileCodeInfo(f);
|
|
|
|
|
} catch (java.lang.reflect.InvocationTargetException e) {
|
|
|
|
|
// we cannot intantiate the class - throw the original Axis fault
|
|
|
|
|
callback.receiveErrorgetMobileCodeInfo(f);
|
|
|
|
|
} catch (IllegalAccessException e) {
|
|
|
|
|
// we cannot intantiate the class - throw the original Axis fault
|
|
|
|
|
callback.receiveErrorgetMobileCodeInfo(f);
|
|
|
|
|
} catch (InstantiationException e) {
|
|
|
|
|
// we cannot intantiate the class - throw the original Axis fault
|
|
|
|
|
callback.receiveErrorgetMobileCodeInfo(f);
|
|
|
|
|
} catch (org.apache.axis2.AxisFault e) {
|
|
|
|
|
// we cannot intantiate the class - throw the original Axis fault
|
|
|
|
|
callback.receiveErrorgetMobileCodeInfo(f);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
callback.receiveErrorgetMobileCodeInfo(f);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
callback.receiveErrorgetMobileCodeInfo(f);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
callback.receiveErrorgetMobileCodeInfo(error);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void onFault(
|
|
|
|
|
org.apache.axis2.context.MessageContext faultContext) {
|
|
|
|
|
org.apache.axis2.AxisFault fault = org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(faultContext);
|
|
|
|
|
onError(fault);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void onComplete() {
|
|
|
|
|
try {
|
|
|
|
|
_messageContext.getTransportOut().getSender()
|
|
|
|
|
.cleanup(_messageContext);
|
|
|
|
|
} catch (org.apache.axis2.AxisFault axisFault) {
|
|
|
|
|
callback.receiveErrorgetMobileCodeInfo(axisFault);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
org.apache.axis2.util.CallbackReceiver _callbackReceiver = null;
|
|
|
|
|
|
|
|
|
|
if ((_operations[1].getMessageReceiver() == null) &&
|
|
|
|
|
_operationClient.getOptions().isUseSeparateListener()) {
|
|
|
|
|
_callbackReceiver = new org.apache.axis2.util.CallbackReceiver();
|
|
|
|
|
_operations[1].setMessageReceiver(_callbackReceiver);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//execute the operation client
|
|
|
|
|
_operationClient.execute(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private boolean optimizeContent(QName opName) {
|
|
|
|
|
if (opNameArray == null) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < opNameArray.length; i++) {
|
|
|
|
|
if (opName.equals(opNameArray[i])) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private org.apache.axiom.om.OMElement toOM(
|
|
|
|
|
GetDatabaseInfo param, boolean optimizeContent)
|
|
|
|
|
throws org.apache.axis2.AxisFault {
|
|
|
|
|
try {
|
|
|
|
|
return param.getOMElement(GetDatabaseInfo.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(
|
|
|
|
|
GetDatabaseInfoResponse param,
|
|
|
|
|
boolean optimizeContent) throws org.apache.axis2.AxisFault {
|
|
|
|
|
try {
|
|
|
|
|
return param.getOMElement(GetDatabaseInfoResponse.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(
|
|
|
|
|
GetMobileCodeInfo param, boolean optimizeContent)
|
|
|
|
|
throws org.apache.axis2.AxisFault {
|
|
|
|
|
try {
|
|
|
|
|
return param.getOMElement(GetMobileCodeInfo.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(
|
|
|
|
|
GetMobileCodeInfoResponse param,
|
|
|
|
|
boolean optimizeContent) throws org.apache.axis2.AxisFault {
|
|
|
|
|
try {
|
|
|
|
|
return param.getOMElement(GetMobileCodeInfoResponse.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,
|
|
|
|
|
GetDatabaseInfo param, boolean optimizeContent,
|
|
|
|
|
QName elementQName)
|
|
|
|
|
throws org.apache.axis2.AxisFault {
|
|
|
|
|
try {
|
|
|
|
|
org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
|
|
|
|
|
emptyEnvelope.getBody()
|
|
|
|
|
.addChild(param.getOMElement(
|
|
|
|
|
GetDatabaseInfo.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,
|
|
|
|
|
GetMobileCodeInfo param,
|
|
|
|
|
boolean optimizeContent, QName elementQName)
|
|
|
|
|
throws org.apache.axis2.AxisFault {
|
|
|
|
|
try {
|
|
|
|
|
org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
|
|
|
|
|
emptyEnvelope.getBody()
|
|
|
|
|
.addChild(param.getOMElement(
|
|
|
|
|
GetMobileCodeInfo.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 Object fromOM(org.apache.axiom.om.OMElement param,
|
|
|
|
|
Class type) throws org.apache.axis2.AxisFault {
|
|
|
|
|
try {
|
|
|
|
|
if (GetDatabaseInfo.class.equals(type)) {
|
|
|
|
|
return GetDatabaseInfo.Factory.parse(param.getXMLStreamReaderWithoutCaching());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (GetDatabaseInfoResponse.class.equals(
|
|
|
|
|
type)) {
|
|
|
|
|
return GetDatabaseInfoResponse.Factory.parse(param.getXMLStreamReaderWithoutCaching());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (GetMobileCodeInfo.class.equals(type)) {
|
|
|
|
|
return GetMobileCodeInfo.Factory.parse(param.getXMLStreamReaderWithoutCaching());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (GetMobileCodeInfoResponse.class.equals(
|
|
|
|
|
type)) {
|
|
|
|
|
return GetMobileCodeInfoResponse.Factory.parse(param.getXMLStreamReaderWithoutCaching());
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw org.apache.axis2.AxisFault.makeFault(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//http://www.webxml.com.cn/WebServices/MobileCodeWS.asmx
|
|
|
|
|
public static class ArrayOfStringE implements org.apache.axis2.databinding.ADBBean {
|
|
|
|
|
public static final QName MY_QNAME = new QName("http://WebXml.com.cn/",
|
|
|
|
|
"ArrayOfString", "ns1");
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* field for ArrayOfString
|
|
|
|
|
*/
|
|
|
|
|
protected ArrayOfString localArrayOfString;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Auto generated getter method
|
|
|
|
|
*
|
|
|
|
|
* @return ArrayOfString
|
|
|
|
|
*/
|
|
|
|
|
public ArrayOfString getArrayOfString() {
|
|
|
|
|
return localArrayOfString;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Auto generated setter method
|
|
|
|
|
*
|
|
|
|
|
* @param param ArrayOfString
|
|
|
|
|
*/
|
|
|
|
|
public void setArrayOfString(ArrayOfString param) {
|
|
|
|
|
this.localArrayOfString = param;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param parentQName
|
|
|
|
|
* @param factory
|
|
|
|
|
* @return org.apache.axiom.om.OMElement
|
|
|
|
|
*/
|
|
|
|
|
public org.apache.axiom.om.OMElement getOMElement(
|
|
|
|
|
final QName parentQName,
|
|
|
|
|
final org.apache.axiom.om.OMFactory factory)
|
|
|
|
|
throws org.apache.axis2.databinding.ADBException {
|
|
|
|
|
return factory.createOMElement(new org.apache.axis2.databinding.ADBDataSource(
|
|
|
|
|
this, MY_QNAME), parentQName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void serialize(final QName parentQName,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter)
|
|
|
|
|
throws XMLStreamException,
|
|
|
|
|
org.apache.axis2.databinding.ADBException {
|
|
|
|
|
serialize(parentQName, xmlWriter, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void serialize(final QName parentQName,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType)
|
|
|
|
|
throws XMLStreamException,
|
|
|
|
|
org.apache.axis2.databinding.ADBException {
|
|
|
|
|
//We can safely assume an element has only one type associated with it
|
|
|
|
|
if (localArrayOfString == null) {
|
|
|
|
|
java.lang.String namespace = "http://WebXml.com.cn/";
|
|
|
|
|
writeStartElement(null, namespace, "ArrayOfString", xmlWriter);
|
|
|
|
|
|
|
|
|
|
// write the nil attribute
|
|
|
|
|
writeAttribute("xsi",
|
|
|
|
|
"http://www.w3.org/2001/XMLSchema-instance", "nil", "1",
|
|
|
|
|
xmlWriter);
|
|
|
|
|
xmlWriter.writeEndElement();
|
|
|
|
|
} else {
|
|
|
|
|
localArrayOfString.serialize(MY_QNAME, xmlWriter);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static java.lang.String generatePrefix(
|
|
|
|
|
java.lang.String namespace) {
|
|
|
|
|
if (namespace.equals("http://WebXml.com.cn/")) {
|
|
|
|
|
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 XMLStreamException {
|
|
|
|
|
java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
|
|
|
|
|
|
|
|
|
|
if (writerPrefix != null) {
|
|
|
|
|
xmlWriter.writeStartElement(writerPrefix, localPart, namespace);
|
|
|
|
|
} 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 XMLStreamException {
|
|
|
|
|
java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
|
|
|
|
|
|
|
|
|
|
if (writerPrefix != null) {
|
|
|
|
|
xmlWriter.writeAttribute(writerPrefix, namespace, attName,
|
|
|
|
|
attValue);
|
|
|
|
|
} else {
|
|
|
|
|
xmlWriter.writeNamespace(prefix, namespace);
|
|
|
|
|
xmlWriter.setPrefix(prefix, namespace);
|
|
|
|
|
xmlWriter.writeAttribute(prefix, 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 XMLStreamException {
|
|
|
|
|
if (namespace.equals("")) {
|
|
|
|
|
xmlWriter.writeAttribute(attName, attValue);
|
|
|
|
|
} else {
|
|
|
|
|
xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace),
|
|
|
|
|
namespace, attName, attValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Util method to write an attribute without the ns prefix
|
|
|
|
|
*/
|
|
|
|
|
private void writeQNameAttribute(java.lang.String namespace,
|
|
|
|
|
java.lang.String attName, QName qname,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter)
|
|
|
|
|
throws 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(attributePrefix, namespace, attName,
|
|
|
|
|
attributeValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* method to handle Qnames
|
|
|
|
|
*/
|
|
|
|
|
private void writeQName(QName qname,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter)
|
|
|
|
|
throws 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(QName[] qnames,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter)
|
|
|
|
|
throws 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
|
|
|
|
|
StringBuffer stringToWrite = new 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 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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Factory class that keeps the parse method
|
|
|
|
|
*/
|
|
|
|
|
public static class Factory {
|
|
|
|
|
private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Factory.class);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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 ArrayOfStringE parse(
|
|
|
|
|
XMLStreamReader reader)
|
|
|
|
|
throws Exception {
|
|
|
|
|
ArrayOfStringE object = new ArrayOfStringE();
|
|
|
|
|
|
|
|
|
|
int event;
|
|
|
|
|
QName currentQName = null;
|
|
|
|
|
java.lang.String nillableValue = null;
|
|
|
|
|
java.lang.String prefix = "";
|
|
|
|
|
java.lang.String namespaceuri = "";
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
while (!reader.isStartElement() && !reader.isEndElement())
|
|
|
|
|
reader.next();
|
|
|
|
|
|
|
|
|
|
currentQName = reader.getName();
|
|
|
|
|
|
|
|
|
|
nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
|
|
|
|
|
"nil");
|
|
|
|
|
|
|
|
|
|
if ("true".equals(nillableValue) ||
|
|
|
|
|
"1".equals(nillableValue)) {
|
|
|
|
|
// Skip the element and report the null value. It cannot have subelements.
|
|
|
|
|
while (!reader.isEndElement())
|
|
|
|
|
reader.next();
|
|
|
|
|
|
|
|
|
|
return object;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Note all attributes that were handled. Used to differ normal attributes
|
|
|
|
|
// from anyAttributes.
|
|
|
|
|
java.util.Vector handledAttributes = new java.util.Vector();
|
|
|
|
|
|
|
|
|
|
while (!reader.isEndElement()) {
|
|
|
|
|
if (reader.isStartElement()) {
|
|
|
|
|
if ((reader.isStartElement() &&
|
|
|
|
|
new QName(
|
|
|
|
|
"http://WebXml.com.cn/", "ArrayOfString").equals(
|
|
|
|
|
reader.getName())) ||
|
|
|
|
|
new QName("",
|
|
|
|
|
"ArrayOfString").equals(
|
|
|
|
|
reader.getName())) {
|
|
|
|
|
nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
|
|
|
|
|
"nil");
|
|
|
|
|
|
|
|
|
|
if ("true".equals(nillableValue) ||
|
|
|
|
|
"1".equals(nillableValue)) {
|
|
|
|
|
object.setArrayOfString(null);
|
|
|
|
|
reader.next();
|
|
|
|
|
} else {
|
|
|
|
|
object.setArrayOfString(ArrayOfString.Factory.parse(
|
|
|
|
|
reader));
|
|
|
|
|
}
|
|
|
|
|
} // End of if for expected property start element
|
|
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
// 3 - A start element we are not expecting indicates an invalid parameter was passed
|
|
|
|
|
throw new org.apache.axis2.databinding.ADBException(
|
|
|
|
|
"Unexpected subelement " +
|
|
|
|
|
reader.getName());
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
reader.next();
|
|
|
|
|
}
|
|
|
|
|
} // end of while loop
|
|
|
|
|
} catch (XMLStreamException e) {
|
|
|
|
|
throw new Exception(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return object;
|
|
|
|
|
}
|
|
|
|
|
} //end of factory class
|
|
|
|
|
|
|
|
|
|
public XMLStreamReader getPullParser(QName arg0)
|
|
|
|
|
throws XMLStreamException {
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class GetDatabaseInfo implements org.apache.axis2.databinding.ADBBean {
|
|
|
|
|
public static final QName MY_QNAME = new QName("http://WebXml.com.cn/",
|
|
|
|
|
"getDatabaseInfo", "ns1");
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param parentQName
|
|
|
|
|
* @param factory
|
|
|
|
|
* @return org.apache.axiom.om.OMElement
|
|
|
|
|
*/
|
|
|
|
|
public org.apache.axiom.om.OMElement getOMElement(
|
|
|
|
|
final QName parentQName,
|
|
|
|
|
final org.apache.axiom.om.OMFactory factory)
|
|
|
|
|
throws org.apache.axis2.databinding.ADBException {
|
|
|
|
|
return factory.createOMElement(new org.apache.axis2.databinding.ADBDataSource(
|
|
|
|
|
this, MY_QNAME), parentQName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void serialize(final QName parentQName,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter)
|
|
|
|
|
throws XMLStreamException,
|
|
|
|
|
org.apache.axis2.databinding.ADBException {
|
|
|
|
|
serialize(parentQName, xmlWriter, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void serialize(final QName parentQName,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType)
|
|
|
|
|
throws 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://WebXml.com.cn/");
|
|
|
|
|
|
|
|
|
|
if ((namespacePrefix != null) &&
|
|
|
|
|
(namespacePrefix.trim().length() > 0)) {
|
|
|
|
|
writeAttribute("xsi",
|
|
|
|
|
"http://www.w3.org/2001/XMLSchema-instance", "type",
|
|
|
|
|
namespacePrefix + ":getDatabaseInfo", xmlWriter);
|
|
|
|
|
} else {
|
|
|
|
|
writeAttribute("xsi",
|
|
|
|
|
"http://www.w3.org/2001/XMLSchema-instance", "type",
|
|
|
|
|
"getDatabaseInfo", xmlWriter);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
xmlWriter.writeEndElement();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static java.lang.String generatePrefix(
|
|
|
|
|
java.lang.String namespace) {
|
|
|
|
|
if (namespace.equals("http://WebXml.com.cn/")) {
|
|
|
|
|
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 XMLStreamException {
|
|
|
|
|
java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
|
|
|
|
|
|
|
|
|
|
if (writerPrefix != null) {
|
|
|
|
|
xmlWriter.writeStartElement(writerPrefix, localPart, namespace);
|
|
|
|
|
} 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 XMLStreamException {
|
|
|
|
|
java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
|
|
|
|
|
|
|
|
|
|
if (writerPrefix != null) {
|
|
|
|
|
xmlWriter.writeAttribute(writerPrefix, namespace, attName,
|
|
|
|
|
attValue);
|
|
|
|
|
} else {
|
|
|
|
|
xmlWriter.writeNamespace(prefix, namespace);
|
|
|
|
|
xmlWriter.setPrefix(prefix, namespace);
|
|
|
|
|
xmlWriter.writeAttribute(prefix, 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 XMLStreamException {
|
|
|
|
|
if (namespace.equals("")) {
|
|
|
|
|
xmlWriter.writeAttribute(attName, attValue);
|
|
|
|
|
} else {
|
|
|
|
|
xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace),
|
|
|
|
|
namespace, attName, attValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Util method to write an attribute without the ns prefix
|
|
|
|
|
*/
|
|
|
|
|
private void writeQNameAttribute(java.lang.String namespace,
|
|
|
|
|
java.lang.String attName, QName qname,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter)
|
|
|
|
|
throws 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(attributePrefix, namespace, attName,
|
|
|
|
|
attributeValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* method to handle Qnames
|
|
|
|
|
*/
|
|
|
|
|
private void writeQName(QName qname,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter)
|
|
|
|
|
throws 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(QName[] qnames,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter)
|
|
|
|
|
throws 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
|
|
|
|
|
StringBuffer stringToWrite = new 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 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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Factory class that keeps the parse method
|
|
|
|
|
*/
|
|
|
|
|
public static class Factory {
|
|
|
|
|
private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Factory.class);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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 GetDatabaseInfo parse(
|
|
|
|
|
XMLStreamReader reader)
|
|
|
|
|
throws Exception {
|
|
|
|
|
GetDatabaseInfo object = new GetDatabaseInfo();
|
|
|
|
|
|
|
|
|
|
int event;
|
|
|
|
|
QName currentQName = null;
|
|
|
|
|
java.lang.String nillableValue = null;
|
|
|
|
|
java.lang.String prefix = "";
|
|
|
|
|
java.lang.String namespaceuri = "";
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
while (!reader.isStartElement() && !reader.isEndElement())
|
|
|
|
|
reader.next();
|
|
|
|
|
|
|
|
|
|
currentQName = reader.getName();
|
|
|
|
|
|
|
|
|
|
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 (!"getDatabaseInfo".equals(type)) {
|
|
|
|
|
//find namespace for the prefix
|
|
|
|
|
java.lang.String nsUri = reader.getNamespaceContext()
|
|
|
|
|
.getNamespaceURI(nsPrefix);
|
|
|
|
|
|
|
|
|
|
return (GetDatabaseInfo) 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();
|
|
|
|
|
} catch (XMLStreamException e) {
|
|
|
|
|
throw new Exception(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return object;
|
|
|
|
|
}
|
|
|
|
|
} //end of factory class
|
|
|
|
|
|
|
|
|
|
public XMLStreamReader getPullParser(QName arg0)
|
|
|
|
|
throws XMLStreamException {
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class String implements org.apache.axis2.databinding.ADBBean {
|
|
|
|
|
public static final QName MY_QNAME = new QName("http://WebXml.com.cn/",
|
|
|
|
|
"string", "ns1");
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* field for String
|
|
|
|
|
*/
|
|
|
|
|
protected java.lang.String localString;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Auto generated getter method
|
|
|
|
|
*
|
|
|
|
|
* @return java.lang.String
|
|
|
|
|
*/
|
|
|
|
|
public java.lang.String getString() {
|
|
|
|
|
return localString;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Auto generated setter method
|
|
|
|
|
*
|
|
|
|
|
* @param param String
|
|
|
|
|
*/
|
|
|
|
|
public void setString(java.lang.String param) {
|
|
|
|
|
this.localString = param;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param parentQName
|
|
|
|
|
* @param factory
|
|
|
|
|
* @return org.apache.axiom.om.OMElement
|
|
|
|
|
*/
|
|
|
|
|
public org.apache.axiom.om.OMElement getOMElement(
|
|
|
|
|
final QName parentQName,
|
|
|
|
|
final org.apache.axiom.om.OMFactory factory)
|
|
|
|
|
throws org.apache.axis2.databinding.ADBException {
|
|
|
|
|
return factory.createOMElement(new org.apache.axis2.databinding.ADBDataSource(
|
|
|
|
|
this, MY_QNAME), parentQName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void serialize(final QName parentQName,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter)
|
|
|
|
|
throws XMLStreamException,
|
|
|
|
|
org.apache.axis2.databinding.ADBException {
|
|
|
|
|
serialize(parentQName, xmlWriter, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void serialize(final QName parentQName,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType)
|
|
|
|
|
throws XMLStreamException,
|
|
|
|
|
org.apache.axis2.databinding.ADBException {
|
|
|
|
|
//We can safely assume an element has only one type associated with it
|
|
|
|
|
java.lang.String namespace = "http://WebXml.com.cn/";
|
|
|
|
|
java.lang.String _localName = "string";
|
|
|
|
|
|
|
|
|
|
writeStartElement(null, namespace, _localName, xmlWriter);
|
|
|
|
|
|
|
|
|
|
// add the type details if this is used in a simple type
|
|
|
|
|
if (serializeType) {
|
|
|
|
|
java.lang.String namespacePrefix = registerPrefix(xmlWriter,
|
|
|
|
|
"http://WebXml.com.cn/");
|
|
|
|
|
|
|
|
|
|
if ((namespacePrefix != null) &&
|
|
|
|
|
(namespacePrefix.trim().length() > 0)) {
|
|
|
|
|
writeAttribute("xsi",
|
|
|
|
|
"http://www.w3.org/2001/XMLSchema-instance", "type",
|
|
|
|
|
namespacePrefix + ":string", xmlWriter);
|
|
|
|
|
} else {
|
|
|
|
|
writeAttribute("xsi",
|
|
|
|
|
"http://www.w3.org/2001/XMLSchema-instance", "type",
|
|
|
|
|
"string", xmlWriter);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (localString == null) {
|
|
|
|
|
// write the nil attribute
|
|
|
|
|
writeAttribute("xsi",
|
|
|
|
|
"http://www.w3.org/2001/XMLSchema-instance", "nil", "1",
|
|
|
|
|
xmlWriter);
|
|
|
|
|
} else {
|
|
|
|
|
xmlWriter.writeCharacters(localString);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
xmlWriter.writeEndElement();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static java.lang.String generatePrefix(
|
|
|
|
|
java.lang.String namespace) {
|
|
|
|
|
if (namespace.equals("http://WebXml.com.cn/")) {
|
|
|
|
|
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 XMLStreamException {
|
|
|
|
|
java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
|
|
|
|
|
|
|
|
|
|
if (writerPrefix != null) {
|
|
|
|
|
xmlWriter.writeStartElement(writerPrefix, localPart, namespace);
|
|
|
|
|
} 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 XMLStreamException {
|
|
|
|
|
java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
|
|
|
|
|
|
|
|
|
|
if (writerPrefix != null) {
|
|
|
|
|
xmlWriter.writeAttribute(writerPrefix, namespace, attName,
|
|
|
|
|
attValue);
|
|
|
|
|
} else {
|
|
|
|
|
xmlWriter.writeNamespace(prefix, namespace);
|
|
|
|
|
xmlWriter.setPrefix(prefix, namespace);
|
|
|
|
|
xmlWriter.writeAttribute(prefix, 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 XMLStreamException {
|
|
|
|
|
if (namespace.equals("")) {
|
|
|
|
|
xmlWriter.writeAttribute(attName, attValue);
|
|
|
|
|
} else {
|
|
|
|
|
xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace),
|
|
|
|
|
namespace, attName, attValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Util method to write an attribute without the ns prefix
|
|
|
|
|
*/
|
|
|
|
|
private void writeQNameAttribute(java.lang.String namespace,
|
|
|
|
|
java.lang.String attName, QName qname,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter)
|
|
|
|
|
throws 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(attributePrefix, namespace, attName,
|
|
|
|
|
attributeValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* method to handle Qnames
|
|
|
|
|
*/
|
|
|
|
|
private void writeQName(QName qname,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter)
|
|
|
|
|
throws 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(QName[] qnames,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter)
|
|
|
|
|
throws 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
|
|
|
|
|
StringBuffer stringToWrite = new 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 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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Factory class that keeps the parse method
|
|
|
|
|
*/
|
|
|
|
|
public static class Factory {
|
|
|
|
|
private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Factory.class);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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 String parse(XMLStreamReader reader)
|
|
|
|
|
throws Exception {
|
|
|
|
|
String object = new String();
|
|
|
|
|
|
|
|
|
|
int event;
|
|
|
|
|
QName currentQName = null;
|
|
|
|
|
java.lang.String nillableValue = null;
|
|
|
|
|
java.lang.String prefix = "";
|
|
|
|
|
java.lang.String namespaceuri = "";
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
while (!reader.isStartElement() && !reader.isEndElement())
|
|
|
|
|
reader.next();
|
|
|
|
|
|
|
|
|
|
currentQName = reader.getName();
|
|
|
|
|
|
|
|
|
|
nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
|
|
|
|
|
"nil");
|
|
|
|
|
|
|
|
|
|
if ("true".equals(nillableValue) ||
|
|
|
|
|
"1".equals(nillableValue)) {
|
|
|
|
|
// Skip the element and report the null value. It cannot have subelements.
|
|
|
|
|
while (!reader.isEndElement())
|
|
|
|
|
reader.next();
|
|
|
|
|
|
|
|
|
|
return object;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Note all attributes that were handled. Used to differ normal attributes
|
|
|
|
|
// from anyAttributes.
|
|
|
|
|
java.util.Vector handledAttributes = new java.util.Vector();
|
|
|
|
|
|
|
|
|
|
while (!reader.isEndElement()) {
|
|
|
|
|
if (reader.isStartElement()) {
|
|
|
|
|
if ((reader.isStartElement() &&
|
|
|
|
|
new QName(
|
|
|
|
|
"http://WebXml.com.cn/", "string").equals(
|
|
|
|
|
reader.getName())) ||
|
|
|
|
|
new QName("", "string").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.setString(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
|
|
|
|
|
content));
|
|
|
|
|
} else {
|
|
|
|
|
reader.getElementText(); // throw away text nodes if any.
|
|
|
|
|
}
|
|
|
|
|
} // End of if for expected property start element
|
|
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
// 3 - A start element we are not expecting indicates an invalid parameter was passed
|
|
|
|
|
throw new org.apache.axis2.databinding.ADBException(
|
|
|
|
|
"Unexpected subelement " +
|
|
|
|
|
reader.getName());
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
reader.next();
|
|
|
|
|
}
|
|
|
|
|
} // end of while loop
|
|
|
|
|
} catch (XMLStreamException e) {
|
|
|
|
|
throw new Exception(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return object;
|
|
|
|
|
}
|
|
|
|
|
} //end of factory class
|
|
|
|
|
|
|
|
|
|
public XMLStreamReader getPullParser(QName arg0)
|
|
|
|
|
throws XMLStreamException {
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class ExtensionMapper {
|
|
|
|
|
public static Object getTypeObject(
|
|
|
|
|
java.lang.String namespaceURI, java.lang.String typeName,
|
|
|
|
|
XMLStreamReader reader) throws Exception {
|
|
|
|
|
if ("http://WebXml.com.cn/".equals(namespaceURI) &&
|
|
|
|
|
"ArrayOfString".equals(typeName)) {
|
|
|
|
|
return ArrayOfString.Factory.parse(reader);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
throw new org.apache.axis2.databinding.ADBException(
|
|
|
|
|
"Unsupported type " + namespaceURI + " " + typeName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class GetDatabaseInfoResponse implements org.apache.axis2.databinding.ADBBean {
|
|
|
|
|
public static final QName MY_QNAME = new QName("http://WebXml.com.cn/",
|
|
|
|
|
"getDatabaseInfoResponse", "ns1");
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* field for GetDatabaseInfoResult
|
|
|
|
|
*/
|
|
|
|
|
protected ArrayOfString localGetDatabaseInfoResult;
|
|
|
|
|
|
|
|
|
|
/* 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 localGetDatabaseInfoResultTracker = false;
|
|
|
|
|
|
|
|
|
|
public boolean isGetDatabaseInfoResultSpecified() {
|
|
|
|
|
return localGetDatabaseInfoResultTracker;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Auto generated getter method
|
|
|
|
|
*
|
|
|
|
|
* @return ArrayOfString
|
|
|
|
|
*/
|
|
|
|
|
public ArrayOfString getGetDatabaseInfoResult() {
|
|
|
|
|
return localGetDatabaseInfoResult;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Auto generated setter method
|
|
|
|
|
*
|
|
|
|
|
* @param param GetDatabaseInfoResult
|
|
|
|
|
*/
|
|
|
|
|
public void setGetDatabaseInfoResult(ArrayOfString param) {
|
|
|
|
|
localGetDatabaseInfoResultTracker = param != null;
|
|
|
|
|
|
|
|
|
|
this.localGetDatabaseInfoResult = param;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param parentQName
|
|
|
|
|
* @param factory
|
|
|
|
|
* @return org.apache.axiom.om.OMElement
|
|
|
|
|
*/
|
|
|
|
|
public org.apache.axiom.om.OMElement getOMElement(
|
|
|
|
|
final QName parentQName,
|
|
|
|
|
final org.apache.axiom.om.OMFactory factory)
|
|
|
|
|
throws org.apache.axis2.databinding.ADBException {
|
|
|
|
|
return factory.createOMElement(new org.apache.axis2.databinding.ADBDataSource(
|
|
|
|
|
this, MY_QNAME), parentQName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void serialize(final QName parentQName,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter)
|
|
|
|
|
throws XMLStreamException,
|
|
|
|
|
org.apache.axis2.databinding.ADBException {
|
|
|
|
|
serialize(parentQName, xmlWriter, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void serialize(final QName parentQName,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType)
|
|
|
|
|
throws 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://WebXml.com.cn/");
|
|
|
|
|
|
|
|
|
|
if ((namespacePrefix != null) &&
|
|
|
|
|
(namespacePrefix.trim().length() > 0)) {
|
|
|
|
|
writeAttribute("xsi",
|
|
|
|
|
"http://www.w3.org/2001/XMLSchema-instance", "type",
|
|
|
|
|
namespacePrefix + ":getDatabaseInfoResponse", xmlWriter);
|
|
|
|
|
} else {
|
|
|
|
|
writeAttribute("xsi",
|
|
|
|
|
"http://www.w3.org/2001/XMLSchema-instance", "type",
|
|
|
|
|
"getDatabaseInfoResponse", xmlWriter);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (localGetDatabaseInfoResultTracker) {
|
|
|
|
|
if (localGetDatabaseInfoResult == null) {
|
|
|
|
|
throw new org.apache.axis2.databinding.ADBException(
|
|
|
|
|
"getDatabaseInfoResult cannot be null!!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
localGetDatabaseInfoResult.serialize(new QName(
|
|
|
|
|
"http://WebXml.com.cn/", "getDatabaseInfoResult"),
|
|
|
|
|
xmlWriter);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
xmlWriter.writeEndElement();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static java.lang.String generatePrefix(
|
|
|
|
|
java.lang.String namespace) {
|
|
|
|
|
if (namespace.equals("http://WebXml.com.cn/")) {
|
|
|
|
|
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 XMLStreamException {
|
|
|
|
|
java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
|
|
|
|
|
|
|
|
|
|
if (writerPrefix != null) {
|
|
|
|
|
xmlWriter.writeStartElement(writerPrefix, localPart, namespace);
|
|
|
|
|
} 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 XMLStreamException {
|
|
|
|
|
java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
|
|
|
|
|
|
|
|
|
|
if (writerPrefix != null) {
|
|
|
|
|
xmlWriter.writeAttribute(writerPrefix, namespace, attName,
|
|
|
|
|
attValue);
|
|
|
|
|
} else {
|
|
|
|
|
xmlWriter.writeNamespace(prefix, namespace);
|
|
|
|
|
xmlWriter.setPrefix(prefix, namespace);
|
|
|
|
|
xmlWriter.writeAttribute(prefix, 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 XMLStreamException {
|
|
|
|
|
if (namespace.equals("")) {
|
|
|
|
|
xmlWriter.writeAttribute(attName, attValue);
|
|
|
|
|
} else {
|
|
|
|
|
xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace),
|
|
|
|
|
namespace, attName, attValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Util method to write an attribute without the ns prefix
|
|
|
|
|
*/
|
|
|
|
|
private void writeQNameAttribute(java.lang.String namespace,
|
|
|
|
|
java.lang.String attName, QName qname,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter)
|
|
|
|
|
throws 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(attributePrefix, namespace, attName,
|
|
|
|
|
attributeValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* method to handle Qnames
|
|
|
|
|
*/
|
|
|
|
|
private void writeQName(QName qname,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter)
|
|
|
|
|
throws 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(QName[] qnames,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter)
|
|
|
|
|
throws 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
|
|
|
|
|
StringBuffer stringToWrite = new 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 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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Factory class that keeps the parse method
|
|
|
|
|
*/
|
|
|
|
|
public static class Factory {
|
|
|
|
|
private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Factory.class);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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 GetDatabaseInfoResponse parse(
|
|
|
|
|
XMLStreamReader reader)
|
|
|
|
|
throws Exception {
|
|
|
|
|
GetDatabaseInfoResponse object = new GetDatabaseInfoResponse();
|
|
|
|
|
|
|
|
|
|
int event;
|
|
|
|
|
QName currentQName = null;
|
|
|
|
|
java.lang.String nillableValue = null;
|
|
|
|
|
java.lang.String prefix = "";
|
|
|
|
|
java.lang.String namespaceuri = "";
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
while (!reader.isStartElement() && !reader.isEndElement())
|
|
|
|
|
reader.next();
|
|
|
|
|
|
|
|
|
|
currentQName = reader.getName();
|
|
|
|
|
|
|
|
|
|
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 (!"getDatabaseInfoResponse".equals(type)) {
|
|
|
|
|
//find namespace for the prefix
|
|
|
|
|
java.lang.String nsUri = reader.getNamespaceContext()
|
|
|
|
|
.getNamespaceURI(nsPrefix);
|
|
|
|
|
|
|
|
|
|
return (GetDatabaseInfoResponse) 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 QName(
|
|
|
|
|
"http://WebXml.com.cn/", "getDatabaseInfoResult").equals(
|
|
|
|
|
reader.getName())) ||
|
|
|
|
|
new QName("",
|
|
|
|
|
"getDatabaseInfoResult").equals(
|
|
|
|
|
reader.getName())) {
|
|
|
|
|
object.setGetDatabaseInfoResult(ArrayOfString.Factory.parse(
|
|
|
|
|
reader));
|
|
|
|
|
|
|
|
|
|
reader.next();
|
|
|
|
|
} // End of if for expected property start element
|
|
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (!reader.isStartElement() && !reader.isEndElement())
|
|
|
|
|
reader.next();
|
|
|
|
|
|
|
|
|
|
if (reader.isStartElement()) {
|
|
|
|
|
// 2 - A start element we are not expecting indicates a trailing invalid property
|
|
|
|
|
throw new org.apache.axis2.databinding.ADBException(
|
|
|
|
|
"Unexpected subelement " + reader.getName());
|
|
|
|
|
}
|
|
|
|
|
} catch (XMLStreamException e) {
|
|
|
|
|
throw new Exception(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return object;
|
|
|
|
|
}
|
|
|
|
|
} //end of factory class
|
|
|
|
|
|
|
|
|
|
public XMLStreamReader getPullParser(QName arg0)
|
|
|
|
|
throws XMLStreamException {
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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://WebXml.com.cn/
|
|
|
|
|
Namespace Prefix = ns1
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* field for String
|
|
|
|
|
* This was an Array!
|
|
|
|
|
*/
|
|
|
|
|
protected java.lang.String[] localString;
|
|
|
|
|
|
|
|
|
|
/* 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 localStringTracker = false;
|
|
|
|
|
|
|
|
|
|
public boolean isStringSpecified() {
|
|
|
|
|
return localStringTracker;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Auto generated getter method
|
|
|
|
|
*
|
|
|
|
|
* @return java.lang.String[]
|
|
|
|
|
*/
|
|
|
|
|
public java.lang.String[] getString() {
|
|
|
|
|
return localString;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* validate the array for String
|
|
|
|
|
*/
|
|
|
|
|
protected void validateString(java.lang.String[] param) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Auto generated setter method
|
|
|
|
|
*
|
|
|
|
|
* @param param String
|
|
|
|
|
*/
|
|
|
|
|
public void setString(java.lang.String[] param) {
|
|
|
|
|
validateString(param);
|
|
|
|
|
|
|
|
|
|
localStringTracker = true;
|
|
|
|
|
|
|
|
|
|
this.localString = param;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Auto generated add method for the array for convenience
|
|
|
|
|
*
|
|
|
|
|
* @param param java.lang.String
|
|
|
|
|
*/
|
|
|
|
|
public void addString(java.lang.String param) {
|
|
|
|
|
if (localString == null) {
|
|
|
|
|
localString = new java.lang.String[]{};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//update the setting tracker
|
|
|
|
|
localStringTracker = true;
|
|
|
|
|
|
|
|
|
|
java.util.List list = org.apache.axis2.databinding.utils.ConverterUtil.toList(localString);
|
|
|
|
|
list.add(param);
|
|
|
|
|
this.localString = (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 QName parentQName,
|
|
|
|
|
final org.apache.axiom.om.OMFactory factory)
|
|
|
|
|
throws org.apache.axis2.databinding.ADBException {
|
|
|
|
|
return factory.createOMElement(new org.apache.axis2.databinding.ADBDataSource(
|
|
|
|
|
this, parentQName), parentQName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void serialize(final QName parentQName,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter)
|
|
|
|
|
throws XMLStreamException,
|
|
|
|
|
org.apache.axis2.databinding.ADBException {
|
|
|
|
|
serialize(parentQName, xmlWriter, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void serialize(final QName parentQName,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType)
|
|
|
|
|
throws 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://WebXml.com.cn/");
|
|
|
|
|
|
|
|
|
|
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 (localStringTracker) {
|
|
|
|
|
if (localString != null) {
|
|
|
|
|
namespace = "http://WebXml.com.cn/";
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < localString.length; i++) {
|
|
|
|
|
if (localString[i] != null) {
|
|
|
|
|
writeStartElement(null, namespace, "string",
|
|
|
|
|
xmlWriter);
|
|
|
|
|
|
|
|
|
|
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
|
|
|
|
|
localString[i]));
|
|
|
|
|
|
|
|
|
|
xmlWriter.writeEndElement();
|
|
|
|
|
} else {
|
|
|
|
|
// write null attribute
|
|
|
|
|
namespace = "http://WebXml.com.cn/";
|
|
|
|
|
writeStartElement(null, namespace, "string",
|
|
|
|
|
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://WebXml.com.cn/", "string",
|
|
|
|
|
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://WebXml.com.cn/")) {
|
|
|
|
|
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 XMLStreamException {
|
|
|
|
|
java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
|
|
|
|
|
|
|
|
|
|
if (writerPrefix != null) {
|
|
|
|
|
xmlWriter.writeStartElement(writerPrefix, localPart, namespace);
|
|
|
|
|
} 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 XMLStreamException {
|
|
|
|
|
java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
|
|
|
|
|
|
|
|
|
|
if (writerPrefix != null) {
|
|
|
|
|
xmlWriter.writeAttribute(writerPrefix, namespace, attName,
|
|
|
|
|
attValue);
|
|
|
|
|
} else {
|
|
|
|
|
xmlWriter.writeNamespace(prefix, namespace);
|
|
|
|
|
xmlWriter.setPrefix(prefix, namespace);
|
|
|
|
|
xmlWriter.writeAttribute(prefix, 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 XMLStreamException {
|
|
|
|
|
if (namespace.equals("")) {
|
|
|
|
|
xmlWriter.writeAttribute(attName, attValue);
|
|
|
|
|
} else {
|
|
|
|
|
xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace),
|
|
|
|
|
namespace, attName, attValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Util method to write an attribute without the ns prefix
|
|
|
|
|
*/
|
|
|
|
|
private void writeQNameAttribute(java.lang.String namespace,
|
|
|
|
|
java.lang.String attName, QName qname,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter)
|
|
|
|
|
throws 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(attributePrefix, namespace, attName,
|
|
|
|
|
attributeValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* method to handle Qnames
|
|
|
|
|
*/
|
|
|
|
|
private void writeQName(QName qname,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter)
|
|
|
|
|
throws 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(QName[] qnames,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter)
|
|
|
|
|
throws 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
|
|
|
|
|
StringBuffer stringToWrite = new 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 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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Factory class that keeps the parse method
|
|
|
|
|
*/
|
|
|
|
|
public static class Factory {
|
|
|
|
|
private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Factory.class);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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(
|
|
|
|
|
XMLStreamReader reader)
|
|
|
|
|
throws Exception {
|
|
|
|
|
ArrayOfString object = new ArrayOfString();
|
|
|
|
|
|
|
|
|
|
int event;
|
|
|
|
|
QName currentQName = null;
|
|
|
|
|
java.lang.String nillableValue = null;
|
|
|
|
|
java.lang.String prefix = "";
|
|
|
|
|
java.lang.String namespaceuri = "";
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
while (!reader.isStartElement() && !reader.isEndElement())
|
|
|
|
|
reader.next();
|
|
|
|
|
|
|
|
|
|
currentQName = reader.getName();
|
|
|
|
|
|
|
|
|
|
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 QName(
|
|
|
|
|
"http://WebXml.com.cn/", "string").equals(
|
|
|
|
|
reader.getName())) ||
|
|
|
|
|
new QName("", "string").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 QName(
|
|
|
|
|
"http://WebXml.com.cn/", "string").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.setString((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()) {
|
|
|
|
|
// 2 - A start element we are not expecting indicates a trailing invalid property
|
|
|
|
|
throw new org.apache.axis2.databinding.ADBException(
|
|
|
|
|
"Unexpected subelement " + reader.getName());
|
|
|
|
|
}
|
|
|
|
|
} catch (XMLStreamException e) {
|
|
|
|
|
throw new Exception(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return object;
|
|
|
|
|
}
|
|
|
|
|
} //end of factory class
|
|
|
|
|
|
|
|
|
|
public XMLStreamReader getPullParser(QName arg0)
|
|
|
|
|
throws XMLStreamException {
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class GetMobileCodeInfoResponse implements org.apache.axis2.databinding.ADBBean {
|
|
|
|
|
public static final QName MY_QNAME = new QName("http://WebXml.com.cn/",
|
|
|
|
|
"getMobileCodeInfoResponse", "ns1");
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* field for GetMobileCodeInfoResult
|
|
|
|
|
*/
|
|
|
|
|
protected java.lang.String localGetMobileCodeInfoResult;
|
|
|
|
|
|
|
|
|
|
/* 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 localGetMobileCodeInfoResultTracker = false;
|
|
|
|
|
|
|
|
|
|
public boolean isGetMobileCodeInfoResultSpecified() {
|
|
|
|
|
return localGetMobileCodeInfoResultTracker;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Auto generated getter method
|
|
|
|
|
*
|
|
|
|
|
* @return java.lang.String
|
|
|
|
|
*/
|
|
|
|
|
public java.lang.String getGetMobileCodeInfoResult() {
|
|
|
|
|
return localGetMobileCodeInfoResult;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Auto generated setter method
|
|
|
|
|
*
|
|
|
|
|
* @param param GetMobileCodeInfoResult
|
|
|
|
|
*/
|
|
|
|
|
public void setGetMobileCodeInfoResult(java.lang.String param) {
|
|
|
|
|
localGetMobileCodeInfoResultTracker = param != null;
|
|
|
|
|
|
|
|
|
|
this.localGetMobileCodeInfoResult = param;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param parentQName
|
|
|
|
|
* @param factory
|
|
|
|
|
* @return org.apache.axiom.om.OMElement
|
|
|
|
|
*/
|
|
|
|
|
public org.apache.axiom.om.OMElement getOMElement(
|
|
|
|
|
final QName parentQName,
|
|
|
|
|
final org.apache.axiom.om.OMFactory factory)
|
|
|
|
|
throws org.apache.axis2.databinding.ADBException {
|
|
|
|
|
return factory.createOMElement(new org.apache.axis2.databinding.ADBDataSource(
|
|
|
|
|
this, MY_QNAME), parentQName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void serialize(final QName parentQName,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter)
|
|
|
|
|
throws XMLStreamException,
|
|
|
|
|
org.apache.axis2.databinding.ADBException {
|
|
|
|
|
serialize(parentQName, xmlWriter, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void serialize(final QName parentQName,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType)
|
|
|
|
|
throws 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://WebXml.com.cn/");
|
|
|
|
|
|
|
|
|
|
if ((namespacePrefix != null) &&
|
|
|
|
|
(namespacePrefix.trim().length() > 0)) {
|
|
|
|
|
writeAttribute("xsi",
|
|
|
|
|
"http://www.w3.org/2001/XMLSchema-instance", "type",
|
|
|
|
|
namespacePrefix + ":getMobileCodeInfoResponse",
|
|
|
|
|
xmlWriter);
|
|
|
|
|
} else {
|
|
|
|
|
writeAttribute("xsi",
|
|
|
|
|
"http://www.w3.org/2001/XMLSchema-instance", "type",
|
|
|
|
|
"getMobileCodeInfoResponse", xmlWriter);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (localGetMobileCodeInfoResultTracker) {
|
|
|
|
|
namespace = "http://WebXml.com.cn/";
|
|
|
|
|
writeStartElement(null, namespace, "getMobileCodeInfoResult",
|
|
|
|
|
xmlWriter);
|
|
|
|
|
|
|
|
|
|
if (localGetMobileCodeInfoResult == null) {
|
|
|
|
|
// write the nil attribute
|
|
|
|
|
throw new org.apache.axis2.databinding.ADBException(
|
|
|
|
|
"getMobileCodeInfoResult cannot be null!!");
|
|
|
|
|
} else {
|
|
|
|
|
xmlWriter.writeCharacters(localGetMobileCodeInfoResult);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
xmlWriter.writeEndElement();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
xmlWriter.writeEndElement();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static java.lang.String generatePrefix(
|
|
|
|
|
java.lang.String namespace) {
|
|
|
|
|
if (namespace.equals("http://WebXml.com.cn/")) {
|
|
|
|
|
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 XMLStreamException {
|
|
|
|
|
java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
|
|
|
|
|
|
|
|
|
|
if (writerPrefix != null) {
|
|
|
|
|
xmlWriter.writeStartElement(writerPrefix, localPart, namespace);
|
|
|
|
|
} 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 XMLStreamException {
|
|
|
|
|
java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
|
|
|
|
|
|
|
|
|
|
if (writerPrefix != null) {
|
|
|
|
|
xmlWriter.writeAttribute(writerPrefix, namespace, attName,
|
|
|
|
|
attValue);
|
|
|
|
|
} else {
|
|
|
|
|
xmlWriter.writeNamespace(prefix, namespace);
|
|
|
|
|
xmlWriter.setPrefix(prefix, namespace);
|
|
|
|
|
xmlWriter.writeAttribute(prefix, 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 XMLStreamException {
|
|
|
|
|
if (namespace.equals("")) {
|
|
|
|
|
xmlWriter.writeAttribute(attName, attValue);
|
|
|
|
|
} else {
|
|
|
|
|
xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace),
|
|
|
|
|
namespace, attName, attValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Util method to write an attribute without the ns prefix
|
|
|
|
|
*/
|
|
|
|
|
private void writeQNameAttribute(java.lang.String namespace,
|
|
|
|
|
java.lang.String attName, QName qname,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter)
|
|
|
|
|
throws 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(attributePrefix, namespace, attName,
|
|
|
|
|
attributeValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* method to handle Qnames
|
|
|
|
|
*/
|
|
|
|
|
private void writeQName(QName qname,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter)
|
|
|
|
|
throws 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(QName[] qnames,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter)
|
|
|
|
|
throws 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
|
|
|
|
|
StringBuffer stringToWrite = new 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 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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Factory class that keeps the parse method
|
|
|
|
|
*/
|
|
|
|
|
public static class Factory {
|
|
|
|
|
private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Factory.class);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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 GetMobileCodeInfoResponse parse(
|
|
|
|
|
XMLStreamReader reader)
|
|
|
|
|
throws Exception {
|
|
|
|
|
GetMobileCodeInfoResponse object = new GetMobileCodeInfoResponse();
|
|
|
|
|
|
|
|
|
|
int event;
|
|
|
|
|
QName currentQName = null;
|
|
|
|
|
java.lang.String nillableValue = null;
|
|
|
|
|
java.lang.String prefix = "";
|
|
|
|
|
java.lang.String namespaceuri = "";
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
while (!reader.isStartElement() && !reader.isEndElement())
|
|
|
|
|
reader.next();
|
|
|
|
|
|
|
|
|
|
currentQName = reader.getName();
|
|
|
|
|
|
|
|
|
|
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 (!"getMobileCodeInfoResponse".equals(type)) {
|
|
|
|
|
//find namespace for the prefix
|
|
|
|
|
java.lang.String nsUri = reader.getNamespaceContext()
|
|
|
|
|
.getNamespaceURI(nsPrefix);
|
|
|
|
|
|
|
|
|
|
return (GetMobileCodeInfoResponse) 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 QName(
|
|
|
|
|
"http://WebXml.com.cn/",
|
|
|
|
|
"getMobileCodeInfoResult").equals(
|
|
|
|
|
reader.getName())) ||
|
|
|
|
|
new QName("",
|
|
|
|
|
"getMobileCodeInfoResult").equals(
|
|
|
|
|
reader.getName())) {
|
|
|
|
|
nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
|
|
|
|
|
"nil");
|
|
|
|
|
|
|
|
|
|
if ("true".equals(nillableValue) ||
|
|
|
|
|
"1".equals(nillableValue)) {
|
|
|
|
|
throw new org.apache.axis2.databinding.ADBException(
|
|
|
|
|
"The element: " + "getMobileCodeInfoResult" +
|
|
|
|
|
" cannot be null");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
java.lang.String content = reader.getElementText();
|
|
|
|
|
|
|
|
|
|
object.setGetMobileCodeInfoResult(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
|
|
|
|
|
content));
|
|
|
|
|
|
|
|
|
|
reader.next();
|
|
|
|
|
} // End of if for expected property start element
|
|
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (!reader.isStartElement() && !reader.isEndElement())
|
|
|
|
|
reader.next();
|
|
|
|
|
|
|
|
|
|
if (reader.isStartElement()) {
|
|
|
|
|
// 2 - A start element we are not expecting indicates a trailing invalid property
|
|
|
|
|
throw new org.apache.axis2.databinding.ADBException(
|
|
|
|
|
"Unexpected subelement " + reader.getName());
|
|
|
|
|
}
|
|
|
|
|
} catch (XMLStreamException e) {
|
|
|
|
|
throw new Exception(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return object;
|
|
|
|
|
}
|
|
|
|
|
} //end of factory class
|
|
|
|
|
|
|
|
|
|
public XMLStreamReader getPullParser(QName arg0)
|
|
|
|
|
throws XMLStreamException {
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class GetMobileCodeInfo implements org.apache.axis2.databinding.ADBBean {
|
|
|
|
|
public static final QName MY_QNAME = new QName("http://WebXml.com.cn/",
|
|
|
|
|
"getMobileCodeInfo", "ns1");
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* field for MobileCode
|
|
|
|
|
*/
|
|
|
|
|
protected java.lang.String localMobileCode;
|
|
|
|
|
|
|
|
|
|
/* 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 localMobileCodeTracker = false;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* field for UserID
|
|
|
|
|
*/
|
|
|
|
|
protected java.lang.String localUserID;
|
|
|
|
|
|
|
|
|
|
/* 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 localUserIDTracker = false;
|
|
|
|
|
|
|
|
|
|
public boolean isMobileCodeSpecified() {
|
|
|
|
|
return localMobileCodeTracker;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Auto generated getter method
|
|
|
|
|
*
|
|
|
|
|
* @return java.lang.String
|
|
|
|
|
*/
|
|
|
|
|
public java.lang.String getMobileCode() {
|
|
|
|
|
return localMobileCode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Auto generated setter method
|
|
|
|
|
*
|
|
|
|
|
* @param param MobileCode
|
|
|
|
|
*/
|
|
|
|
|
public void setMobileCode(java.lang.String param) {
|
|
|
|
|
localMobileCodeTracker = param != null;
|
|
|
|
|
|
|
|
|
|
this.localMobileCode = param;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isUserIDSpecified() {
|
|
|
|
|
return localUserIDTracker;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Auto generated getter method
|
|
|
|
|
*
|
|
|
|
|
* @return java.lang.String
|
|
|
|
|
*/
|
|
|
|
|
public java.lang.String getUserID() {
|
|
|
|
|
return localUserID;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Auto generated setter method
|
|
|
|
|
*
|
|
|
|
|
* @param param UserID
|
|
|
|
|
*/
|
|
|
|
|
public void setUserID(java.lang.String param) {
|
|
|
|
|
localUserIDTracker = param != null;
|
|
|
|
|
|
|
|
|
|
this.localUserID = param;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param parentQName
|
|
|
|
|
* @param factory
|
|
|
|
|
* @return org.apache.axiom.om.OMElement
|
|
|
|
|
*/
|
|
|
|
|
public org.apache.axiom.om.OMElement getOMElement(
|
|
|
|
|
final QName parentQName,
|
|
|
|
|
final org.apache.axiom.om.OMFactory factory)
|
|
|
|
|
throws org.apache.axis2.databinding.ADBException {
|
|
|
|
|
return factory.createOMElement(new org.apache.axis2.databinding.ADBDataSource(
|
|
|
|
|
this, MY_QNAME), parentQName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void serialize(final QName parentQName,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter)
|
|
|
|
|
throws XMLStreamException,
|
|
|
|
|
org.apache.axis2.databinding.ADBException {
|
|
|
|
|
serialize(parentQName, xmlWriter, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void serialize(final QName parentQName,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType)
|
|
|
|
|
throws 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://WebXml.com.cn/");
|
|
|
|
|
|
|
|
|
|
if ((namespacePrefix != null) &&
|
|
|
|
|
(namespacePrefix.trim().length() > 0)) {
|
|
|
|
|
writeAttribute("xsi",
|
|
|
|
|
"http://www.w3.org/2001/XMLSchema-instance", "type",
|
|
|
|
|
namespacePrefix + ":getMobileCodeInfo", xmlWriter);
|
|
|
|
|
} else {
|
|
|
|
|
writeAttribute("xsi",
|
|
|
|
|
"http://www.w3.org/2001/XMLSchema-instance", "type",
|
|
|
|
|
"getMobileCodeInfo", xmlWriter);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (localMobileCodeTracker) {
|
|
|
|
|
namespace = "http://WebXml.com.cn/";
|
|
|
|
|
writeStartElement(null, namespace, "mobileCode", xmlWriter);
|
|
|
|
|
|
|
|
|
|
if (localMobileCode == null) {
|
|
|
|
|
// write the nil attribute
|
|
|
|
|
throw new org.apache.axis2.databinding.ADBException(
|
|
|
|
|
"mobileCode cannot be null!!");
|
|
|
|
|
} else {
|
|
|
|
|
xmlWriter.writeCharacters(localMobileCode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
xmlWriter.writeEndElement();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (localUserIDTracker) {
|
|
|
|
|
namespace = "http://WebXml.com.cn/";
|
|
|
|
|
writeStartElement(null, namespace, "userID", xmlWriter);
|
|
|
|
|
|
|
|
|
|
if (localUserID == null) {
|
|
|
|
|
// write the nil attribute
|
|
|
|
|
throw new org.apache.axis2.databinding.ADBException(
|
|
|
|
|
"userID cannot be null!!");
|
|
|
|
|
} else {
|
|
|
|
|
xmlWriter.writeCharacters(localUserID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
xmlWriter.writeEndElement();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
xmlWriter.writeEndElement();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static java.lang.String generatePrefix(
|
|
|
|
|
java.lang.String namespace) {
|
|
|
|
|
if (namespace.equals("http://WebXml.com.cn/")) {
|
|
|
|
|
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 XMLStreamException {
|
|
|
|
|
java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
|
|
|
|
|
|
|
|
|
|
if (writerPrefix != null) {
|
|
|
|
|
xmlWriter.writeStartElement(writerPrefix, localPart, namespace);
|
|
|
|
|
} 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 XMLStreamException {
|
|
|
|
|
java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
|
|
|
|
|
|
|
|
|
|
if (writerPrefix != null) {
|
|
|
|
|
xmlWriter.writeAttribute(writerPrefix, namespace, attName,
|
|
|
|
|
attValue);
|
|
|
|
|
} else {
|
|
|
|
|
xmlWriter.writeNamespace(prefix, namespace);
|
|
|
|
|
xmlWriter.setPrefix(prefix, namespace);
|
|
|
|
|
xmlWriter.writeAttribute(prefix, 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 XMLStreamException {
|
|
|
|
|
if (namespace.equals("")) {
|
|
|
|
|
xmlWriter.writeAttribute(attName, attValue);
|
|
|
|
|
} else {
|
|
|
|
|
xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace),
|
|
|
|
|
namespace, attName, attValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Util method to write an attribute without the ns prefix
|
|
|
|
|
*/
|
|
|
|
|
private void writeQNameAttribute(java.lang.String namespace,
|
|
|
|
|
java.lang.String attName, QName qname,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter)
|
|
|
|
|
throws 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(attributePrefix, namespace, attName,
|
|
|
|
|
attributeValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* method to handle Qnames
|
|
|
|
|
*/
|
|
|
|
|
private void writeQName(QName qname,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter)
|
|
|
|
|
throws 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(QName[] qnames,
|
|
|
|
|
javax.xml.stream.XMLStreamWriter xmlWriter)
|
|
|
|
|
throws 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
|
|
|
|
|
StringBuffer stringToWrite = new 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 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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Factory class that keeps the parse method
|
|
|
|
|
*/
|
|
|
|
|
public static class Factory {
|
|
|
|
|
private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Factory.class);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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 GetMobileCodeInfo parse(
|
|
|
|
|
XMLStreamReader reader)
|
|
|
|
|
throws Exception {
|
|
|
|
|
GetMobileCodeInfo object = new GetMobileCodeInfo();
|
|
|
|
|
|
|
|
|
|
int event;
|
|
|
|
|
QName currentQName = null;
|
|
|
|
|
java.lang.String nillableValue = null;
|
|
|
|
|
java.lang.String prefix = "";
|
|
|
|
|
java.lang.String namespaceuri = "";
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
while (!reader.isStartElement() && !reader.isEndElement())
|
|
|
|
|
reader.next();
|
|
|
|
|
|
|
|
|
|
currentQName = reader.getName();
|
|
|
|
|
|
|
|
|
|
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 (!"getMobileCodeInfo".equals(type)) {
|
|
|
|
|
//find namespace for the prefix
|
|
|
|
|
java.lang.String nsUri = reader.getNamespaceContext()
|
|
|
|
|
.getNamespaceURI(nsPrefix);
|
|
|
|
|
|
|
|
|
|
return (GetMobileCodeInfo) 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 QName(
|
|
|
|
|
"http://WebXml.com.cn/", "mobileCode").equals(
|
|
|
|
|
reader.getName())) ||
|
|
|
|
|
new QName("", "mobileCode").equals(
|
|
|
|
|
reader.getName())) {
|
|
|
|
|
nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
|
|
|
|
|
"nil");
|
|
|
|
|
|
|
|
|
|
if ("true".equals(nillableValue) ||
|
|
|
|
|
"1".equals(nillableValue)) {
|
|
|
|
|
throw new org.apache.axis2.databinding.ADBException(
|
|
|
|
|
"The element: " + "mobileCode" +
|
|
|
|
|
" cannot be null");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
java.lang.String content = reader.getElementText();
|
|
|
|
|
|
|
|
|
|
object.setMobileCode(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
|
|
|
|
|
content));
|
|
|
|
|
|
|
|
|
|
reader.next();
|
|
|
|
|
} // End of if for expected property start element
|
|
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (!reader.isStartElement() && !reader.isEndElement())
|
|
|
|
|
reader.next();
|
|
|
|
|
|
|
|
|
|
if ((reader.isStartElement() &&
|
|
|
|
|
new QName(
|
|
|
|
|
"http://WebXml.com.cn/", "userID").equals(
|
|
|
|
|
reader.getName())) ||
|
|
|
|
|
new QName("", "userID").equals(
|
|
|
|
|
reader.getName())) {
|
|
|
|
|
nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
|
|
|
|
|
"nil");
|
|
|
|
|
|
|
|
|
|
if ("true".equals(nillableValue) ||
|
|
|
|
|
"1".equals(nillableValue)) {
|
|
|
|
|
throw new org.apache.axis2.databinding.ADBException(
|
|
|
|
|
"The element: " + "userID" +
|
|
|
|
|
" cannot be null");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
java.lang.String content = reader.getElementText();
|
|
|
|
|
|
|
|
|
|
object.setUserID(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
|
|
|
|
|
content));
|
|
|
|
|
|
|
|
|
|
reader.next();
|
|
|
|
|
} // End of if for expected property start element
|
|
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (!reader.isStartElement() && !reader.isEndElement())
|
|
|
|
|
reader.next();
|
|
|
|
|
|
|
|
|
|
if (reader.isStartElement()) {
|
|
|
|
|
// 2 - A start element we are not expecting indicates a trailing invalid property
|
|
|
|
|
throw new org.apache.axis2.databinding.ADBException(
|
|
|
|
|
"Unexpected subelement " + reader.getName());
|
|
|
|
|
}
|
|
|
|
|
} catch (XMLStreamException e) {
|
|
|
|
|
throw new Exception(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return object;
|
|
|
|
|
}
|
|
|
|
|
} //end of factory class
|
|
|
|
|
|
|
|
|
|
public XMLStreamReader getPullParser(QName arg0)
|
|
|
|
|
throws XMLStreamException {
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|