public class EbayBookSearch { private static String appId = "Dummy"; private static String devId = "Dummy"; private static String certId = "Dummy "; private static String apiOperation = "GetSearchResults"; private static String apiVersion = "443"; private static String siteIdUS = "0"; private static String myToken = ?Dummy? private static String parametersURL = new String("?callname=" + apiOperation + "&siteid=" + siteIdUS + "&appid= " + appId + "&version=" + apiVersion + "&Routing=new"); private static String requestURL = endpointURL + parametersURL; public static void main(String[] args) { try { EBayAPIInterfaceServiceLocator serviceLocator = new EBayAPIInterfaceServiceLocator(); EBayAPIInterface service = serviceLocator.geteBayAPI(new URL(requestURL)); EBayAPISoapBindingStub serviceClient = (EBayAPISoapBindingStub) service; //Setting SOAP Header for Authentication SOAPHeaderElement registrationData = new SOAPHeaderElement("urn:ebay:apis:eBLBaseComponents", "RequesterCredentials"); registrationData.setMustUnderstand(false); registrationData.addChildElement("eBayAuthToken").addTextNode(myToken); SOAPElement developerTokens = registrationData.addChildElement("Credentials"); developerTokens.addChildElement("AppId").addTextNode(appId); developerTokens.addChildElement("DevId").addTextNode(devId); developerTokens.addChildElement("AuthCert").addTextNode(certId); serviceClient.setHeader(registrationData); //Header-End //Setting Call GetSearchResultsRequestType bookSearchObject = new GetSearchResultsRequestType(); bookSearchObject.setVersion("443"); ExternalProductIDType isbnObject = new ExternalProductIDType(); isbnObject.setValue("1575211424"); isbnObject.setType(ExternalProductCodeType.ISBN); bookSearchObject.setExternalProductID(isbnObject); //Invoking Call GetSearchResultsResponseType searchResponse = serviceClient.getSearchResults(bookSearchObject); SearchResultItemType[] booksArray = searchResponse.getSearchResultItemArray(); for(int i =0; i < booksArray.length; i++) { EbayBook bookInstance = new EbayBook(); bookInstance.setIsbn(booksArray[i].getItem().getExternalProductID()); bookInstance.setPrice(booksArray[i].getItem().getStartPrice()); } } catch (Exception e) { System.out.println(""); System.out.println("Error occured! Message is: " + e.getMessage()); System.out.println("StackTrace is: "); e.printStackTrace(); } }}
<soapenv:Header><ns1:RequesterCredentialssoapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"soapenv:mustUnderstand="0" xmlns:ns1="urn:ebay:apis:eBLBaseComponents"><ns1:eBayAuthToken>?</ns1:eBayAuthToken><ns1:Credentials><ns1:DevId>?</ns1:DevId><ns1:AppId>?</ns1:AppId><ns1:AuthCert>...</ns1:AuthCert></ns1:Credentials></ns1:RequesterCredentials></soapenv:Header>