Android Question error passing parameter to webservice

Makumbi

Well-Known Member
Licensed User
iam trying to delete are record from the database by passing the customer id how best can i go about it that is how i have tried it but iam getting error

System.InvalidOperationException: Missing parameter: customerId.
at System.Web.Services.Protocols.ValueCollectionParameterReader.Read(NameValueCollection collection)
at System.Web.Services.Protocols.HtmlFormParameterReader.Read(HttpRequest request)
at System.Web.Services.Protocols.HttpServerProtocol.ReadParameters()
at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()

B4X:
Dim Job As HttpJob
    Dim Job2 As HttpJob

    Job.Username="..."
    Job.Password="..."
    Job2.Username="..."
    Job2.Password="..."
 Dim k As Int
    k="103"
    'Job.Download("https://xy.xy.com/api/barcode/1?barcode=" & BC & "&customer=kro")
    'Job.Download("http://192.168.1.239/WebServicesula/Service.asmx/Update?customerId=123&")
    'Job.Download2("http://192.168.1.239/WebServicesula/Service.asmx/delete?customerId=123&", Array As String(k))
    'Job.GetRequest.SetContentType("application/json")
  
  
    'Send a POST request
    Job2.Initialize("Job2", Me)
    Job2.PostString("http://192.168.1.239/WebServicesula/Service.asmx/Delete?customerId=123&", k)
 

DonManfred

Expert
Licensed User
Longtime User
If it expects a json string then you need to use JsonGenerator to create the string.

@Makumbi
B4X:
Dim jgen As JSONGenerator
    jgen.Initialize(CreateMap("customerId": 123))
Job2.PostString("http://192.168.1.239/WebServicesula/Service.asmx/Delete", jgen.ToString)
 
Upvote 0
Top