Skip to content
This repository has been archived by the owner on Nov 6, 2019. It is now read-only.

findItemsByProduct: Unexpected character '@' (code 64) in content after #35

Open
eswarreddy43 opened this issue Jun 2, 2016 · 2 comments

Comments

@eswarreddy43
Copy link

Hello Dev,

I am using this nodejs-ebay-api module for searching the book using ISBN in app. So I took reference of this findItemsByProduct from eBay developers site. I have tried my code like following

var parameters = {
    productId:{ '__value__': "9788172234980", '@type': 'ISBN' },
    outputSelector: ['AspectHistogram'],
    paginationInput: {
        entriesPerPage: 10
    }
};
ebay.xmlRequest({
    serviceName: 'Finding',
    opType: 'findItemsByProduct',
    appId: 'My-app-id',
    params: parameters
}, function itemsCallback(error, itemsResponse) {
    if (error) throw error;
    var items = itemsResponse.searchResult.item;
    console.log('Found', items.length, 'items');
    //console.log(items[0].sellingStatus.currentPrice.amount);
    for (var i = 0; i < items.length; i++) {
        console.log(items[i].title);
    }
});

But getting error as

EbayClientError: Bad response status code 500 <?xml version='1.0' encoding='UTF-8'?><errorMessage xmlns="http://www.ebay.com/marketplace/search/v1/services"><error><errorId>5014</errorId><domain>CoreRuntime</domain><severity>Error</severity><category>System</category><message>Error reading from XML stream: Unexpected character '@' (code 64) in content after '&lt;' (malformed start element?).
 at javax.xml.stream.SerializableLocation@a550a55</message><subdomain>Comm_Recv</subdomain><parameter name="Param1">Unexpected character '@' (code 64) in content after '&lt;' (malformed start element?).
 at javax.xml.stream.SerializableLocation@a550a55</parameter></error></errorMessage>
    at Request._callback (/home/user/node_modules/ebay-api/lib/xml-request.js:151:23)
    at Request.self.callback (/home/user/node_modules/request/request.js:200:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:191:7)
    at Request.<anonymous> (/home/user/node_modules/request/request.js:1067:10)
    at emitOne (events.js:101:20)
    at Request.emit (events.js:188:7)
    at IncomingMessage.<anonymous> (/home/user/node_modules/request/request.js:988:12)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)

Please suggest me on this.

@dunaevsky
Copy link

dunaevsky commented Jul 8, 2017

If this is still relevant, or interests anyone.

To add the attribute <productId type="ReferenceID">53039031</productId>
with the xml module which ebay-api use, you should take a different approach while building the xml.

It's easy to add.
You can edit buildXmlInput(options) function in xml-request.js.
if (options.serviceName === 'Finding') { root.push({'_attr': {'xmlns': 'http://www.ebay.com/marketplace/search/v1/services'}}); /////////////////Added code to support find items by product/////////////////////////////// if(options.opType=== 'findItemsByProduct'){ root.push({'productId': [{ '_attr': { 'type': 'ReferenceID'}}, options.productId]}); } ////////////////////End added code//////////////////////////////////////// }

You should also add a productId field in the options Object of course.

@bhushankummar
Copy link

bhushankummar commented Oct 11, 2018

@eswarreddy43
The alternative is here : https://www.npmjs.com/package/ebay-node-client#search-1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants