question

el_tyrell avatar image
0 Likes"
el_tyrell asked ·

"internal server error" when calling the GetSessionId method

Hello! I'm getting an "internal server error" when calling the GetSessionId method in the sandbox environment (but I also have the same error on the prod environment). onFailure gets called every time. I also tried with this url: https://api.sandbox.ebay.com/wsapi (without "callName=xxx") I tried with the production url as well (and changed the cert/app/dev ids accordingly) Any idea ? I'm using the nano library which was successfull with another call (FindingService and FindItemsByKeywordsRequest) and Android sdk 21 (targeted for version 14). Thanks for your help! I'm a little bit desperate in making this call running without error. **Here is the code:** public class TradingServicePortType { public static String eBayTradingServiceURLString = " https://api.sandbox.ebay.com/wsapi?callname=GetSessionID";; public static String eBayAppId = "****"; public static String devId = "****"; public static String certId = "****"; private static volatile EBayAPIInterface_SOAPClient client = null; public static EBayAPIInterface_SOAPClient getSharedClient() { if (client == null) { synchronized(FindingServiceClient.class) { if (client == null) { client = new EBayAPIInterface_SOAPClient(); client.setEndpointUrl(eBayTradingServiceURLString); client.setSoapVersion(SOAPVersion.SOAP12); // ebay finding service supports SOAP 1.2 client.setContentType("application/soap+xml"); client.getAsyncHttpClient().addHeader("Accept", "application/soap+xml"); //client.getAsyncHttpClient().addHeader("X-EBAY-SOA-SECURITY-APPNAME", eBayAppId); client.getAsyncHttpClient().addHeader("X-EBAY-API-APP-NAME", eBayAppId); client.getAsyncHttpClient().addHeader("X-EBAY-API-DEV-NAME", devId); client.getAsyncHttpClient().addHeader("X-EBAY-API-CERT-NAME", certId); client.getAsyncHttpClient().addHeader("X-EBAY-SOA-MESSAGE-PROTOCOL", "SOAP12"); client.getAsyncHttpClient().addHeader("X-EBAY-SOA-REQUEST-DATA-FORMAT", "SOAP"); } } } return client; } } private void testEbayGetSessionIDCall() { EBayAPIInterface_SOAPClient client = TradingServicePortType.getSharedClient(); client.setDebug(true); // enable soap message logging // Build request GetSessionIDRequestType request = new GetSessionIDRequestType(); request.ruName = "****"; // Make API call and register callbacks client.getSessionID(request, new SOAPServiceCallback () { @Override public void onSuccess( GetSessionIDResponseType responseObject) { if (com.ebay.api.trading.AckCodeType.SUCCESS == responseObject.ack) { if (responseObject.sessionID != null && responseObject.sessionID.length() > 0) { // show the title of the first found item Toast.makeText(activity, responseObject.sessionID, Toast.LENGTH_LONG).show(); } else { // no result Toast.makeText(activity, "No result", Toast.LENGTH_LONG).show(); } } else { // response resident error ErrorType errorData = responseObject.errors.get(0); Toast.makeText(activity, errorData.longMessage, Toast.LENGTH_LONG).show(); } } @Override public void onFailure(Throwable error, String errorMessage) { // http or parsing error Toast.makeText(activity, error.getMessage(), Toast.LENGTH_LONG).show(); } @Override public void onSOAPFault(Object soapFault) { // soap fault com.leansoft.nano.soap12.Fault fault = (com.leansoft.nano.soap12.Fault) soapFault; Reasontext reasonText = fault.reason.text.get(0); Toast.makeText(activity, reasonText.value, Toast.LENGTH_LONG).show(); } }); }
getsessionidinternal server e
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

el_tyrell avatar image
1 Like"
el_tyrell answered ·
I also had 2 additional things to do in order to be able to successfully call the ebay web services: - modify the nano SoapWriter class and add serializer.setPrefix(EBAY_PREFIX, EBAY_NAMESPACE); - Specify SOAP11 as version => client.setSoapVersion(SOAPVersion.SOAP11 because apparently there's a problem with the namespace uri when specifying version 1.2 Now calling GetSessionID is working ! Hope this will help someone else ... Stéphane
· Share
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

el_tyrell avatar image
0 Likes"
el_tyrell answered ·
Now I have added some missing code which builds a custom header (was apparently missing credentials), and it's a little bit better but I get a "version mismatch" error, which is maybe related to incorrect namespaces... I'm testing in SoapUI which is way easier. CustomSecurityHeaderType sec = new CustomSecurityHeaderType(); UserIdPasswordType userIdPassword = new UserIdPasswordType(); userIdPassword.appId = eBayAppId; userIdPassword.devId = devId; userIdPassword.authCert = certId; sec.credentials = userIdPassword; List list = new ArrayList(); list.add(sec); client.setCustomSOAPHeaders(list);
· Share
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.