Abstraction Builder

Building simple and elegant programming abstractions

Nano Tutorial 4 - Hello eBay Shopping

| Comments

This is the fourth tutorial of Nano tutorial series, in this tutorial, I will show you how to integrate Nano with eBay Shopping Web Service, if you are not familiar with this service, just have a quick review on its official site, basically, eBay Shopping service allows you to search for eBay items, products and reviews, user info, and popular items and searches. In previous tutorials, I showed you how to integrate Nano with SOAP based services, while in this tutorial, I will show you how to interate Nano with XML based service, the eBay Shopping service just supports XML message format.

The source of this tutorial is here.

Step 0 - Prerequisite

I suppose you have already read previous Nano tutorials, at least 1 and 2, and basically you should know:

  • The wsdl driven development process supported by Nano.
  • How to add the Nano library and the generated service proxy into your Android project.

Step 1 - Generate Java Proxy from WSDL

Download mwsc and run following command in terminal to generate the proxy:

1
bin\mwsc.bat -nano -d generated -ebayshopping http://developer.ebay.com/webservices/latest/ShoppingService.wsdl

Depends on the network speed, you may need to wait a few moments to let the code generator download the wsdl and generate code, you may also download the wsdl and run the code generator with a local wsdl.

A few comments about the codegen options:

  • The code generator will throw many warnings, say that the wsdl violates some schema rule, just ignore them, it’s ok as long as the final code is generated correctly.
  • I have added a special -ebayshopping codegen option, this is because eBay Shopping service needs a per-call operation name HTTP header(eBay Finding service also needs a similar but different header), I added this special flag in the code generator to let it generate the header for me, since I don’t want to add this header everytime I call an eBay Shopping service, so this is just a special flag for eBay Shopping services and for demo only, or a hidden feature, not a generic codegen option.
  • By default, the code generator will derive package name from target namespace in wsdl, if necessary, you can override package name with -p option.
  • The generator will generate both SOAP and XML clients for us, in the client sub-folder.

Step 2 - Create New Android Project, Add Nano Library and Generated Proxy into Your Project

Create a simple Android project called HelloeBayShopping in eclipse(or other IDE you prefer), then:

  1. Download latest nano library jar and add it to the libs folder of your Android project.
  2. Drag the above generated proxy into the src folder of your Android project.
  3. Add following user permissions in the AndroidManifest.xml file to enable network access.
1
2
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Now build the project to ensure it can build successfully.

The code generation will generate both SOAP and XML based interfaces from eBay Shopping wsdl for us, since we will use XML based interface in this tutorial, you may now review the generated eBay Shopping service XML interface to learn what kinds of functions are provided by eBay Shopping service, and what kinds of parameters are needed to call the service, the interface is posted below:

ShoppingInterface_XMLClient.java source
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
// Generated by wsdl compiler for android/java
// DO NOT CHANGE!
package ebay.apis.eblbasecomponents.client;


import com.leansoft.nano.ws.XMLServiceCallback;
import com.leansoft.nano.ws.NanoXMLClient;
import ebay.apis.eblbasecomponents.GetSingleItemResponseType;
import ebay.apis.eblbasecomponents.GetShippingCostsResponseType;
import ebay.apis.eblbasecomponents.GetCategoryInfoResponseType;
import ebay.apis.eblbasecomponents.GeteBayTimeRequestType;
import ebay.apis.eblbasecomponents.GetCategoryInfoRequestType;
import ebay.apis.eblbasecomponents.GetUserProfileRequestType;
import ebay.apis.eblbasecomponents.GetUserProfileResponseType;
import ebay.apis.eblbasecomponents.GetSingleItemRequestType;
import ebay.apis.eblbasecomponents.FindPopularSearchesRequestType;
import ebay.apis.eblbasecomponents.FindHalfProductsResponseType;
import ebay.apis.eblbasecomponents.FindPopularItemsRequestType;
import ebay.apis.eblbasecomponents.FindReviewsAndGuidesRequestType;
import ebay.apis.eblbasecomponents.FindPopularSearchesResponseType;
import ebay.apis.eblbasecomponents.FindProductsResponseType;
import ebay.apis.eblbasecomponents.GeteBayTimeResponseType;
import ebay.apis.eblbasecomponents.GetMultipleItemsResponseType;
import ebay.apis.eblbasecomponents.GetShippingCostsRequestType;
import ebay.apis.eblbasecomponents.GetItemStatusResponseType;
import ebay.apis.eblbasecomponents.FindPopularItemsResponseType;
import ebay.apis.eblbasecomponents.GetMultipleItemsRequestType;
import ebay.apis.eblbasecomponents.FindProductsRequestType;
import ebay.apis.eblbasecomponents.FindReviewsAndGuidesResponseType;
import ebay.apis.eblbasecomponents.FindHalfProductsRequestType;
import ebay.apis.eblbasecomponents.GetItemStatusRequestType;


/**
 This class is the XML client to the ShoppingInterface Web Service.
*/
public class ShoppingInterface_XMLClient extends NanoXMLClient {


    /**
     public method
    */
    public void findHalfProducts(FindHalfProductsRequestType requestObject, XMLServiceCallback<FindHalfProductsResponseType> serviceCallback) {

        super.getAsyncHttpClient().addHeader("X-EBAY-API-CALL-NAME", "FindHalfProducts");

        super.invoke(requestObject, serviceCallback, FindHalfProductsResponseType.class);
    }

    /**
     public method
    */
    public void findPopularItems(FindPopularItemsRequestType requestObject, XMLServiceCallback<FindPopularItemsResponseType> serviceCallback) {

        super.getAsyncHttpClient().addHeader("X-EBAY-API-CALL-NAME", "FindPopularItems");

        super.invoke(requestObject, serviceCallback, FindPopularItemsResponseType.class);
    }

    /**
     public method
    */
    public void findPopularSearches(FindPopularSearchesRequestType requestObject, XMLServiceCallback<FindPopularSearchesResponseType> serviceCallback) {

        super.getAsyncHttpClient().addHeader("X-EBAY-API-CALL-NAME", "FindPopularSearches");

        super.invoke(requestObject, serviceCallback, FindPopularSearchesResponseType.class);
    }

    /**
     public method
    */
    public void findProducts(FindProductsRequestType requestObject, XMLServiceCallback<FindProductsResponseType> serviceCallback) {

        super.getAsyncHttpClient().addHeader("X-EBAY-API-CALL-NAME", "FindProducts");

        super.invoke(requestObject, serviceCallback, FindProductsResponseType.class);
    }

    /**
     public method
    */
    public void findReviewsAndGuides(FindReviewsAndGuidesRequestType requestObject, XMLServiceCallback<FindReviewsAndGuidesResponseType> serviceCallback) {

        super.getAsyncHttpClient().addHeader("X-EBAY-API-CALL-NAME", "FindReviewsAndGuides");

        super.invoke(requestObject, serviceCallback, FindReviewsAndGuidesResponseType.class);
    }

    /**
     public method
    */
    public void getCategoryInfo(GetCategoryInfoRequestType requestObject, XMLServiceCallback<GetCategoryInfoResponseType> serviceCallback) {

        super.getAsyncHttpClient().addHeader("X-EBAY-API-CALL-NAME", "GetCategoryInfo");

        super.invoke(requestObject, serviceCallback, GetCategoryInfoResponseType.class);
    }

    /**
     public method
    */
    public void getItemStatus(GetItemStatusRequestType requestObject, XMLServiceCallback<GetItemStatusResponseType> serviceCallback) {

        super.getAsyncHttpClient().addHeader("X-EBAY-API-CALL-NAME", "GetItemStatus");

        super.invoke(requestObject, serviceCallback, GetItemStatusResponseType.class);
    }

    /**
     public method
    */
    public void getMultipleItems(GetMultipleItemsRequestType requestObject, XMLServiceCallback<GetMultipleItemsResponseType> serviceCallback) {

        super.getAsyncHttpClient().addHeader("X-EBAY-API-CALL-NAME", "GetMultipleItems");

        super.invoke(requestObject, serviceCallback, GetMultipleItemsResponseType.class);
    }

    /**
     public method
    */
    public void getShippingCosts(GetShippingCostsRequestType requestObject, XMLServiceCallback<GetShippingCostsResponseType> serviceCallback) {

        super.getAsyncHttpClient().addHeader("X-EBAY-API-CALL-NAME", "GetShippingCosts");

        super.invoke(requestObject, serviceCallback, GetShippingCostsResponseType.class);
    }

    /**
     public method
    */
    public void getSingleItem(GetSingleItemRequestType requestObject, XMLServiceCallback<GetSingleItemResponseType> serviceCallback) {

        super.getAsyncHttpClient().addHeader("X-EBAY-API-CALL-NAME", "GetSingleItem");

        super.invoke(requestObject, serviceCallback, GetSingleItemResponseType.class);
    }

