Finally connected to the database takes a few days, but new problems have emerged it! Get out of the data contained anyType, String type as shown:
How I parse out?
Gaoshoubangbangmang ah!Reply:
public static CenterInfo [] getWorkOn (SoapObject obj) {
CenterInfo [] info = null;
try {
if (obj.getPropertyCount () & gt; 1) {// a central information
int len = obj.getPropertyCount () - 1;
info = new CenterInfo [len];
for (int i = 0; i & lt; len; i ++) {
SoapObject child = (SoapObject) obj.getProperty (i + 1);
String idStr = child.getPropertyAsString (0);
String content = child.getPropertyAsString (1);
String sender = child.getPropertyAsString (2);
String typeStr = child.getPropertyAsString (3);
String uId = child.getPropertyAsString (4);
String time = child.getPropertyAsString (5); // time
long id = Long.parseLong (idStr);
int type = Integer.parseInt (typeStr);
info [i] = new CenterInfo (id, content, sender, type, uId, time);
}
}
} Catch (Exception e) {
e.printStackTrace ();
}
return info;
}
Reply:
Will this CenterInfo [] is what ah? Novice seeking advice do not understand, there getPropertyCount () method is what? These are how to use?

Reply:
This error may be we do not quite understand, especially posted the code, seeking pointers:
MainActivity:
public void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
setContentView (R.layout.activity_main);
searchs = (Button) findViewById (R.id.search);
results = (TextView) findViewById (R.id.result);
searchs.setOnClickListener (new View.OnClickListener () {
Override
public void onClick (View v) {
String wsdUrl = "http://192.168.1.195:88/service1.asmx";
String method = "SelectAll";
Object result = SOAPUtil.doTransport (wsdUrl, method);
results.setText (result.toString ());
}
});
} SoapUtil:
public static Object doTransport (final String wsdUrl, final String webMethod) {
String nameSpace = "http://tempuri.org/";
SoapObject soapObject = new SoapObject (nameSpace, webMethod);
// SoapObject.addProperty (propertyInfo)
System.out.println ();
SoapSerializationEnvelope soapSerializationEnvelope = new SoapSerializationEnvelope (
SoapEnvelope.VER11);
soapSerializationEnvelope.bodyOut = soapObject;
soapSerializationEnvelope.dotNet = true;
soapSerializationEnvelope.setOutputSoapObject (soapObject);
HttpTransportSE httpTransportSE = new HttpTransportSE (wsdUrl);
String SOAP_ACTION = "http://tempuri.org/" + webMethod;
System.out.println (SOAP_ACTION);
try {
httpTransportSE.call (SOAP_ACTION, soapSerializationEnvelope);
System.out.println ("call end");
System.out.println (soapSerializationEnvelope.getResponse ());
if (soapSerializationEnvelope.getResponse ()! = null) {
SoapObject result = (SoapObject) soapSerializationEnvelope
.getResponse ();
System.out.println (result);
return result;
}
} Catch (IOException e) {
System.out.println ("IOException");
e.printStackTrace ();
} Catch (XmlPullParserException e) {
e.printStackTrace ();
}
return null;
Is it because I put all the data are placed in a textview toString out? How do I put the data in and listview only displays data does not show the other it?
Reply:
// Convert the SoapObject (CenterInfo) array of objects
public static CenterInfo [] getWorkOn (SoapObject obj) {
// Define an array
CenterInfo [] info = null;
try {
// If the received information
if (obj.getPropertyCount () & gt; 1) {// a central information
// Calculate the maximum array subscript
int len = obj.getPropertyCount () - 1;
// Initialize an array of objects to an array of open storage space
info = new CenterInfo [len];
// Traverse resolve SoapObject
for (int i = 0; i & lt; len; i ++) {
// Get SoapObject objects
SoapObject child = (SoapObject) obj.getProperty (i + 1);
// Value
String idStr = child.getPropertyAsString (0);
String content = child.getPropertyAsString (1);
String sender = child.getPropertyAsString (2);
String typeStr = child.getPropertyAsString (3);
String uId = child.getPropertyAsString (4);
String time = child.getPropertyAsString (5); // time
long id = Long.parseLong (idStr);
int type = Integer.parseInt (typeStr);
// Packaged into demand objects (CenterInfo), into resource array
info [i] = new CenterInfo (id, content, sender, type, uId, time);
}
}
} Catch (Exception e) {
e.printStackTrace ();
}
return info;
}
Reply:
LZ, this object is the need to resolve the drops, not directly toString ...... Do you Know?
Reply:
Aware of the need to resolve ah, someone said parsing soapObject, it was said parsing json, very puzzled do not understand ......
In the end resolve what, how to resolve?

Reply:
Parsing the object you get what you get, ah would resolve what ah? Do you get the SoapObject then to turn into other types of parsing json? ? ?
Reply:
The result is still suffocating! How to make a section corresponding to display data out of it? Why is the data front with a bloody String and anyType ah
Reply:
It depends on the how to write http://192.168.1.195:88/service1.asmx this webservice define the return data
Reply:
A better approach is to: define a good return on both sides of the data format, preferably json format, can be google, and may also be the apache, analytical tools so that you can be here in the analysis when provided by google or apache ,very convenient.
If you give the string parsing directly, then write their own methods to deal with. . . . I can not think of other ways
Reply:
Thank you for helping, and finally finally solved the problem: parsing specially wrote a soapObject classes to complete the goal, the main method:
public static ArrayList & lt; Map & lt; String, String & gt; & gt; parseSoapObjectToList (
SoapObject so) {
ArrayList & lt; Map & lt; String, String & gt; & gt; data = new ArrayList & lt; Map & lt; String, String & gt; & gt; ();
if (so! = null) {
int size = so.getPropertyCount ();
if (size & gt; 0) {
Map & lt; String, String & gt; map = null;
for (int i = 0; i & lt; so.getPropertyCount (); i ++) {
int tag = i% 3;
switch (tag) {
case 0: {
map = new HashMap & lt; String, String & gt; ();
map.put ("Id", so.getProperty (i) .toString ());
}
break;
case 1: {
map.put ("Name", so.getProperty (i) .toString ());
}
break;
case 2: {
map.put ("Status", so.getProperty (i) .toString ());
data.add (map);
}
break;
default:
break;
}
}
}
}
return data;
}
Reply:
Your method is very good, I ask you is how the query results will show up? It is used Listview
Reply:
Landlord me and you encounter the same problem you can send a demo to me it 1322566179@qq.com good
Reply:
Completeness way ah ...
Reply:
GetDealerLv2Response {GetDealerLv2Result = anyType {tbDealer = anyType {dealerId = A080502FX00001; dealerName = YuanFeng store; Longitude = 0; Latitude = 0; Addr = anyType {};}; tbDealer = anyType {dealerId = A080502FX00039; dealerName = pack Mei daily necessities store ; Longitude = 0; Latitude = 0; Addr = anyType {};}; tbDealer = anyType {dealerId = A080502FX00152; dealerName = Hing bureau shop; Longitude = 0; Latitude = 0; Addr = anyType {};}; tbDealer = anyType {dealerId = A080502FX00154; dealerName = salt wholesale unit; Longitude = 0; Latitude = 0; Addr = anyType {};}; tbDealer = anyType {dealerId = A080502FX00343; dealerName = HE Asian dollar store; Longitude = 0; Latitude = 0; Addr = anyType {};}; tbDealer = anyType {dealerId = A080502FX00701; dealerName = Zhang can test shop; Longitude = 0; Latitude = 0; Addr = anyType {};}; tbDealer = anyType {dealerId = A080502FX00713; dealerName = Xingfa shop ; Longitude = 0; Latitude = 0; Addr = anyType {};}; tbDealer = anyType {dealerId = A080502FX00939; dealerName = widely believed Wholesale Department; Longitude = 0; Latitude = 0; Addr = anyType {};}; tbDealer = anyType {dealerId = A080502FX00729; dealerName = Prosperity shop; Longitude = 0; Latitude = 0; Addr = anyType {};}; tbDealer = anyType {dealerId = A080502FX00937; dealerName = Suping store; Longitude = 0; Latitude = 0; Addr = anyType {};}; tbDealer = anyType {dealerId = A080502FX00991; dealerName = Hongjuan store; Longitude = 0; Latitude = 0; Addr = anyType {};}; tbDealer = anyType {dealerId = A080502FX01050; dealerName = Xie Hairong; Longitude = 0; Latitude = 0; Addr = anyType {};}; tbDealer = anyType {dealerId = A080502FX01067; dealerName = Huimin wholesale unit; Longitude = 0; Latitude = 0; Addr = anyType {};}; tbDealer = anyType { dealerId = A080502FX01088; dealerName = Shatin integrity store; Longitude = 0; Latitude = 0; Addr = anyType {};}; tbDealer = anyType {dealerId = A080502FX01090; dealerName = HE Liansheng Street shops; Longitude = 0; Latitude = 0; Addr = anyType {};}; tbDealer = anyType {dealerId = A080502FX01092; dealerName = Cheung Yin store; Longitude = 0; Latitude = 0; Addr = anyType {};}; tbDealer = anyType {dealerId = A080518FX00364; dealerName = red rose shops; Longitude = 0; Latitude = 0; Addr = anyType {};}; tbDealer = anyType {dealerId = A080518FX00372; dealerName = British store industry; Longitude = 0; Latitude = 0; Addr = anyType {};}; tbDealer = anyType {dealerId = A080518FX00404; dealerName = Yimin wholesale unit; Longitude = 0; Latitude = 0; Addr = anyType {};}; tbDealer = anyType {dealerId = A0805 ...
How to resolve this type of wow solve
Reply:

Reply:
Landlord, I met with the same problems you can send a complete code?
No comments:
Post a Comment