You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Deepal Jayasinghe (JIRA)" <ji...@apache.org> on 2006/10/25 05:29:18 UTC
[jira] Resolved: (AXIS2-1305) Error in Client Stub when Service
class and User define data types (bean classes) are in different packages.
[ http://issues.apache.org/jira/browse/AXIS2-1305?page=all ]
Deepal Jayasinghe resolved AXIS2-1305.
--------------------------------------
Resolution: Fixed
Fixed in current SVN
> Error in Client Stub when Service class and User define data types (bean classes) are in different packages.
> ------------------------------------------------------------------------------------------------------------
>
> Key: AXIS2-1305
> URL: http://issues.apache.org/jira/browse/AXIS2-1305
> Project: Apache Axis 2.0 (Axis2)
> Issue Type: Bug
> Components: adb, rpc
> Affects Versions: nightly
> Environment: Windows XP (OS), Eclispe IDE, Apache Tomcat Web Server
> Reporter: Nimeshe Madanayake
> Attachments: NimeshService.rar, NimeshServiceClient.rar
>
>
> Created two Java Beans named User and ValidationResponse under package nimesh.beans
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------
> package nimesh.beans;
> /**
> * @author Nimeshe Madanayake
> * @since 21/09/2006
> * @version 1.0
> *
> */
> public class User {
> private String username;
> private String password;
>
> public User() {
> super();
> }
>
> public User(String username, String password) {
> this();
> this.username = username;
> this.password = password;
> }
> public String getUsername() {
> return username;
> }
>
> public void setUsername(String username) {
> this.username = username;
> }
>
> public String getPassword() {
> return password;
> }
>
> public void setPassword(String password) {
> this.password = password;
> }
>
> public boolean equals(Object obj){
> if((obj != null) && (obj instanceof User)){
> User user = (User)obj;
> if (this.username.equals(user.username)){
> return true;
> }
> else{
> return false;
> }
> }
> else{
> return false;
> }
> }
>
> public int hashcode(){
> return username.hashCode();
> }
> }
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------
> package nimesh.beans;
> /**
> * @author Nimeshe Madanayake
> * @since 22/09/2006
> * @version 1.0
> *
> */
> public class ValidateResponse{
> private boolean isValid;
> private String description;
>
> public boolean isValid() {
> return isValid;
> }
>
> public void setValid(boolean isValid) {
> this.isValid = isValid;
> }
>
> public String getDescription() {
> return description;
> }
>
> public void setDescription(String description) {
> this.description = description;
> }
> }
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
> Created the service class NimeshService under different package, nimesh.services
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------
> package nimesh.services;
> import nimesh.beans.User;
> import nimesh.beans.ValidateResponse;
> public class NimeshService {
>
> public ValidateResponse validateUser(User user){
>
> ValidateResponse validateResponse = new ValidateResponse();
>
> String username = user.getUsername();
> String password = user.getPassword();
>
> boolean b = false;
>
> if (username == null || username.equals("")){
> b = true;
> validateResponse.setValid(false);
> validateResponse.setDescription("The username cannot be blank");
> }
>
> if(!b){
> if (password == null || password.equals("")){
> b = true;
> validateResponse.setValid(false);
> validateResponse.setDescription("The password cannot be blank");
> }
> }
>
> if(!b){
> if (username.equals("nimeshe")){
> if (password.equals("welcome")){
> validateResponse.setValid(true);
> validateResponse.setDescription("Success!! Valid User Login.");
> }
> else{
> validateResponse.setValid(false);
> validateResponse.setDescription("Invalid Password");
> }
> }
> else{
> validateResponse.setValid(false);
> validateResponse.setDescription("Invalid username");
> }
> }
>
> return validateResponse;
> }
> }
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
> services.xml is as follows:
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------
> <service>
> <parameter name="ServiceClass"
> locked="false">nimesh.services.NimeshService</parameter>
> <operation name="validateUser">
> <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
> </operation>
> </service>
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------
> Created NimeshService.aar and deployed in $TOMCAT_HOME$\webapps\axis2\WEB-INF\services
> Created the client stubs using the wsdl path http://localhost:9090/axis2/services/NimeshService?wsdl
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
> /**
> * NimeshServiceStub.java
> *
> * This file was auto-generated from WSDL
> * by the Apache Axis2 version: SNAPSHOT Oct 02, 2006 (05:21:26 GMT+00:00)
> */
> package nimesh.client;
>
> /*
> * NimeshServiceStub java implementation
> */
>
> public class NimeshServiceStub extends org.apache.axis2.client.Stub
> {
> protected org.apache.axis2.description.AxisOperation[] _operations;
> //hashmaps to keep the fault mapping
> private java.util.HashMap faultExeptionNameMap = new java.util.HashMap();
> private java.util.HashMap faultExeptionClassNameMap = new java.util.HashMap();
> private java.util.HashMap faultMessageMap = new java.util.HashMap();
>
> private void populateAxisService() throws org.apache.axis2.AxisFault {
> //creating the Service with a unique name
> _service = new org.apache.axis2.description.AxisService("NimeshService" + this.hashCode());
>
>
> //creating the operations
> org.apache.axis2.description.AxisOperation __operation;
>
> _operations = new org.apache.axis2.description.AxisOperation[1];
>
> __operation = new org.apache.axis2.description.OutInAxisOperation();
>
> __operation.setName(new javax.xml.namespace.QName("", "validateUser"));
>
> _operations[0]=__operation;
> _service.addOperation(__operation);
>
> }
> //populates the faults
> private void populateFaults(){
>
> }
> /**
> Constructor that takes in a configContext
> */
> public NimeshServiceStub(org.apache.axis2.context.ConfigurationContext configurationContext,
> java.lang.String targetEndpoint)
> throws org.apache.axis2.AxisFault {
> //To populate AxisService
> populateAxisService();
> populateFaults();
> _serviceClient = new org.apache.axis2.client.ServiceClient(configurationContext,_service);
> configurationContext = _serviceClient.getServiceContext().getConfigurationContext();
> _serviceClient.getOptions().setTo(new org.apache.axis2.addressing.EndpointReference(
> targetEndpoint));
>
>
> }
> /**
> * Default Constructor
> */
> public NimeshServiceStub() throws org.apache.axis2.AxisFault {
>
> this("http://192.168.1.95:9090/axis2/services/NimeshService" );
>
> }
> /**
> * Constructor taking the target endpoint
> */
> public NimeshServiceStub(java.lang.String targetEndpoint) throws org.apache.axis2.AxisFault {
> this(null,targetEndpoint);
> }
>
> /**
> * Auto generated method signature
> * @see nimesh.client.NimeshService#validateUser
> * @param param2
>
> */
> public nimesh.client.NimeshServiceStub.ValidateUserResponse validateUser(
> nimesh.client.NimeshServiceStub.ValidateUser param2)
> throws java.rmi.RemoteException
>
> {
> try{
> org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0].getName());
> _operationClient.getOptions().setAction("urn:validateUser");
> _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
>
> // create SOAP envelope with that payload
> org.apache.axiom.soap.SOAPEnvelope env = null;
>
> //Style is Doc.
>
>
> env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),
> param2,
> optimizeContent(new javax.xml.namespace.QName("",
> "validateUser")));
>
> //adding SOAP headers
> _serviceClient.addHeadersToEnvelope(env);
> // create message context with that soap envelope
> org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext() ;
> _messageContext.setEnvelope(env);
> // add the message contxt to the operation client
> _operationClient.addMessageContext(_messageContext);
> //execute the operation client
> _operationClient.execute(true);
>
> org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext(
> org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
> org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();
>
>
> java.lang.Object object = fromOM(
> _returnEnv.getBody().getFirstElement() ,
> nimesh.client.NimeshServiceStub.ValidateUserResponse.class,
> getEnvelopeNamespaces(_returnEnv));
> _messageContext.getTransportOut().getSender().cleanup(_messageContext);
> return (nimesh.client.NimeshServiceStub.ValidateUserResponse)object;
>
> }catch(org.apache.axis2.AxisFault f){
> org.apache.axiom.om.OMElement faultElt = f.getDetail();
> if (faultElt!=null){
> if (faultExeptionNameMap.containsKey(faultElt.getQName())){
> //make the fault by reflection
> try{
> java.lang.String exceptionClassName = (java.lang.String)faultExeptionClassNameMap.get(faultElt.getQName());
> java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);
> java.lang.Exception ex=
> (java.lang.Exception) exceptionClass.newInstance();
> //message class
> java.lang.String messageClassName = (java.lang.String)faultMessageMap.get(faultElt.getQName());
> java.lang.Class messageClass = java.lang.Class.forName(messageClassName);
> java.lang.Object messageObject = fromOM(faultElt,messageClass,null);
> java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage",
> new java.lang.Class[]{messageClass});
> m.invoke(ex,new java.lang.Object[]{messageObject});
>
> throw new java.rmi.RemoteException(ex.getMessage(), ex);
> }catch(java.lang.ClassCastException e){
> // we cannot intantiate the class - throw the original Axis fault
> throw f;
> } catch (java.lang.ClassNotFoundException e) {
> // we cannot intantiate the class - throw the original Axis fault
> throw f;
> }catch (java.lang.NoSuchMethodException e) {
> // we cannot intantiate the class - throw the original Axis fault
> throw f;
> } catch (java.lang.reflect.InvocationTargetException e) {
> // we cannot intantiate the class - throw the original Axis fault
> throw f;
> } catch (java.lang.IllegalAccessException e) {
> // we cannot intantiate the class - throw the original Axis fault
> throw f;
> } catch (java.lang.InstantiationException e) {
> // we cannot intantiate the class - throw the original Axis fault
> throw f;
> }
> }else{
> throw f;
> }
> }else{
> throw f;
> }
> }
> }
>
> /**
> * Auto generated method signature for Asynchronous Invocations
> * @see nimesh.client.NimeshService#startvalidateUser
> * @param param2
>
> */
> public void startvalidateUser(
> nimesh.client.NimeshServiceStub.ValidateUser param2,final nimesh.client.NimeshServiceCallbackHandler callback)
> throws java.rmi.RemoteException{
> org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0].getName());
> _operationClient.getOptions().setAction("urn:validateUser");
> _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
>
> // create SOAP envelope with that payload
> org.apache.axiom.soap.SOAPEnvelope env=null;
>
> //Style is Doc.
>
>
> env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),
> param2,
> optimizeContent(new javax.xml.namespace.QName("",
> "validateUser")));
>
> //adding SOAP headers
> _serviceClient.addHeadersToEnvelope(env);
> // create message context with that soap envelope
> org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext() ;
> _messageContext.setEnvelope(env);
> // add the message contxt to the operation client
> _operationClient.addMessageContext(_messageContext);
>
> _operationClient.setCallback(new org.apache.axis2.client.async.Callback() {
> public void onComplete(
> org.apache.axis2.client.async.AsyncResult result) {
> java.lang.Object object = fromOM(result.getResponseEnvelope().getBody().getFirstElement(),
> nimesh.client.NimeshServiceStub.ValidateUserResponse.class,
> getEnvelopeNamespaces(result.getResponseEnvelope())
> );
> callback.receiveResultvalidateUser((nimesh.client.NimeshServiceStub.ValidateUserResponse) object);
> }
> public void onError(java.lang.Exception e) {
> callback.receiveErrorvalidateUser(e);
> }
> });
>
> 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);
> }
>
> /**
> * A utility method that copies the namepaces from the SOAPEnvelope
> */
> private java.util.Map getEnvelopeNamespaces(org.apache.axiom.soap.SOAPEnvelope env){
> java.util.Map returnMap = new java.util.HashMap();
> java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces();
> while (namespaceIterator.hasNext()) {
> org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next();
> returnMap.put(ns.getPrefix(),ns.getNamespaceURI());
> }
> return returnMap;
> }
>
>
> private javax.xml.namespace.QName[] opNameArray = null;
> private boolean optimizeContent(javax.xml.namespace.QName opName) {
>
> if (opNameArray == null) {
> return false;
> }
> for (int i = 0; i < opNameArray.length; i++) {
> if (opName.equals(opNameArray[i])) {
> return true;
> }
> }
> return false;
> }
>
>
> //http://192.168.1.95:9090/axis2/services/NimeshService
> public static class ExtensionMapper{
> public static java.lang.Object getTypeObject(java.lang.String namespaceURI,
> java.lang.String typeName,
> javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{
>
> if (
> "http://beans.nimesh/xsd".equals(namespaceURI) &&
> "ValidateResponse".equals(typeName)){
>
> return ValidateResponse.Factory.parse(reader);
>
> }
>
> if (
> "http://beans.nimesh/xsd".equals(namespaceURI) &&
> "User".equals(typeName)){
>
> return User.Factory.parse(reader);
>
> }
>
> throw new java.lang.RuntimeException("Unsupported type " + namespaceURI + " " + typeName);
> }
> }
>
> public static class User1
> implements org.apache.axis2.databinding.ADBBean{
>
> public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName(
> "http://beans.nimesh/xsd",
> "User",
> "ns1");
>
> /**
> * field for User
> */
> protected User localUser ;
>
> /**
> * Auto generated getter method
> * @return User
> */
> public User getUser(){
> return localUser;
> }
>
>
> /**
> * Auto generated setter method
> * @param param User
> */
> public void setUser(User param){
>
> this.localUser=param;
>
> }
>
>
>
> /**
> *
> * @param parentQName
> * @param factory
> * @return org.apache.axiom.om.OMElement
> */
> public org.apache.axiom.om.OMElement getOMElement(
> final javax.xml.namespace.QName parentQName,
> final org.apache.axiom.om.OMFactory factory){
> org.apache.axiom.om.OMDataSource dataSource =
> new org.apache.axis2.databinding.ADBDataSource(this,parentQName){
> public void serialize(
> javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
>
>
> //We can safely assume an element has only one type associated with it
>
> if (localUser==null){
> throw new RuntimeException("Property cannot be null!");
> }
> localUser.getOMElement(
> MY_QNAME,
> factory).serialize(xmlWriter);
>
> }
> /**
> * Util method to write an attribute with the ns prefix
> */
> private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName,
> java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
> if (xmlWriter.getPrefix(namespace) == null) {
> xmlWriter.writeNamespace(prefix, namespace);
> xmlWriter.setPrefix(prefix, namespace);
> }
> xmlWriter.writeAttribute(namespace,attName,attValue);
> }
> /**
> * Util method to write an attribute without the ns prefix
> */
> private void writeAttribute(java.lang.String namespace,java.lang.String attName,
> java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
> registerPrefix(xmlWriter, namespace);
> xmlWriter.writeAttribute(namespace,attName,attValue);
> }
> /**
> * Register a namespace prefix
> */
> private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException {
> java.lang.String prefix = xmlWriter.getPrefix(namespace);
> if (prefix == null) {
> prefix = createPrefix();
> while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) {
> prefix = createPrefix();
> }
> xmlWriter.writeNamespace(prefix, namespace);
> xmlWriter.setPrefix(prefix, namespace);
> }
> return prefix;
> }
> /**
> * Create a prefix
> */
> private java.lang.String createPrefix() {
> return "ns" + (int)Math.random();
> }
> };
>
> //ignore the QName passed in - we send only OUR QName!
> return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl(
> MY_QNAME,factory,dataSource);
>
> }
>
> /**
> * databinding method to get an XML representation of this object
> *
> */
> public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName){
>
>
> //We can safely assume an element has only one type associated with it
> return localUser.getPullParser(MY_QNAME);
> }
>
> /**
> * Factory class that keeps the parse method
> */
> public static class Factory{
> /**
> * static method to create the object
> * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable
> * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element
> * Postcondition: If this object is an element, the reader is positioned at its end element
> * If this object is a complex type, the reader is positioned at the end element of its outer element
> */
> public static User1 parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{
> User1 object = new User1();
> int event;
> try {
>
> while (!reader.isStartElement() && !reader.isEndElement())
> reader.next();
>
>
> // Note all attributes that were handled. Used to differ normal attributes
> // from anyAttributes.
> java.util.Vector handledAttributes = new java.util.Vector();
>
> boolean isReaderMTOMAware = false;
>
> try{
> isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE));
> }catch(java.lang.IllegalArgumentException e){
> isReaderMTOMAware = false;
> }
>
> while(!reader.isEndElement()) {
> if (reader.isStartElement() ){
>
> if (reader.isStartElement() && new javax.xml.namespace.QName("http://beans.nimesh/xsd","User").equals(reader.getName())){
>
> object.setUser(User.Factory.parse(reader));
>
> } // End of if for expected property start element
>
> else{
> // A start element we are not expecting indicates an invalid parameter was passed
> throw new java.lang.RuntimeException("Unexpected subelement " + reader.getLocalName());
> }
>
> } else reader.next();
> } // end of while loop
>
> } catch (javax.xml.stream.XMLStreamException e) {
> throw new java.lang.Exception(e);
> }
> return object;
> }
> }//end of factory class
>
> }
>
>
> public static class ValidateResponse0
> implements org.apache.axis2.databinding.ADBBean{
>
> public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName(
> "http://beans.nimesh/xsd",
> "ValidateResponse",
> "ns1");
>
> /**
> * field for ValidateResponse
> */
> protected ValidateResponse localValidateResponse ;
>
> /**
> * Auto generated getter method
> * @return ValidateResponse
> */
> public ValidateResponse getValidateResponse(){
> return localValidateResponse;
> }
>
>
> /**
> * Auto generated setter method
> * @param param ValidateResponse
> */
> public void setValidateResponse(ValidateResponse param){
>
> this.localValidateResponse=param;
>
> }
>
>
>
> /**
> *
> * @param parentQName
> * @param factory
> * @return org.apache.axiom.om.OMElement
> */
> public org.apache.axiom.om.OMElement getOMElement(
> final javax.xml.namespace.QName parentQName,
> final org.apache.axiom.om.OMFactory factory){
> org.apache.axiom.om.OMDataSource dataSource =
> new org.apache.axis2.databinding.ADBDataSource(this,parentQName){
> public void serialize(
> javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
>
>
> //We can safely assume an element has only one type associated with it
>
> if (localValidateResponse==null){
> throw new RuntimeException("Property cannot be null!");
> }
> localValidateResponse.getOMElement(
> MY_QNAME,
> factory).serialize(xmlWriter);
>
> }
> /**
> * Util method to write an attribute with the ns prefix
> */
> private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName,
> java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
> if (xmlWriter.getPrefix(namespace) == null) {
> xmlWriter.writeNamespace(prefix, namespace);
> xmlWriter.setPrefix(prefix, namespace);
> }
> xmlWriter.writeAttribute(namespace,attName,attValue);
> }
> /**
> * Util method to write an attribute without the ns prefix
> */
> private void writeAttribute(java.lang.String namespace,java.lang.String attName,
> java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
> registerPrefix(xmlWriter, namespace);
> xmlWriter.writeAttribute(namespace,attName,attValue);
> }
> /**
> * Register a namespace prefix
> */
> private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException {
> java.lang.String prefix = xmlWriter.getPrefix(namespace);
> if (prefix == null) {
> prefix = createPrefix();
> while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) {
> prefix = createPrefix();
> }
> xmlWriter.writeNamespace(prefix, namespace);
> xmlWriter.setPrefix(prefix, namespace);
> }
> return prefix;
> }
> /**
> * Create a prefix
> */
> private java.lang.String createPrefix() {
> return "ns" + (int)Math.random();
> }
> };
>
> //ignore the QName passed in - we send only OUR QName!
> return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl(
> MY_QNAME,factory,dataSource);
>
> }
>
> /**
> * databinding method to get an XML representation of this object
> *
> */
> public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName){
>
>
> //We can safely assume an element has only one type associated with it
> return localValidateResponse.getPullParser(MY_QNAME);
> }
>
> /**
> * Factory class that keeps the parse method
> */
> public static class Factory{
> /**
> * static method to create the object
> * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable
> * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element
> * Postcondition: If this object is an element, the reader is positioned at its end element
> * If this object is a complex type, the reader is positioned at the end element of its outer element
> */
> public static ValidateResponse0 parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{
> ValidateResponse0 object = new ValidateResponse0();
> int event;
> try {
>
> while (!reader.isStartElement() && !reader.isEndElement())
> reader.next();
>
>
> // Note all attributes that were handled. Used to differ normal attributes
> // from anyAttributes.
> java.util.Vector handledAttributes = new java.util.Vector();
>
> boolean isReaderMTOMAware = false;
>
> try{
> isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE));
> }catch(java.lang.IllegalArgumentException e){
> isReaderMTOMAware = false;
> }
>
> while(!reader.isEndElement()) {
> if (reader.isStartElement() ){
>
> if (reader.isStartElement() && new javax.xml.namespace.QName("http://beans.nimesh/xsd","ValidateResponse").equals(reader.getName())){
>
> object.setValidateResponse(ValidateResponse.Factory.parse(reader));
>
> } // End of if for expected property start element
>
> else{
> // A start element we are not expecting indicates an invalid parameter was passed
> throw new java.lang.RuntimeException("Unexpected subelement " + reader.getLocalName());
> }
>
> } else reader.next();
> } // end of while loop
>
> } catch (javax.xml.stream.XMLStreamException e) {
> throw new java.lang.Exception(e);
> }
> return object;
> }
> }//end of factory class
>
> }
>
>
> public static class ValidateResponse
> implements org.apache.axis2.databinding.ADBBean{
> /* This type was generated from the piece of schema that had
> name = ValidateResponse
> Namespace URI = http://beans.nimesh/xsd
> Namespace Prefix = ns1
> */
>
> /**
> * field for Description
> */
> protected java.lang.String localDescription ;
>
> /**
> * Auto generated getter method
> * @return java.lang.String
> */
> public java.lang.String getDescription(){
> return localDescription;
> }
>
>
> /**
> * Auto generated setter method
> * @param param Description
> */
> public void setDescription(java.lang.String param){
>
> this.localDescription=param;
>
> }
>
> /**
> * field for Valid
> */
> protected boolean localValid ;
>
> /**
> * Auto generated getter method
> * @return boolean
> */
> public boolean getValid(){
> return localValid;
> }
>
>
> /**
> * Auto generated setter method
> * @param param Valid
> */
> public void setValid(boolean param){
>
> this.localValid=param;
>
> }
>
>
>
> /**
> *
> * @param parentQName
> * @param factory
> * @return org.apache.axiom.om.OMElement
> */
> public org.apache.axiom.om.OMElement getOMElement(
> final javax.xml.namespace.QName parentQName,
> final org.apache.axiom.om.OMFactory factory){
> org.apache.axiom.om.OMDataSource dataSource =
> new org.apache.axis2.databinding.ADBDataSource(this,parentQName){
> public void serialize(
> javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
>
>
> java.lang.String prefix = parentQName.getPrefix();
> java.lang.String namespace = parentQName.getNamespaceURI();
> if (namespace != null) {
> java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
> if (writerPrefix != null) {
> xmlWriter.writeStartElement(namespace, parentQName.getLocalPart());
> } else {
> if (prefix == null) {
> prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
> }
> xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace);
> xmlWriter.writeNamespace(prefix, namespace);
> xmlWriter.setPrefix(prefix, namespace);
> }
> } else {
> xmlWriter.writeStartElement(parentQName.getLocalPart());
> }
>
>
> namespace = "http://beans.nimesh/xsd";
> if (! namespace.equals("")) {
> prefix = xmlWriter.getPrefix(namespace);
> if (prefix == null) {
> prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
> xmlWriter.writeStartElement(prefix,"description", namespace);
> xmlWriter.writeNamespace(prefix, namespace);
> xmlWriter.setPrefix(prefix, namespace);
> } else {
> xmlWriter.writeStartElement(namespace,"description");
> }
> } else {
> xmlWriter.writeStartElement("description");
> }
>
> if (localDescription==null){
> // write the nil attribute
> writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","true",xmlWriter);
> }else{
>
> xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localDescription));
>
> }
>
> xmlWriter.writeEndElement();
>
> namespace = "http://beans.nimesh/xsd";
> if (! namespace.equals("")) {
> prefix = xmlWriter.getPrefix(namespace);
> if (prefix == null) {
> prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
> xmlWriter.writeStartElement(prefix,"valid", namespace);
> xmlWriter.writeNamespace(prefix, namespace);
> xmlWriter.setPrefix(prefix, namespace);
> } else {
> xmlWriter.writeStartElement(namespace,"valid");
> }
> } else {
> xmlWriter.writeStartElement("valid");
> }
>
> xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localValid));
>
> xmlWriter.writeEndElement();
>
>
> xmlWriter.writeEndElement();
>
>
> }
> /**
> * Util method to write an attribute with the ns prefix
> */
> private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName,
> java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
> if (xmlWriter.getPrefix(namespace) == null) {
> xmlWriter.writeNamespace(prefix, namespace);
> xmlWriter.setPrefix(prefix, namespace);
> }
> xmlWriter.writeAttribute(namespace,attName,attValue);
> }
> /**
> * Util method to write an attribute without the ns prefix
> */
> private void writeAttribute(java.lang.String namespace,java.lang.String attName,
> java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
> registerPrefix(xmlWriter, namespace);
> xmlWriter.writeAttribute(namespace,attName,attValue);
> }
> /**
> * Register a namespace prefix
> */
> private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException {
> java.lang.String prefix = xmlWriter.getPrefix(namespace);
> if (prefix == null) {
> prefix = createPrefix();
> while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) {
> prefix = createPrefix();
> }
> xmlWriter.writeNamespace(prefix, namespace);
> xmlWriter.setPrefix(prefix, namespace);
> }
> return prefix;
> }
> /**
> * Create a prefix
> */
> private java.lang.String createPrefix() {
> return "ns" + (int)Math.random();
> }
> };
>
> return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl(
> parentQName,factory,dataSource);
>
> }
>
> /**
> * databinding method to get an XML representation of this object
> *
> */
> public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName){
>
> java.util.ArrayList elementList = new java.util.ArrayList();
> java.util.ArrayList attribList = new java.util.ArrayList();
>
> elementList.add(new javax.xml.namespace.QName("http://beans.nimesh/xsd",
> "description"));
>
> elementList.add(
> org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localDescription));
>
> elementList.add(new javax.xml.namespace.QName("http://beans.nimesh/xsd",
> "valid"));
>
> elementList.add(
> org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localValid));
>
> return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());
>
>
> }
>
> /**
> * Factory class that keeps the parse method
> */
> public static class Factory{
> /**
> * static method to create the object
> * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable
> * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element
> * Postcondition: If this object is an element, the reader is positioned at its end element
> * If this object is a complex type, the reader is positioned at the end element of its outer element
> */
> public static ValidateResponse parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{
> ValidateResponse object = new ValidateResponse();
> int event;
> try {
>
> while (!reader.isStartElement() && !reader.isEndElement())
> reader.next();
>
> if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){
> java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
> "type");
> if (fullTypeName!=null){
> java.lang.String nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":"));
> nsPrefix = nsPrefix==null?"":nsPrefix;
> java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1);
> if (!"ValidateResponse".equals(type)){
> //find namespace for the prefix
> java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
> return (ValidateResponse)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();
>
> boolean isReaderMTOMAware = false;
>
> try{
> isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE));
> }catch(java.lang.IllegalArgumentException e){
> isReaderMTOMAware = false;
> }
>
>
> reader.next();
>
>
> while (!reader.isStartElement() && !reader.isEndElement()) reader.next();
>
> if (reader.isStartElement() && new javax.xml.namespace.QName("http://beans.nimesh/xsd","description").equals(reader.getName())){
>
> java.lang.String content = reader.getElementText();
>
> object.setDescription(
> org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content));
>
> reader.next();
>
> } // End of if for expected property start element
>
> else{
> // A start element we are not expecting indicates an invalid parameter was passed
> throw new java.lang.RuntimeException("Unexpected subelement " + reader.getLocalName());
> }
>
>
> while (!reader.isStartElement() && !reader.isEndElement()) reader.next();
>
> if (reader.isStartElement() && new javax.xml.namespace.QName("http://beans.nimesh/xsd","valid").equals(reader.getName())){
>
> java.lang.String content = reader.getElementText();
>
> object.setValid(
> org.apache.axis2.databinding.utils.ConverterUtil.convertToBoolean(content));
>
> reader.next();
>
> } // End of if for expected property start element
>
> else{
> // A start element we are not expecting indicates an invalid parameter was passed
> throw new java.lang.RuntimeException("Unexpected subelement " + reader.getLocalName());
> }
>
> while (!reader.isStartElement() && !reader.isEndElement())
> reader.next();
> if (reader.isStartElement())
> // A start element we are not expecting indicates a trailing invalid property
> throw new java.lang.RuntimeException("Unexpected subelement " + reader.getLocalName());
>
> } catch (javax.xml.stream.XMLStreamException e) {
> throw new java.lang.Exception(e);
> }
> return object;
> }
> }//end of factory class
>
> }
>
>
> public static class ValidateUser
> implements org.apache.axis2.databinding.ADBBean{
>
> public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName(
> "http://services.nimesh/xsd",
> "validateUser",
> "ns2");
>
> /**
> * field for User
> */
> protected User localUser ;
>
> /**
> * Auto generated getter method
> * @return User
> */
> public User getUser(){
> return localUser;
> }
>
>
> /**
> * Auto generated setter method
> * @param param User
> */
> public void setUser(User param){
>
> this.localUser=param;
>
> }
>
>
>
> /**
> *
> * @param parentQName
> * @param factory
> * @return org.apache.axiom.om.OMElement
> */
> public org.apache.axiom.om.OMElement getOMElement(
> final javax.xml.namespace.QName parentQName,
> final org.apache.axiom.om.OMFactory factory){
> org.apache.axiom.om.OMDataSource dataSource =
> new org.apache.axis2.databinding.ADBDataSource(this,parentQName){
> public void serialize(
> javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
>
>
> java.lang.String prefix = parentQName.getPrefix();
> java.lang.String namespace = parentQName.getNamespaceURI();
> if (namespace != null) {
> java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
> if (writerPrefix != null) {
> xmlWriter.writeStartElement(namespace, parentQName.getLocalPart());
> } else {
> if (prefix == null) {
> prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
> }
> xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace);
> xmlWriter.writeNamespace(prefix, namespace);
> xmlWriter.setPrefix(prefix, namespace);
> }
> } else {
> xmlWriter.writeStartElement(parentQName.getLocalPart());
> }
>
>
> if (localUser==null){
> throw new RuntimeException("user cannot be null!!");
> }
> localUser.getOMElement(
> new javax.xml.namespace.QName("http://services.nimesh/xsd","user"),
> factory).serialize(xmlWriter);
>
>
> xmlWriter.writeEndElement();
>
>
> }
> /**
> * Util method to write an attribute with the ns prefix
> */
> private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName,
> java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
> if (xmlWriter.getPrefix(namespace) == null) {
> xmlWriter.writeNamespace(prefix, namespace);
> xmlWriter.setPrefix(prefix, namespace);
> }
> xmlWriter.writeAttribute(namespace,attName,attValue);
> }
> /**
> * Util method to write an attribute without the ns prefix
> */
> private void writeAttribute(java.lang.String namespace,java.lang.String attName,
> java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
> registerPrefix(xmlWriter, namespace);
> xmlWriter.writeAttribute(namespace,attName,attValue);
> }
> /**
> * Register a namespace prefix
> */
> private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException {
> java.lang.String prefix = xmlWriter.getPrefix(namespace);
> if (prefix == null) {
> prefix = createPrefix();
> while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) {
> prefix = createPrefix();
> }
> xmlWriter.writeNamespace(prefix, namespace);
> xmlWriter.setPrefix(prefix, namespace);
> }
> return prefix;
> }
> /**
> * Create a prefix
> */
> private java.lang.String createPrefix() {
> return "ns" + (int)Math.random();
> }
> };
>
> //ignore the QName passed in - we send only OUR QName!
> return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl(
> MY_QNAME,factory,dataSource);
>
> }
>
> /**
> * databinding method to get an XML representation of this object
> *
> */
> public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName){
>
> java.util.ArrayList elementList = new java.util.ArrayList();
> java.util.ArrayList attribList = new java.util.ArrayList();
>
> elementList.add(new javax.xml.namespace.QName("http://services.nimesh/xsd",
> "user"));
>
>
> if (localUser==null){
> throw new RuntimeException("user cannot be null!!");
> }
> elementList.add(localUser);
>
> return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());
>
>
> }
>
> /**
> * Factory class that keeps the parse method
> */
> public static class Factory{
> /**
> * static method to create the object
> * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable
> * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element
> * Postcondition: If this object is an element, the reader is positioned at its end element
> * If this object is a complex type, the reader is positioned at the end element of its outer element
> */
> public static ValidateUser parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{
> ValidateUser object = new ValidateUser();
> int event;
> try {
>
> while (!reader.isStartElement() && !reader.isEndElement())
> reader.next();
>
> if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){
> java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
> "type");
> if (fullTypeName!=null){
> java.lang.String nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":"));
> nsPrefix = nsPrefix==null?"":nsPrefix;
> java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1);
> if (!"validateUser".equals(type)){
> //find namespace for the prefix
> java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
> return (ValidateUser)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();
>
> boolean isReaderMTOMAware = false;
>
> try{
> isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE));
> }catch(java.lang.IllegalArgumentException e){
> isReaderMTOMAware = false;
> }
>
>
> reader.next();
>
>
> while (!reader.isStartElement() && !reader.isEndElement()) reader.next();
>
> if (reader.isStartElement() && new javax.xml.namespace.QName("http://services.nimesh/xsd","user").equals(reader.getName())){
>
> object.setUser(User.Factory.parse(reader));
>
> reader.next();
>
> } // End of if for expected property start element
>
> else{
> // A start element we are not expecting indicates an invalid parameter was passed
> throw new java.lang.RuntimeException("Unexpected subelement " + reader.getLocalName());
> }
>
> while (!reader.isStartElement() && !reader.isEndElement())
> reader.next();
> if (reader.isStartElement())
> // A start element we are not expecting indicates a trailing invalid property
> throw new java.lang.RuntimeException("Unexpected subelement " + reader.getLocalName());
>
> } catch (javax.xml.stream.XMLStreamException e) {
> throw new java.lang.Exception(e);
> }
> return object;
> }
> }//end of factory class
>
> }
>
>
> public static class ValidateUserResponse
> implements org.apache.axis2.databinding.ADBBean{
>
> public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName(
> "http://services.nimesh/xsd",
> "validateUserResponse",
> "ns2");
>
> /**
> * field for _return
> */
> protected ValidateResponse local_return ;
>
> /**
> * Auto generated getter method
> * @return ValidateResponse
> */
> public ValidateResponse get_return(){
> return local_return;
> }
>
>
> /**
> * Auto generated setter method
> * @param param _return
> */
> public void set_return(ValidateResponse param){
>
> this.local_return=param;
>
> }
>
>
>
> /**
> *
> * @param parentQName
> * @param factory
> * @return org.apache.axiom.om.OMElement
> */
> public org.apache.axiom.om.OMElement getOMElement(
> final javax.xml.namespace.QName parentQName,
> final org.apache.axiom.om.OMFactory factory){
> org.apache.axiom.om.OMDataSource dataSource =
> new org.apache.axis2.databinding.ADBDataSource(this,parentQName){
> public void serialize(
> javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
>
>
> java.lang.String prefix = parentQName.getPrefix();
> java.lang.String namespace = parentQName.getNamespaceURI();
> if (namespace != null) {
> java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
> if (writerPrefix != null) {
> xmlWriter.writeStartElement(namespace, parentQName.getLocalPart());
> } else {
> if (prefix == null) {
> prefix
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org