    /**
     public method
    */
    public void getUserProfile(GetUserProfileRequestType requestObject, XMLServiceCallback<GetUserProfileResponseType> serviceCallback) {

        super.getAsyncHttpClient().addHeader("X-EBAY-API-CALL-NAME", "GetUserProfile");

        super.invoke(requestObject, serviceCallback, GetUserProfileResponseType.class);
    }

    /**
     public method
    */
    public void geteBayTime(GeteBayTimeRequestType requestObject, XMLServiceCallback<GeteBayTimeResponseType> serviceCallback) {

        super.getAsyncHttpClient().addHeader("X-EBAY-API-CALL-NAME", "GeteBayTime");

        super.invoke(requestObject, serviceCallback, GeteBayTimeResponseType.class);
    }


}

All the methods in the interface follow same calling paradigm - you call the service with required request object and a callback object implementing interface XMLServiceCallback.

You may also compare the XML interface with the SOAP interface, they are almost similar, except that SOAP interface will give you an additional SOAPFault object in the failure callback(in SOAPServiceCallback), this is obvious, since XML based service has no concept of SOAPFault, usually, the response error is returned as response resident error(RRE) in the XML response message.

Step 3 - Implement Appliction Logic and UI, Call Proxy to Invoke Web Service as Needed.

First, create a shared service client as below:

ShoppingServiceClient.java source
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.ebay.service.shopping;

import ebay.apis.eblbasecomponents.client.ShoppingInterface_XMLClient;

public class ShoppingServiceClient {
  
  // production
  public static String eBayShoppingServiceURLString = "http://open.api.ebay.com/shopping?";
  // sandbox
  //public static final String eBayShoppingServiceURLString = "http://open.api.sandbox.ebay.com/shopping";
  public static String eBayAppId = "YOUR APPID HERE";
  public static String targetAPIVersion = "809";
  /**
 for site id list, see http://developer.ebay.com/DevZone/shopping/docs/CallRef/types/SiteCodeType.html
 */
  public static String targetSiteid = "0";
  
  private static volatile ShoppingInterface_XMLClient client = null;
  
  public static ShoppingInterface_XMLClient getSharedClient() {
      if (client == null) {
          synchronized(ShoppingServiceClient.class) {
              if (client == null) {
                  client = new ShoppingInterface_XMLClient();
                  client.setEndpointUrl(eBayShoppingServiceURLString);
                  client.getAsyncHttpClient().addHeader("X-EBAY-API-APP-ID", eBayAppId);
                  client.getAsyncHttpClient().addHeader("X-EBAY-API-REQUEST-ENCODING", "XML");
                  client.getAsyncHttpClient().addHeader("X-EBAY-API-VERSION", targetAPIVersion);
                  client.getAsyncHttpClient().addHeader("X-EBAY-API-SITE-ID", targetSiteid);
              }
          }
      }
      
      return client;
  }

}

Like eBay Finding service, the eBay Shopping service needs a few HTTP headers set to work, let me give more comments:

  1. eBay Shopping service needs to set a few HTTP headers to work, for a list of required headers, please refer to doc here.
  2. One mandatory header for eBay Shopping service is eBayAppId, you need to register on eBay developer site as an eBay developer then get this id, before your can run this demo, you must fill in your own eBayAppId in the shared client.
  3. Another mandatory header for eBay Shopping service is targetAPIVersion, aka the API version you want to use, usually, you use the latest one, at the time of this writing, the latest version is 809, you may update this according to your real needs.
  4. We also set X-EBAY-API-REQUEST-ENCODING to XML, indicating we want to call XML service supported by eBay Shopping service.

Now the UI part and application logic, for this hello world like sample, we just need a EditText for keyword input and Button to trigger eBay search by invoking listening method onClick which will indirectly call eBay Shopping service through the proxy, fairly simple, see the full application logic in MainActivity class below:

MainActivity.java source
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package com.leansoft.nano.sample;

import com.ebay.service.shopping.ShoppingServiceClient;
import com.leansoft.nano.ws.XMLServiceCallback;

import ebay.apis.eblbasecomponents.AckCodeType;
import ebay.apis.eblbasecomponents.ErrorType;
import ebay.apis.eblbasecomponents.FindPopularItemsRequestType;
import ebay.apis.eblbasecomponents.FindPopularItemsResponseType;
import ebay.apis.eblbasecomponents.SimpleItemType;
import ebay.apis.eblbasecomponents.client.ShoppingInterface_XMLClient;

