[ 
https://issues.apache.org/jira/browse/AXIS2-3252?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

adam updated AXIS2-3252:
------------------------

    Attachment: the classes.rar

all the classes that u need it 

> Unexpected subelement 
> ----------------------
>
>                 Key: AXIS2-3252
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3252
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>    Affects Versions: 1.2
>            Reporter: adam
>            Priority: Critical
>         Attachments: the classes.rar
>
>
> Hi, 
> I try to make web service with eclipse and axis2 .. and i recieve the 
> following exception and i don't know what is the casue : 
> Exception *****************: 
> Exception in thread "main" java.lang.RuntimeException: 
> java.lang.RuntimeException: Unexpected subelement medicineId
>       at 
> com.cliniccruise.ws.MainClassForWSMainClassForWSSOAP11Port_httpStub.fromOM(MainClassForWSMainClassForWSSOAP11Port_httpStub.java:19136)
>       at 
> com.cliniccruise.ws.MainClassForWSMainClassForWSSOAP11Port_httpStub.sendMedicenObjetct(MainClassForWSMainClassForWSSOAP11Port_httpStub.java:159)
>       at com.cliniccruise.ws.WSClient.main(WSClient.java:20)
> Caused by: java.lang.RuntimeException: Unexpected subelement medicineId
>       at 
> com.cliniccruise.ws.MainClassForWSMainClassForWSSOAP11Port_httpStub$MedicineWVO$Factory.parse(MainClassForWSMainClassForWSSOAP11Port_httpStub.java:14748)
>       at 
> com.cliniccruise.ws.MainClassForWSMainClassForWSSOAP11Port_httpStub$SendMedicenObjetctResponse$Factory.parse(MainClassForWSMainClassForWSSOAP11Port_httpStub.java:988)
>       at 
> com.cliniccruise.ws.MainClassForWSMainClassForWSSOAP11Port_httpStub.fromOM(MainClassForWSMainClassForWSSOAP11Port_httpStub.java:19130)
>       ... 2 more
> The class that i make from it the web service : 
> package com.cliniccruise.ws;
> import java.beans.BeanInfo;
> import java.beans.Introspector;
> import java.beans.MethodDescriptor;
> import java.lang.reflect.Array;
> import java.lang.reflect.Constructor;
> import java.lang.reflect.Method;
> import java.util.Collection;
> import java.util.Iterator;
> import com.cliniccruise.vo.main.medicine.FormVO;
> import com.cliniccruise.vo.main.medicine.MedicineVO;
> import com.cliniccruise.vo.main.medicine.MedicineWVO;
> import com.spectraflare.core.app.logging.SpectraLogger;
> import com.spectraflare.core.app.logging.SpectraLoggerFactory;
> import com.spectraflare.core.app.util.Util;
> import com.spectraflare.core.vo.MainObject;
> public class MainClassForWS
> {
>       static SpectraLogger logger = 
> SpectraLoggerFactory.getApplicationLogger(MainObject.class);
>       public MedicineWVO sendMedicenObjetct(String discription)
>       {
>               FormVO formVO = new FormVO(1244, "myForm");
>               MedicineVO medicineVO = new MedicineVO(1515, "eyeLight", 
> formVO);
>               medicineVO.setOwnerCompanyName("natural");
>               medicineVO.setAccessories(true);
>               medicineVO.setDescription(discription);
>               MedicineWVO medicineWVO = new MedicineWVO();
>               try
>               {
>                       this.clone(medicineVO, medicineWVO);
>               }
>               catch (Throwable e)
>               {
>                       // TODO Auto-generated catch block
>                       e.printStackTrace();
>               }
>               System.out.println("discription ....... " + discription);
>               return medicineWVO;
>       }
>       protected void clone(MainObject object,MedicineWVO medicineWVO) throws 
> Throwable
>       {
>               try
>               {
>                       // introspect object
>                       BeanInfo beanInfo = 
> Introspector.getBeanInfo(object.getClass(), Introspector.USE_ALL_BEANINFO);
>                       MethodDescriptor[] methodDescriptors = 
> beanInfo.getMethodDescriptors();
>                       for (int i = 0; i < methodDescriptors.length; i++)
>                       {
>                               Method method = 
> methodDescriptors[i].getMethod();
>                               String methodName = method.getName();
>                               if (!(methodName.startsWith("get") || 
> methodName.startsWith("is")))
>                                       continue;
>                               // method is getter
>                               if (method.getParameterTypes().length > 0)
>                                       continue;
>                               if (method.getName().equals("getAnotherCopy"))
>                                       continue;
>                               // get field name, value and type
>                               Object fieldValue = method.invoke(object, 
> (Object[]) null);
>                               String fieldName = null;
>                               if (methodName.startsWith("get"))
>                                       fieldName = methodName.substring(3);
>                               else if (methodName.startsWith("is"))
>                                       fieldName = methodName.substring(2);
>                               Class srcClass = method.getReturnType();
>                               // prepare setter method for this main object
>                               String destSetterName = "set" + 
> Character.toUpperCase(fieldName.charAt(0)) + fieldName.substring(1);
>                               Method destSetterMethod = null;
>                               // in case field is collection
>                               if (fieldValue instanceof Collection)
>                               {
>                                       int collectionSize = ((Collection) 
> fieldValue).size();
>                                       if (collectionSize <= 0)
>                                               continue;
>                                       // get type of first element in 
> collection
>                                       Class elementType = ((Collection) 
> fieldValue).iterator().next().getClass();
>                                       Object paramArray = 
> Array.newInstance(elementType, collectionSize);
>                                       try
>                                       {
>                                               destSetterMethod = 
> medicineWVO.getClass().getMethod(destSetterName, paramArray.getClass());
>                                       }
>                                       // if no setter found, ignore
>                                       catch (NoSuchMethodException e)
>                                       {
>                                               logger.info("could not find 
> setter method " + destSetterName + " in class " + medicineWVO.getClass());
>                                               continue;
>                                       }
>                                       // copy fieldValue collection to array
>                                       int j = 0;
>                                       for (Iterator iterator = ((Collection) 
> fieldValue).iterator(); iterator.hasNext(); j++)
>                                               ((Object[]) paramArray)[j] = 
> iterator.next();
>                                       // invoke setter method
>                                       destSetterMethod.invoke(medicineWVO, 
> paramArray);
>                               }
>                               // in case field is not collection
>                               else
>                               {
>                                       try
>                                       {
>                                               // in case field is vo 
> containing collection
>                                               if (fieldValue instanceof 
> MainObject && Util.classContainsCollection(srcClass))
>                                               {
>                                                       // get wrapper class
>                                                       String srcClassName = 
> srcClass.getName();
>                                                       String wrapperName = 
> srcClassName.substring(0, srcClassName.indexOf("VO")) + "WVO";
>                                                       Class wrapperClass = 
> Class.forName(wrapperName);
>                                                       // get wrapper 
> constructor that receives vo
>                                                       Constructor 
> wrapperConstructor = wrapperClass.getConstructor(new Class[]
>                                                               { srcClass });
>                                                       // instaniate wrapper 
> class
>                                                       fieldValue = 
> wrapperConstructor.newInstance(new Object[]
>                                                               { fieldValue });
>                                                       destSetterMethod = 
> medicineWVO.getClass().getMethod(destSetterName, wrapperClass);
>                                               }
>                                               else
>                                               {
>                                                       destSetterMethod = 
> medicineWVO.getClass().getMethod(destSetterName, srcClass);
>                                               }
>                                       }
>                                       // if no setter found, ignore
>                                       catch (NoSuchMethodException e)
>                                       {
>                                               logger.info("could not find 
> setter method " + destSetterName + " in class " + medicineWVO.getClass());
>                                               continue;
>                                       }
>                                       // invoke setter method
>                                       destSetterMethod.invoke(medicineWVO, 
> fieldValue);
>                               }
>                       }
>               }
>               catch (Throwable e)
>               {
>                       throw e;
>               }
>       }
> }
> and my client test is : 
> package com.cliniccruise.ws;
> import java.rmi.RemoteException;
> import org.apache.axis2.AxisFault;
> import com.cliniccruise.vo.main.medicine.MedicineWVO;
> import 
> com.cliniccruise.ws.MainClassForWSMainClassForWSSOAP11Port_httpStub.SendMedicenObjetct;
> import 
> com.cliniccruise.ws.MainClassForWSMainClassForWSSOAP11Port_httpStub.SendMedicenObjetctResponse;
> public class WSClient
> {
>       public static void main(String[] args)
>       {
>               try
>               {
>                       MainClassForWSMainClassForWSSOAP11Port_httpStub stub = 
> new MainClassForWSMainClassForWSSOAP11Port_httpStub();
>                       SendMedicenObjetct medicenObjetct = new 
> SendMedicenObjetct();
>                       medicenObjetct.setDiscription("Good Medicine For Eye");
>                       SendMedicenObjetctResponse res = 
> stub.sendMedicenObjetct(medicenObjetct);
>                       
> com.cliniccruise.ws.MainClassForWSMainClassForWSSOAP11Port_httpStub.MedicineWVO
>  medicineWVO = res.get_return();
>                       
>                       System.out.println("Medicine return object  : " + 
> medicineWVO);
>                       System.out.println("finishing");
>               }
>               catch (AxisFault e)
>               {
>                       e.printStackTrace();
>               }
>               catch (RemoteException e)
>               {
>                       e.printStackTrace();
>               }
>       }
> }
> and i think the following class you will need it :
> /*
>  * Created on Nov 25, 2005 To change the template for this generated file go 
> to Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
>  */
> package com.cliniccruise.vo.main.medicine;
> import com.cliniccruise.vo.main.LanguageVO;
> import com.cliniccruise.vo.relation.disease.DiseaseMedicineVO;
> import com.cliniccruise.vo.relation.medicine.MedicineActiveConstVO;
> import com.cliniccruise.vo.relation.medicine.MedicineCategoryVO;
> import com.cliniccruise.vo.relation.medicine.MedicineNutritionVO;
> import com.cliniccruise.vo.relation.medicine.MedicinePhotoVO;
> import com.cliniccruise.vo.relation.medicine.RelatedMedicineAdministrationVO;
> import com.spectraflare.core.app.logging.SpectraLogger;
> import com.spectraflare.core.app.logging.SpectraLoggerFactory;
> import com.spectraflare.core.vo.MainObject;
> /**
>  * @author comming_king To change the template for this generated type 
> comment go to Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and
>  *       extends MedicineMVO  Comments
>  */
> public class MedicineWVO 
> {
>       /**/protected DiseaseMedicineVO[] sideEffectsTree = null;
>       /**/protected MedicineCategoryVO[] categoriesTree = null;
>       /**/protected MedicineNutritionVO[] nutritionsTree = null;
>       /**/protected RelatedMedicineAdministrationVO[] administrationsTree = 
> null;
>       /**/protected MedicineActiveConstVO[] activeConstituentsTree = null;
>       /**/private MedicinePriceVO[] priceList = null;
>       private LanguageVO[] languageList = null;
>       /**/private MedicinePhotoVO[] photoList = null;
>       
>       /** medicine VO*/
>       
>       /** MedicineMVO */
>       private static final long serialVersionUID = 1L;
>       protected int formId = -1, ownerCompanyId = -1, medicineId , sizeUnitId 
> = -1;
>       protected String ownerCompanyName, formName = "", instructions = "", 
> unitName;
>       protected int packSize = 1;
>       protected int routeOfAdministration;
>       protected float size;
>       protected boolean narcotic, accessories;
>       
>       /** ObjectVO */
>       protected int id = -1;
>       protected int oldId = -1;
>       protected String name = "", description;
>       /** MainVO */
>       static SpectraLogger logger = 
> SpectraLoggerFactory.getApplicationLogger(MainObject.class);
>       protected String[][] fieldsMaping = null;
>       
>       public MedicineWVO()
>       {
>               super();
>       }
> //
> //    
> //    public MedicineWVO(MedicineVO medicineVO) throws Throwable
> //    {
> //            this.clone(medicineVO);
> //    }
> //
> //
>       
>       public int getFormId()
>       {
>               return formId;
>       }
>       public void setFormId(int formId)
>       {
>               this.formId = formId;
>       }
>       public int getOwnerCompanyId()
>       {
>               return ownerCompanyId;
>       }
>       public void setOwnerCompanyId(int ownerCompanyId)
>       {
>               this.ownerCompanyId = ownerCompanyId;
>       }
>       public int getMedicineId()
>       {
>               return medicineId;
>       }
>       public void setMedicineId(int medicineId)
>       {
>               this.medicineId = medicineId;
>       }
>       public int getSizeUnitId()
>       {
>               return sizeUnitId;
>       }
>       public void setSizeUnitId(int sizeUnitId)
>       {
>               this.sizeUnitId = sizeUnitId;
>       }
>       public String getOwnerCompanyName()
>       {
>               return ownerCompanyName;
>       }
>       public void setOwnerCompanyName(String ownerCompanyName)
>       {
>               this.ownerCompanyName = ownerCompanyName;
>       }
>       public String getFormName()
>       {
>               return formName;
>       }
>       public void setFormName(String formName)
>       {
>               this.formName = formName;
>       }
>       public String getInstructions()
>       {
>               return instructions;
>       }
>       public void setInstructions(String instructions)
>       {
>               this.instructions = instructions;
>       }
>       public String getUnitName()
>       {
>               return unitName;
>       }
>       public void setUnitName(String unitName)
>       {
>               this.unitName = unitName;
>       }
>       public int getPackSize()
>       {
>               return packSize;
>       }
>       public void setPackSize(int packSize)
>       {
>               this.packSize = packSize;
>       }
>       public int getRouteOfAdministration()
>       {
>               return routeOfAdministration;
>       }
>       public void setRouteOfAdministration(int routeOfAdministration)
>       {
>               this.routeOfAdministration = routeOfAdministration;
>       }
>       public float getSize()
>       {
>               return size;
>       }
>       public void setSize(float size)
>       {
>               this.size = size;
>       }
>       public boolean isNarcotic()
>       {
>               return narcotic;
>       }
>       public void setNarcotic(boolean narcotic)
>       {
>               this.narcotic = narcotic;
>       }
>       public boolean isAccessories()
>       {
>               return accessories;
>       }
>       public void setAccessories(boolean accessories)
>       {
>               this.accessories = accessories;
>       }
>       public int getId()
>       {
>               return id;
>       }
>       public void setId(int id)
>       {
>               this.id = id;
>       }
>       public int getOldId()
>       {
>               return oldId;
>       }
>       public void setOldId(int oldId)
>       {
>               this.oldId = oldId;
>       }
>       public String getName()
>       {
>               return name;
>       }
>       public void setName(String name)
>       {
>               this.name = name;
>       }
>       public String getDescription()
>       {
>               return description;
>       }
>       public void setDescription(String description)
>       {
>               this.description = description;
>       }
>       public static SpectraLogger getLogger()
>       {
>               return logger;
>       }
>       public static void setLogger(SpectraLogger logger)
>       {
>               MedicineWVO.logger = logger;
>       }
>       public String[][] getFieldsMaping()
>       {
>               return fieldsMaping;
>       }
>       public void setFieldsMaping(String[][] fieldsMaping)
>       {
>               this.fieldsMaping = fieldsMaping;
>       }
>       public DiseaseMedicineVO[] getSideEffectsTree()
>       {
>               return sideEffectsTree;
>       }
>       public void setSideEffectsTree(DiseaseMedicineVO[] sideEffectsTree)
>       {
>               this.sideEffectsTree = sideEffectsTree;
>       }
>       public MedicineCategoryVO[] getCategoriesTree()
>       {
>               return categoriesTree;
>       }
>       public void setCategoriesTree(MedicineCategoryVO[] categoriesTree)
>       {
>               this.categoriesTree = categoriesTree;
>       }
>       public MedicineNutritionVO[] getNutritionsTree()
>       {
>               return nutritionsTree;
>       }
>       public void setNutritionsTree(MedicineNutritionVO[] nutritionsTree)
>       {
>               this.nutritionsTree = nutritionsTree;
>       }
>       public RelatedMedicineAdministrationVO[] getAdministrationsTree()
>       {
>               return administrationsTree;
>       }
>       public void setAdministrationsTree(RelatedMedicineAdministrationVO[] 
> administrationsTree)
>       {
>               this.administrationsTree = administrationsTree;
>       }
>       public MedicineActiveConstVO[] getActiveConstituentsTree()
>       {
>               return activeConstituentsTree;
>       }
>       public void setActiveConstituentsTree(MedicineActiveConstVO[] 
> activeConstituentsTree)
>       {
>               this.activeConstituentsTree = activeConstituentsTree;
>       }
>       public MedicinePriceVO[] getPriceList()
>       {
>               return priceList;
>       }
>       public void setPriceList(MedicinePriceVO[] priceList)
>       {
>               this.priceList = priceList;
>       }
>       public MedicinePhotoVO[] getPhotoList()
>       {
>               return photoList;
>       }
>       public void setPhotoList(MedicinePhotoVO[] photoList)
>       {
>               this.photoList = photoList;
>       }
> }
> So.... i need to know from where this exception come and what causes it.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to