I want to call a soap web service in an Android app that needs an enum value as a parameter, which is an enumeration of a flag. How do I pass a value as a flag enumeration for this web service method from an Android application?
I use Ksoap to call a soap service.
This web service method:
[WebMethod]
public ReceptionCommitResult CommitReceiption(some parameters, EnumName myEnum)
{
}
and web service enumeration:
[Flags]
public enum EnumName
{
One= 0,
Two = 1,
Three = 2,
Four = 4,
Five = 8,
}
finally I got the code to call the service:
SoapObject soapObj = new SoapObject(ServiceUtil.WSDL_TARGET_NAMESPACE, "RCI");
AttributeInfo attrInfo = new AttributeInfo();
attrInfo.setName("myEnum");
attrInfo.setValue("");
attrInfo.setType(EnumName.class);
soapObj.addAttribute(attrInfo);
SoapSerializationEnvelope _envelope = new SoapSerializationEnvelope(SoapEnvelope.VER12);
_envelope.skipNullProperties = false;
_envelope.implicitTypes = true;
_envelope.dotNet = true;
_envelope.setOutputSoapObject(_client);
_envelope.bodyOut = _client;
_envelope.addMapping(WSDL_TARGET_NAMESPACE, "RCI",new MyClassObject().getClass());
HttpTransportSE httpTransport1 = new HttpTransportSE(ServiceUtil.SOAP_ADDRESS, 60000000);
httpTransport1.debug = true;
httpTransport1.call(ServiceUtil.SOAP_ACTION, _envelope);
source
share