import android.os.Bundle;
import android.app.Activity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class MainActivity extends Activity {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      
      Button searchButton = (Button) this.findViewById(R.id.search_button);
      
      searchButton.setOnClickListener(new OnClickListener() {

          @Override
          public void onClick(View arg0) {
              // Get shared client
              ShoppingInterface_XMLClient client = ShoppingServiceClient.getSharedClient();
              client.setDebug(true); // enable xml message logging
          
              // Build request object
              FindPopularItemsRequestType request = new FindPopularItemsRequestType();
              String keywords = ((EditText)findViewById(R.id.keyword_input)).getText().toString();
              request.queryKeywords = keywords;
              // only need one item for demo
              request.maxEntries = 1;
              
                // make API call with registered callbacks
              client.findPopularItems(request, new XMLServiceCallback<FindPopularItemsResponseType>() {

                  @Override
                  public void onSuccess(
                          FindPopularItemsResponseType responseObject) {

                      if (AckCodeType.SUCCESS == responseObject.ack) {
                          if (responseObject.itemArray.item.size() > 0) {
                              // show the title of first found item
                              SimpleItemType item = responseObject.itemArray.item.get(0);
                              Toast.makeText(MainActivity.this, item.title, Toast.LENGTH_LONG).show();
                          } else { // no result
                              Toast.makeText(MainActivity.this, "No result", Toast.LENGTH_LONG).show();
                          }
                      } else { // response resident error
                          ErrorType error = responseObject.errors.get(0);
                          Toast.makeText(MainActivity.this, error.shortMessage, Toast.LENGTH_LONG).show();
                      }
                  }

                  @Override
                  public void onFailure(Throwable error, String errorMessage) { // http or parsing error
                      if (errorMessage != null) {
                          Toast.makeText(MainActivity.this, errorMessage, Toast.LENGTH_LONG).show();
                      } else {
                          Toast.makeText(MainActivity.this, error.getMessage(), Toast.LENGTH_LONG).show();
                      }
                  }
                  
              });
          }
          
      });
  }


}

More comments to the serivce call code:

  1. I’ve added comments in the code so the whole service call flow should be easy to understand.
  2. We used the eBay Shopping findPopularItems call, which takes a keyword as input, and will return a list of matched popular items on eBay, for demo, we just need one item to display, so we set maxEntries to 1.
  3. In the success handling logic, we show the title of the returned item..
  4. eBay Shopping service supports response resident error(RRE), so even we get a success response, we still need to check the response for resident error and handle it accordingly.

Final Step - Run the Demo

Let’s run the demo on simulator, see a screen shot below:

