web services - How to remove i:type="d:string" from PropertyInfo of SOAP in KSOAP2 Android -
i using ksoap2-android-assembly-3.0.0-jar-with-dependencies.jar
i working on project need following soap request:
<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mod="http://www.tmforum.org/xml/tip/model" xmlns:cust="http://www.tmforum.org/xml/tip/customer/cust"> <soapenv:header/> <soapenv:body> <mod:listproblemsrequest> <!--optional:--> <mod:customer> <cust:id >1100000677</cust:id> </mod:customer> </mod:listproblemsrequest> </soapenv:body> </soapenv:envelope>
but using ksoap2 able generate following request:
<v:envelope xmlns:i="http://www.w3.org/2001/xmlschema-instance" xmlns:d="http://www.w3.org/2001/xmlschema" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/"> <v:header /> <v:body> <retrievecustomerprofilerequest xmlns="http://www.tmforum.org/xml/tip/model"> <n0:customer xmlns:n0="http://www.tmforum.org/xml/tip/model"> <n1:id i:type="d:string" xmlns:n1="http://www.tmforum.org/xml/tip/customer /cust">1100000990</n1:id> </n0:customer> </retrievecustomerprofilerequest> </v:body> </v:envelope>
how remove i:type="d:string"
soap request.
please suggest solution or workaround done in source code of ksoap2 may able generate appropriate request.
i have found workaround problem in ksoap :
1. download source code of ksoap2.jar. 2.open transport .java , edit : protected byte[] createrequestdata(soapenvelope envelope, string encoding) throws ioexception method. 3.i edited follows: protected byte[] createrequestdata(soapenvelope envelope, string encoding) throws ioexception { bytearrayoutputstream bos = new bytearrayoutputstream(bufferlength); byte result[] = null; bos.write(xmlversiontag.getbytes()); xmlserializer xw = new kxmlserializer(); xw.setoutput(bos, encoding); envelope.write(xw); xw.flush(); bos.write('\r'); bos.write('\n'); bos.flush(); result = bos.tobytearray(); xw = null; bos = null; string requestobject = new string(result); string pattern = "i:type=\"d:string\""; string resultstring=""; system.out.println("==earlier string==" + requestobject); if (requestobject.contains(pattern)) { system.out.println("==is here "); resultstring=requestobject.replace(pattern, ""); } 4.compile class using classpath of ksoap2.jar 5.extract ksoap2.jar , remove existing transport.class it. 6.add newly compiled .class file , make new jar. 7.import jar in project. problem solved..
Comments
Post a Comment