Question

I was developing an Android app for Microsoft Dynamics Nav client. When I used its webservice, I got the following response. Can anybody tell me which output format this is? And how I can parse this in Android?

Here is the code,

  SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

                       envelope.dotNet = true;   
                       envelope.setOutputSoapObject(request);   
                      // HttpTransportSE transport = new HttpTransportSE(url);  

                       NtlmTransport ntlm = new NtlmTransport(url, "dell", "cubic", "192.168.0.2","Dell");
                       ntlm.call(soap_action, envelope); // Receive Error here!
                            SoapObject result = (SoapObject) envelope.getResponse();

                            output = result.toString();

                            Log.i("Login", "Login "+output);

                }
                catch (Exception e)
                {
                    e.printStackTrace();
                           output = e.toString();

                }

and here is response, ie output string

anyType{SalesOrders=anyType{Key=28;JAAAAACLAQAAAAJ7BDEAMAAwADE=6;4302690;; No=1001; Posting_Date=2015-01-22; Document_Date=2015-01-22; Requested_Delivery_Date=0001-01-01; Status=Open; Due_Date=0001-01-01; Payment_Discount_Percent=0; Shipment_Date=2015-01-22; Shipping_Advice=Partial; Job_Queue_Status=_blank_; }; 
SalesOrders=anyType{Key=28;JAAAAACLAQAAAAJ7BDEAMAAwADI=6;4302700;; No=1002; Posting_Date=2015-01-22; Document_Date=2015-01-22; Requested_Delivery_Date=0001-01-01; Status=Open; Due_Date=0001-01-01; Payment_Discount_Percent=0; Shipment_Date=2015-01-22; Shipping_Advice=Partial; Job_Queue_Status=_blank_; }; 
SalesOrders=anyType{Key=32;JAAAAACLAQAAAAJ7BjEAMAAxADAAMAA16;4302710;; No=101005; Sell_to_Customer_No=30000; Sell_to_Customer_Name=John Haddock Insurance Co.; Sell_to_Post_Code=GB-MO2 4RT; Sell_to_Contact=Miss Patricia Doyle; Bill_to_Customer_No=30000; Bill_to_Name=John Haddock Insurance Co.; Bill_to_Post_Code=GB-MO2 4RT; Bill_to_Contact=Miss Patricia Doyle; Ship_to_Name=John Haddock Insurance Co.; Ship_to_Post_Code=GB-MO2 4RT; Ship_to_Contact=Miss Patricia Doyle; Shortcut_Dimension_1_Code=SALES; Posting_Date=2015-01-23; Salesperson_Code=PS; Document_Date=2015-01-08; Requested_Delivery_Date=0001-01-01; Status=Released; Payment_Terms_Code=CM; Due_Date=2015-01-31; Payment_Discount_Percent=0; Shipment_Method_Code=EXW; Shipment_Date=2015-01-08; Shipping_Advice=Partial; Job_Queue_Status=_blank_; }; 
SalesOrders=anyType{Key=32;JAAAAACLAQAAAAJ7BjEAMAAxADAAMAA56;4302720;; No=101009; Sell_to_Customer_No=38128456; Sell_to_Customer_Name=MEMA Ljubljana d.o.o.; Sell_to_Post_Code=SI-1000; Sell_to_Country_Region_Code=SI; Sell_to_Contact=g. Bostjan Lukan; Bill_to_Customer_No=38128456; Bill_to_Name=MEMA Ljubljana d.o.o.; Bill_to_Post_Code=SI-1000; Bill_to_Country_Region_Code=SI; Bill_to_Contact=g. Bostjan Lukan; Ship_to_Name=MEMA Ljubljana d.o.o.; Ship_to_Post_Code=SI-1000; Ship_to_Country_Region_Code=SI; Ship_to_Contact=g. Bostjan Lukan; Shortcut_Dimension_1_Code=SALES; Posting_Date=2015-01-25; Location_Code=RED; Salesperson_Code=JR; Currency_Code=EUR; Document_Date=2015-01-16; Requested_Delivery_Date=0001-01-01; Status=Released; Payment_Terms_Code=1M(8D); Due_Date=2015-02-16; Payment_Discount_Percent=2; Shipment_Method_Code=EXW; Shipment_Date=2015-01-16; Shipping_Advice=Partial; Job_Queue_Status=_blank_; }; 
SalesOrders=anyType{Key=32;JAAAAACLAQAAAAJ7BjEAMAAxADAAMQAx6;4302730;; No=101011; Sell_to_Customer_No=43687129; Sell_to_Customer_Name=Designstudio Gmunden; Sell_to_Post_Code=AT-4810; Sell_to_Country_Region_Code=AT; Sell_to_Contact=Fr. Birgitte Vestphael; Bill_to_Customer_No=43687129; Bill_to_Name=Designstudio Gmunden; Bill_to_Post_Code=AT-4810; Bill_to_Country_Region_Code=AT; Bill_to_Contact=Fr. Birgitte Vestphael; Ship_to_Name=Designstudio Gmunden; Ship_to_Post_Code=AT-4810; Ship_to_Country_Region_Code=AT; Ship_to_Contact=Fr. Birgitte Vestphael; Shortcut_Dimension_1_Code=SALES; Posting_Date=2015-01-10; Location_Code=RED; Salesperson_Code=JR; Currency_Code=EUR; Document_Date=2015-01-09; Requested_Delivery_Date=0001-01-01; Status=Released; Payment_Terms_Code=1M(8D); Due_Date=2015-02-09; Payment_Discount_Percent=2; Shipment_Method_Code=EXW; Shipment_Date=2015-01-09; Shipping_Advice=Partial; Job_Queue_Status=_blank_; }; 
SalesOrders=anyType{Key=32;JAAAAACLAQAAAAJ7BjEAMAAxADAAMQAz6;4302740;; No=101013; Sell_to_Customer_No=46897889; Sell_to_Customer_Name=Englunds Kontorsmöbler AB; Sell_to_Post_Code=SE-600 03; Sell_to_Country_Region_Code=SE; Bill_to_Customer_No=46897889; Bill_to_Name=Englunds Kontorsmöbler AB; Bill_to_Post_Code=SE-600 03; Bill_to_Country_Region_Code=SE; Ship_to_Name=Englunds Kontorsmöbler AB; Ship_to_Post_Code=SE-600 03; Ship_to_Country_Region_Code=SE; Shortcut_Dimension_1_Code=SALES; Posting_Date=2015-01-18; Location_Code=YELLOW; Salesperson_Code=JR; Currency_Code=SEK; Document_Date=2015-01-15; Requested_Delivery_Date=0001-01-01; Status=Released; Payment_Terms_Code=CM; Due_Date=2015-01-31; Payment_Discount_Percent=0; Shipment_Method_Code=EXW; Shipment_Date=2015-01-15; Shipping_Adv
Was it helpful?

Solution

Looks like that is just the string description for the object, which is a result of you using result.toString();

This might be of some help for learning how to parse the result correctly.

For example, you can get the first property of the object like so:

SoapObject result = (SoapObject) envelope.getResponse();
String firstProperty = result.getProperty(0).toString();

Which assumes the first property is a string. You may need to parse the string if you expect a different type.

It seems it should also be possible to get the property by name like so:

result.getProperty("myProperty").toString();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top