and the debug output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
04-18 02:29:54.646: D/NanoXMLClient(279): Sending request to : http://open.api.ebay.com/shopping?
04-18 02:29:54.646: D/NanoXMLClient(279): Request HTTP headers : 
04-18 02:29:54.646: D/NanoXMLClient(279): {
04-18 02:29:54.646: D/NanoXMLClient(279):     X-EBAY-API-APP-ID="********"
04-18 02:29:54.646: D/NanoXMLClient(279):     X-EBAY-API-SITE-ID="0"
04-18 02:29:54.646: D/NanoXMLClient(279):     X-EBAY-API-CALL-NAME="FindPopularItems"
04-18 02:29:54.646: D/NanoXMLClient(279):     X-EBAY-API-REQUEST-ENCODING="XML"
04-18 02:29:54.646: D/NanoXMLClient(279):     Accept="text/xml"
04-18 02:29:54.646: D/NanoXMLClient(279):     X-EBAY-API-VERSION="809"
04-18 02:29:54.646: D/NanoXMLClient(279): }
04-18 02:29:54.646: D/NanoXMLClient(279): Request message : 
04-18 02:29:54.646: D/NanoXMLClient(279): <?xml version='1.0' encoding='UTF-8' ?>
04-18 02:29:54.646: D/NanoXMLClient(279): <FindPopularItemsRequest xmlns="urn:ebay:apis:eBLBaseComponents">
04-18 02:29:54.646: D/NanoXMLClient(279):   <QueryKeywords>android</QueryKeywords>
04-18 02:29:54.646: D/NanoXMLClient(279):   <MaxEntries>1</MaxEntries>
04-18 02:29:54.646: D/NanoXMLClient(279): </FindPopularItemsRequest>
04-18 02:29:55.926: D/dalvikvm(279): GC_FOR_MALLOC freed 6860 objects / 348416 bytes in 50ms
04-18 02:29:55.936: D/XMLHttpResponseHandler(279): Response HTTP status : 200
04-18 02:29:55.936: D/XMLHttpResponseHandler(279): Response HTTP headers : 
04-18 02:29:55.936: D/XMLHttpResponseHandler(279): {
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):     X-EBAY-ESB-GUID="urn:uuid:3CD859772BC3C3F65827459259312600922-1430899813"
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):     Expires="Sat, 25 Dec 1999 00:00:00 GMT"
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):     Last-Modified="Thu, 18 Apr 2013 02:30:21 GMT"
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):     Connection="Keep-Alive"
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):     Server="Apache-Coyote/1.1"
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):     Pragma="no-cache"
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):     Cache-Control="no-cache"
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):     X-EBAY-API-BUILD-TAG="E819_CORE_APILW2_15990919_R1"
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):     Transfer-Encoding="chunked"
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):     Date="Thu, 18 Apr 2013 02:30:21 GMT"
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):     X-EBAY-API-POOL-NAME="___cDRidW9rdDdlaHFg"
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):     X-EBAY-API-SERVER-NAME="___dm97MmQ3MWYrYWU1PigyNSg/NSs3NTUrNDMyPz43OzU="
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):     Content-Encoding="gzip"
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):     Content-Type="text/xml;charset=utf-8"
04-18 02:29:55.936: D/XMLHttpResponseHandler(279): }
04-18 02:29:55.936: D/XMLHttpResponseHandler(279): Response message : 
04-18 02:29:55.936: D/XMLHttpResponseHandler(279): <?xml version="1.0" encoding="UTF-8"?>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):   <FindPopularItemsResponse xmlns="urn:ebay:apis:eBLBaseComponents">
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):    <Timestamp>2013-04-18T02:30:21.938Z</Timestamp>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):    <Ack>Success</Ack>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):    <Build>E819_CORE_APILW2_15990919_R1</Build>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):    <Version>819</Version>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):    <ItemArray>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):     <Item>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):      <ItemID>170848931666</ItemID>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):      <EndTime>2013-04-20T17:07:32.000Z</EndTime>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):      <ViewItemURLForNaturalSearch>http://www.ebay.com/itm/HTC-Droid-Incredible-Verizon-Wireless-Wifi-8-0-MP-Camera-8GB-Android-Cell-Phone-/170848931666</ViewItemURLForNaturalSearch>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):      <ListingType>FixedPriceItem</ListingType>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):      <GalleryURL>http://thumbs3.ebaystatic.com/pict/1708489316668080_52.jpg</GalleryURL>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):      <PrimaryCategoryID>9355</PrimaryCategoryID>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):      <PrimaryCategoryName>Cell Phones & Accessories:Cell Phones & Smartphones</PrimaryCategoryName>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):      <BidCount>18835</BidCount>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):      <ConvertedCurrentPrice currencyID="USD">64.95</ConvertedCurrentPrice>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):      <ListingStatus>Active</ListingStatus>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):      <TimeLeft>P2DT14H37M11S</TimeLeft>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):      <Title>HTC Droid Incredible Verizon Wireless Wifi 8.0 MP Camera 8GB Android Cell Phone</Title>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):      <ShippingCostSummary>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):       <ShippingServiceCost currencyID="USD">0.0</ShippingServiceCost>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):       <ShippingType>Flat</ShippingType>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):       <ListedShippingServiceCost currencyID="USD">0.0</ListedShippingServiceCost>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):      </ShippingCostSummary>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):      <WatchCount>10901</WatchCount>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):      <DiscountPriceInfo>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):       <OriginalRetailPrice currencyID="USD">500.0</OriginalRetailPrice>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):       <PricingTreatment>STP</PricingTreatment>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):       <SoldOneBay>false</SoldOneBay>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):       <SoldOffeBay>false</SoldOffeBay>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):      </DiscountPriceInfo>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):     </Item>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):    </ItemArray>
04-18 02:29:55.936: D/XMLHttpResponseHandler(279):   </FindPopularItemsResponse>

let’s also try a soap fault case, for example, if you forget to fill in your eBayAppId in the shared client, then you will get:

This is just a bare minimum eBay Shopping service based application, for a demo with more functions, please see the eBayDemoApp sample in the sample\webservice folder of Nano source, eBayDemoApp is a composite app which calls two eBay services behind, this app searches eBay by calling eBay Finding service, shows a list of matched items on UI, when an item is clicked, it will show item details by calling eBay Shopping service, see a screen shot below.

Now it’s your turn to create Android applications based on eBay Shopping and eBay Finding web services, see your next great service based app.

Comments