try{ SoapObject soapRequestforAdding = new SoapObject(NAMESPACE, METHOD_NAME_INSERT); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.setOutputSoapObject(soapRequestforAdding); //envelope.addMapping(namespace, name, clazz) SimpleDateFormat dateFormater = new SimpleDateFormat("yyyy-MM-dd"); //<element name="empno" type="xsd:int" /> int empno =Integer.parseInt(mEmpnoText.getText().toString().trim()); PropertyInfo empnoPropInfo=new PropertyInfo(); empnoPropInfo.setName("empno"); empnoPropInfo.setValue(empno); empnoPropInfo.setType(String.class); soapRequestforAdding.addProperty(empnoPropInfo); //<element name="empname" nillable="true" type="xsd:string" /> String empname=mEmpnameText.getText().toString().trim(); PropertyInfo empnamePropInfo=new PropertyInfo(); empnamePropInfo.setName("empname"); empnamePropInfo.setValue(empname); empnamePropInfo.setType(String.class); soapRequestforAdding.addProperty(empnamePropInfo); //<element name="username" nillable="true" type="xsd:string" /> String username=mUsernameText.getText().toString().trim(); PropertyInfo usernamePropInfo=new PropertyInfo(); usernamePropInfo.setName("username"); usernamePropInfo.setValue(username); usernamePropInfo.setType(String.class); soapRequestforAdding.addProperty(usernamePropInfo); //<element name="employeeaddress" nillable="true" type="xsd:string" /> String employeeaddress=mAddressText.getText().toString().trim(); PropertyInfo addressPropInfo=new PropertyInfo(); addressPropInfo.setName("employeeaddress"); addressPropInfo.setValue(employeeaddress); addressPropInfo.setType(String.class); soapRequestforAdding.addProperty(addressPropInfo); //<element name="city" nillable="true" type="xsd:string" /> String city=mCityText.getText().toString().trim(); PropertyInfo cityPropInfo=new PropertyInfo(); cityPropInfo.setName("city"); cityPropInfo.setValue(city); cityPropInfo.setType(String.class); soapRequestforAdding.addProperty(cityPropInfo); //<element name="pincode" type="xsd:int" /> int pincode=Integer.parseInt(mPincodeText.getText().toString().trim()); PropertyInfo pincodePropInfo=new PropertyInfo(); pincodePropInfo.setName("pincode"); pincodePropInfo.setValue(pincode); pincodePropInfo.setType(String.class); soapRequestforAdding.addProperty(pincodePropInfo); //<element name="mobileno" type="xsd:long" /> long mobileno=Long.parseLong(mMobilenoText.getText().toString().trim()); PropertyInfo mobilenoPropInfo=new PropertyInfo(); mobilenoPropInfo.setName("mobileno"); mobilenoPropInfo.setValue(mobileno); mobilenoPropInfo.setType(String.class); soapRequestforAdding.addProperty(mobilenoPropInfo); //<element name="dateofbirth" nillable="true" type="xsd:date" /> // Date dateofbirth=dateFormater.parse(mDobText.getText().toString().trim()); String dateofbirth=mDobText.getText().toString().trim(); PropertyInfo dateofbirthPropInfo=new PropertyInfo(); dateofbirthPropInfo.setName("dateofbirth"); dateofbirthPropInfo.setValue(dateofbirth); // dateofbirthPropInfo.setType(Date.class); soapRequestforAdding.addProperty(dateofbirthPropInfo); //<element name="salary" type="xsd:float" /> float salary=Float.parseFloat(mSalaryText.getText().toString().trim()); PropertyInfo salaryPropInfo=new PropertyInfo(); salaryPropInfo.setName("salary"); salaryPropInfo.setValue(salary); salaryPropInfo.setType(float.class); soapRequestforAdding.addProperty(salaryPropInfo); //<element name="joiningdate" nillable="true" type="xsd:date" /> Date joiningdate=dateFormater.parse(mJoinText.getText().toString().trim()); PropertyInfo joiningdatePropInfo=new PropertyInfo(); joiningdatePropInfo.setName("joiningdate"); // joiningdatePropInfo.setValue(joiningdate); //joiningdatePropInfo.setType(String.class); soapRequestforAdding.addProperty(joiningdatePropInfo); //<element name="relieavingdate" nillable="true" type="xsd:date" /> Date relieavingdate=dateFormater.parse(mRelieveText.getText().toString().trim()); PropertyInfo relieavingdatePropInfo=new PropertyInfo(); relieavingdatePropInfo.setName("relieavingdate"); relieavingdatePropInfo.setValue(relieavingdate); // relieavingdatePropInfo.setType(String.class); soapRequestforAdding.addProperty(relieavingdatePropInfo); //<element name="createddtm" nillable="true" type="xsd:string" /> String createddtm=mCreatedtmText.getText().toString().trim(); PropertyInfo createddtmPropInfo=new PropertyInfo(); createddtmPropInfo.setName("createddtm"); createddtmPropInfo.setValue(createddtm); createddtmPropInfo.setType(String.class); soapRequestforAdding.addProperty(createddtmPropInfo); //<element name="creator" nillable="true" type="xsd:string" /> String creator=mCreatorText.getText().toString().trim(); PropertyInfo creatorPropInfo=new PropertyInfo(); creatorPropInfo.setName("creator"); creatorPropInfo.setValue(creator); creatorPropInfo.setType(String.class); soapRequestforAdding.addProperty(creatorPropInfo); //<element name="updateddtm" nillable="true" type="xsd:string" /> String updateddtm=mUpdatedText.getText().toString().trim(); PropertyInfo updateddtmPropInfo=new PropertyInfo(); updateddtmPropInfo.setName("updateddtm"); updateddtmPropInfo.setValue(updateddtm); updateddtmPropInfo.setType(String.class); soapRequestforAdding.addProperty(updateddtmPropInfo); //<element name="modifier" nillable="true" type="xsd:string" /> String modifier=mModifierText.getText().toString().trim(); PropertyInfo modifierPropInfo=new PropertyInfo(); modifierPropInfo.setName("modifier"); modifierPropInfo.setValue(modifier); modifierPropInfo.setType(String.class); soapRequestforAdding.addProperty(modifierPropInfo); //<element name="branchno" type="xsd:int" /> int branchno=Integer.parseInt(mBranchnoText.getText().toString().trim()); PropertyInfo branchnoPropInfo=new PropertyInfo(); branchnoPropInfo.setName("branchno"); branchnoPropInfo.setValue(branchno); branchnoPropInfo.setType(String.class); soapRequestforAdding.addProperty(branchnoPropInfo); //<element name="gender" nillable="true" type="xsd:string" /> String gender=mGenderText.getText().toString().trim(); PropertyInfo genderPropInfo=new PropertyInfo(); genderPropInfo.setName("gender"); genderPropInfo.setValue(gender); genderPropInfo.setType(String.class); soapRequestforAdding.addProperty(genderPropInfo); //<element name="jobtype" nillable="true" type="xsd:string" /> String jobtype=mJobTypeText.getText().toString().trim(); PropertyInfo jobtypePropInfo=new PropertyInfo(); jobtypePropInfo.setName("jobtype"); jobtypePropInfo.setValue(jobtype); jobtypePropInfo.setType(String.class); soapRequestforAdding.addProperty(jobtypePropInfo); //<element name="country" nillable="true" type="xsd:string" /> String country=mCountryText.getText().toString().trim(); PropertyInfo countryPropInfo=new PropertyInfo(); countryPropInfo.setName("country"); countryPropInfo.setValue(country); countryPropInfo.setType(String.class); soapRequestforAdding.addProperty(countryPropInfo); //<element name="state" nillable="true" type="xsd:string" /> String state=mStateText.getText().toString().trim(); PropertyInfo statePropInfo=new PropertyInfo(); statePropInfo.setName("state"); statePropInfo.setValue(state); statePropInfo.setType(String.class); soapRequestforAdding.addProperty(statePropInfo); //<element name="telephoneno" type="xsd:long" /> long telephoneno=Long.parseLong(mTelephoneText.getText().toString().trim()); PropertyInfo telephonenoPropInfo=new PropertyInfo(); telephonenoPropInfo.setName("telephoneno"); telephonenoPropInfo.setValue(telephoneno); telephonenoPropInfo.setType(String.class); soapRequestforAdding.addProperty(telephonenoPropInfo); HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); androidHttpTransport.call(SOAP_ACTION_INSERT, envelope); SoapObject obj = (SoapObject) envelope.getResponse(); mEnterempno.setText(obj.getPropertySafelyAsString("")); } catch(Exception e) { e.printStackTrace(); lblResult.setText("ERROR:" + e.getClass().getName() + ": " + e.getMessage()); } } } public Object readInstance(XmlPullParser parser, String NAMESPACE, String name, PropertyInfo Expected) throws IOException, XmlPullParserException { // TODO Auto-generated method stub return Float.parseFloat(parser.nextText()); } public void register(SoapSerializationEnvelope envelope) { // TODO Auto-generated method stub envelope.addMapping(NAMESPACE, "METHOD_NAME_INSERT", New.class, this); } public void writeInstance(XmlSerializer writer, Object arg1) throws IOException { writer.text(arg1.toString()); // TODO Auto-generated method stub } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)