Android Question create datatable to be passed to a webservice expecting a .net datatable

kevin rowe

New Member
I have a b4a app that is currently passing parameters directly to the back end SQL parser (for generic queries) to update data that is displayed as a table.
I inherited this design.
The app is a clone of a web app that passes the whole screen table back as a .net datatable to a service call expecting a .net datatable, but this version passes each line back in turn to a the SQL service call.
I have to change the functionality, to add an extra a bit of data to the screen table that would create a lot of work front end, or I can call the dataset expecting service call.

Is it possible to generate a .net datatable in b4a that can be exported to the webservice call to slot into the xml for the service call?
I can't find any references to libraries that provide datatable or anything like it.

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Header>
<security stuff>
</soap12:Header>
<soap12:Body>
<servicecallname xmlns="http://oursite.co.uk/">
<DT>datatable export xml here</DT>
<other field1>string</other field1>
<other field2>string</other field2>
<other field3>string</other field3>
</servicecallname>
</soap12:Body>
</soap12:Envelope>
 

kevin rowe

New Member
Sorry for the confusion.

I need specifically to be able to export the data in an SQLLite cursor (or ResultSet) in a form identical to the export from a .NET DataSet into a string.
This string data will be inserted into another xml string that is passed to a webservice expecting a DataSet as xml as one of the parameters.
 
Upvote 0

kevin rowe

New Member
I have tried to use the Map2Xml class to convert the map created by DBUtils.ExecuteJSON to xml but i get a dom exception. I looked at the Map2Xml example but it does not appear materially different.
Do I need to load a schema into the Map2Xml using the Class_Globals property? If so, how?

map2xml:
    ls_sql = "SELECT ..."
    Dim ls_fields As List = Array(DBUtils.DB_INTEGER, DBUtils.DB_INTEGER, .. etc )      
    Dim lsxml As String
    Dim ls_args() As String = Null
    Dim li_limit As Int = 10000
    Dim gen As JSONGenerator  
    Dim m As Map
    Dim mtx As Map2Xml

    m = DBUtils.ExecuteJSON(SQL1, ls_sql, ls_args, li_limit, ls_fields)
    gen.Initialize(m)
    mtx.Initialize()
    lsxml = mtx.MapToXml(m)  ' crashes here



This crashes with error message

Error occurred on line: 52 (Map2Xml)
org.w3c.dom.DOMException: 890090
at org.apache.harmony.xml.dom.NodeImpl.setName(NodeImpl.java:286)
at org.apache.harmony.xml.dom.ElementImpl.<init>(ElementImpl.java:56)
at org.apache.harmony.xml.dom.DocumentImpl.createElement(DocumentImpl.java:343)
at org.apache.harmony.xml.dom.DocumentImpl.createElement(DocumentImpl.java:48)
at com.jamesmurty.utils.XMLBuilder.element2(XMLBuilder.java:477)
at com.jamesmurty.utils.XMLBuilder.element(XMLBuilder.java:420)
at Merit.FMSPortal.map2xml._handleelement(map2xml.java:96)
at Merit.FMSPortal.map2xml._handlemapelement(map2xml.java:166)
at Merit.FMSPortal.map2xml._handleelement(map2xml.java:81)
at Merit.FMSPortal.map2xml._handlelistelement(map2xml.java:192)
at Merit.FMSPortal.map2xml._handleelement(map2xml.java:92)
at Merit.FMSPortal.map2xml._maptoxml(map2xml.java:234)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:205)
at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262)

Does anyone know what the issue is?
 
Upvote 0

Alex_197

Well-Known Member
Licensed User
Longtime User
Create a line like this
B4X:
FieldName1_FieldName2~Field1FirstRowData_Field2FirstRowData~

and send this line to your server and then parse it
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…