请确定此输出格式

时间:2014-04-23 15:29:18

标签: android web-services nav

我正在为Microsoft Dynamics Nav客户端开发Android应用。当我使用它的webservice时,我收到了以下响应。谁能告诉我这是哪种输出格式?我如何在Android中解析这个?

这是代码,

  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();

                }

这里是响应,即输出字符串

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

1 个答案:

答案 0 :(得分:2)

看起来这只是对象的字符串描述,这是您使用result.toString();

的结果

This might be of some help了解如何正确解析结果。

例如,您可以像这样获取对象的第一个属性:

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

假设第一个属性是字符串。如果您希望使用其他类型,则可能需要解析字符串。

似乎也应该可以按名称获取属性:

result.getProperty("myProperty").toString();