Developers Program

.NET sample in C# for making a SOAP call to a non-US site

Published: June 14 2007, 3:22:00 PMยทUpdated: August 02 2022, 4:35:01 PM

Products

Question

I need to make a GeteBayDetails call to get the ShippingServices for UK using SOAP. How should I specify the sites?

Answer

Summary

You need to specify the required siteid in the server URL against which you are making the SOAP request. For instance, if you are need to get the shipping services for UK, you need to set the numeric value of the siteid parameter to 3. Detailed Description

Here is a C# .NET example for making a SOAP call to GeteBayDetails for getting the Shipping Services for UK. In this sample, eBaySOAP is a reference to the eBay Web Service.

You can add a web reference to the latest version of the WSDL using the following url:
http://developer.ebay.com/webservices/latest/ebaySvc.wsdl

>

private void SOAPCall()

{

eBaySOAP.eBayAPIInterfaceService service = new eBaySOAP.eBayAPIInterfaceService();

string endpoint = "https://api.sandbox.ebay.com/wsapi";

string callName = "GeteBayDetails";

string siteId = "3";

string version = "1031";

// Build the request URL and set the siteid

string requestURL = endpoint + "?callname=" + callName
+ "&siteid=" + siteId
+ "&appid=" + appId + "&version=" + version + "&routing=default";

// Assign the request URL to the servicelocator.

service.Url = requestURL;

// Set credentials

service.RequesterCredentials = new eBaySOAP.CustomSecurityHeaderType();

service.RequesterCredentials.eBayAuthToken = "token"; //use your token

eBaySOAP.GeteBayDetailsRequestType request = new eBaySOAP.GeteBayDetailsRequestType();

request.DetailName = new eBaySOAP.DetailNameCodeType[1];

request.DetailName.SetValue(eBaySOAP.DetailNameCodeType.ShippingServiceDetails, 0);

request.Version = version;

eBaySOAP.GeteBayDetailsResponseType response = service.GeteBayDetails(request);

}

Additional Resources
>

private void SOAPCall()

{

eBaySOAP.eBayAPIInterfaceService service = new eBaySOAP.eBayAPIInterfaceService();

string endpoint = "https://api.sandbox.ebay.com/wsapi";

string callName = "GeteBayDetails";

string siteId = "3";

string version = "1031";

// Build the request URL and set the siteid

string requestURL = endpoint + "?callname=" + callName
+ "&siteid=" + siteId
+ "&appid=" + appId + "&version=" + version + "&routing=default";

// Assign the request URL to the servicelocator.

service.Url = requestURL;

// Set credentials

service.RequesterCredentials = new eBaySOAP.CustomSecurityHeaderType();

service.RequesterCredentials.eBayAuthToken = "token"; //use your token

eBaySOAP.GeteBayDetailsRequestType request = new eBaySOAP.GeteBayDetailsRequestType();

request.DetailName = new eBaySOAP.DetailNameCodeType[1];

request.DetailName.SetValue(eBaySOAP.DetailNameCodeType.ShippingServiceDetails, 0);

request.Version = version;

eBaySOAP.GeteBayDetailsResponseType response = service.GeteBayDetails(request);

}

How well did this answer your question?