You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem?
1. Send out a BigDecimal to a webservice/wcf server with value = "12.0".
2. If you wish try to create a Marshal for BigDecimal and register with
SoapEnvelope (Write Method won't get called for some reason, hence Marshaller
is no use)
3. Inspect the send out value and value type on the wire with wireshark.
What is the expected output? What do you see instead?
I expect to see <Price>12.0</Price> on the output.
I see <Price i:type="d:int">2</Price> instead (NOTE "2" not "12" - incorrect
value and type(int))
What version of the product are you using? On what operating system?
On the server side I use Win7 WCF basicHttpBinding.
On client side I use Android4.1
Ksoap2-android-assembly-3.3.0-jar-with-dependencies.jar.
Please provide any additional information below.
I also created a MarshalBigDecimal class and registered it with SoapEnvelope,
writeInstance() never gets called on it, so i cannot format the output myself.
package paket.android.webservice;
import java.io.IOException;
import java.math.BigDecimal;
import org.ksoap2.serialization.Marshal;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlSerializer;
public class MarshalBigDecimal implements Marshal {
public Object readInstance(XmlPullParser parser, String namespace, String name, PropertyInfo expected) throws IOException, XmlPullParserException {
return new BigDecimal(parser.nextText());
}
public void writeInstance(XmlSerializer writer, Object obj) throws IOException {
writer.text(obj.toString());
}
public void register(SoapSerializationEnvelope cm) {
cm.addMapping(cm.xsd, "decimal", BigDecimal.class, this);
}
}
ADDITIONAL WEBSERVICE CONTSRUCTION details below (not including whole class)
public WebServiceWrapper(String soapAction, String methodName, String namespace, String url, boolean isDotNet, int soapEnvelopeVersion, boolean debug) {
this.mSoap_Action = soapAction;
this.mMethod_Name = methodName;
this.mNamespace = namespace;
this.mUrl = url;
this.mSoapEnv = new SoapSerializationEnvelope(soapEnvelopeVersion);
this.mSoapEnv.dotNet = isDotNet;
this.mRequest = new SoapObject(this.mNamespace, this.mMethod_Name);
this.mSoapEnv.setOutputSoapObject(this.mRequest);
this.mAndroidHttpTransport = new HttpTransportSE(this.mUrl, 9000);
this.mAndroidHttpTransport.debug = debug;
new MarshalDate().register(mSoapEnv);
new MarshalFloat().register(mSoapEnv);
new MarshalBigDecimal().register(mSoapEnv);
new MarshalDouble().register(mSoapEnv);
this.mSoapEnv.setAddAdornments(false);
this.mSoapEnv.implicitTypes = true;
// Note added soap headers for WSHttpBinding
this.mSoapEnv.headerOut = WebServiceWrapper.buildHeader(url, soapAction);
headerPropertyArrayList.add(new HeaderProperty("Connection", "close"));
}
Original issue reported on code.google.com by [email protected] on 7 Jul 2014 at 4:19
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
[email protected]
on 7 Jul 2014 at 4:19The text was updated successfully, but these errors were encountered: