Mats Henricson


Hi!

Is it possible to generate Java code from the production WSDL files, and then just change
the SOAP endpoint address to access the sandbox instead Something along this line:

AdministrationLocator locator = new AdministrationLocator();
if (sandbox) {
String newAddress = "a sandbox admin URI";
locator.setAdministrationSoapEndpointAddress(newAddress);
}

If so, what would the newAddress be in the code example above

Also, what is the recommended way to get support This forum, or email to
msnacapi@microsoft.com

Best regards,

Mats Henricson
Keybroker, Stockholm, Sweden




Re: Do I need the sandbox WSDL files?

Jeff Dillon - MSFT


The following code works for me, just using the proxies generated from Production:

administrationUrl = "https://adcenterapi.microsoft.com/V4/administration/administration.asmx wsdl";
customerManagementUrl = "https://adcenterapi.microsoft.com/v4/CustomerManagement/CustomerManagement.asmx wsdl";
campaignManagementUrl = "https://adcenterapi.microsoft.com/v4/CampaignManagement/CampaignManagement.asmx wsdl";

//administrationUrl = "https://sandboxapi.adcenter.microsoft.com/v4/Administration/Administration.asmx wsdl";
//customerManagementUrl = "https://sandboxapi.adcenter.microsoft.com/v4/CustomerManagement/CustomerManagement.asmx wsdl";

AdministrationLocator myAdministrationLocator = new AdministrationLocator();
CustomerManagementLocator myCustomerManagementLocator = new CustomerManagementLocator();
CampaignManagementLocator myCampaignManagementLocator = new CampaignManagementLocator();


AdministrationSoap myAdministration = myAdministrationLocator.getAdministrationSoap(new URL(administrationUrl));
CustomerManagementSoap myCustomerManagement = myCustomerManagementLocator.getCustomerManagementSoap(new URL(customerManagementUrl));
CampaignManagementSoap myCampaignManagement = myCampaignManagementLocator.getCampaignManagementSoap(new URL(campaignManagementUrl));

ApiUserAuthHeader myApiUserAuthHeader = new ApiUserAuthHeader();


myApiUserAuthHeader.setUserName("API_test"); //Modify to use your value.
myApiUserAuthHeader.setPassword("password"); //Modify to use your value.
myApiUserAuthHeader.setUserAccessKey("test"); //Modify to use your value.

((AdministrationSoapStub) myAdministration).setHeader("http://adcenter.microsoft.com/syncapis", "ApiUserAuthHeader", myApiUserAuthHeader);
((CustomerManagementSoapStub) myCustomerManagement).setHeader("http://adcenter.microsoft.com/syncapis", "ApiUserAuthHeader", myApiUserAuthHeader);
((CampaignManagementSoapStub) myCampaignManagement).setHeader("http://adcenter.microsoft.com/syncapis", "ApiUserAuthHeader", myApiUserAuthHeader);

long nQuota, nQuotaBalance;



nQuota =myAdministration.getQuota(0);
nQuotaBalance = myAdministration.getQuotaBalance(0);

System.out.println("The quota is " + nQuota + " and the quota balance is " + nQuotaBalance);

Hope this helps!

Jeff Dillon, Microsoft adCenter API Technical Support






Re: Do I need the sandbox WSDL files?

Mats Henricson

Thanks for your reply. Question:

Is it:

setHeader("...", "ApiUserAuthHeader", xxxxx)

Or:

setHeader("...", "authHdr", xxxxx)

Mats






Re: Do I need the sandbox WSDL files?

Mats Henricson

Also, have a look at this typical call:

getAdministrationSoap(new URL(administrationUrl))

Should the URL passed into that function end with " wsdl" or not
In your example above, you have " wsdl" at the end, but in your
hello world Java example, you do not:

http://msdn2.microsoft.com/en-us/library/bb267274.aspx

These kind of discrepances are quite confusing and wastes lots of time.

Mats






Re: Do I need the sandbox WSDL files?

Jeff Dillon - MSFT

Mats,


I might recommend getting the sample code working first, which is at

http://msdn2.microsoft.com/en-us/library/bb267274.aspx

In the following line, taken from MSDN, authHdr is a variable:

ApiUserAuthHeader authHdr = new ApiUserAuthHeader();

In the following line, "ApiUserAuthHeader" refers to the SOAP element name:


((AdministrationSoapStub) myAdministration).setHeader("http://adcenter.microsoft.com/syncapis", "ApiUserAuthHeader", myApiUserAuthHeader);

Sorry for the confusion.

Jeff Dillon, Microsoft adCenter API Technical Support





Re: Do I need the sandbox WSDL files?

Jeff Dillon - MSFT

Mats,

Either way works. I tested from the NetBeans 5.5 IDE. I might recommend testing with a small program that calls one of the wsdl files. Then you could implement A/B testing, and in this case, I was able to compare in seconds. Apologies if this was confusing, I was attempting to demonstrate that either way works.

Did you receive errors with one of the formats

Jeff Dillon, Microsoft adCenter API Technical Support





Re: Do I need the sandbox WSDL files?

Jeff Dillon - MSFT

It occurred to me after I posted the previous reply that A/B testing only works if you have working code! If not, then these type of potential discrepencies are just another variable to test, which could be time consuming. Are you getting compile or runtime errors Also, feel free to open a support ticket with our API group here. For instructions on opening a ticket, contact your Microsoft representative (usually the one who created your API login), or post your email address here, and someone will contact you.

Jeff Dillon, Microsoft adCenter API Technical Support





Re: Do I need the sandbox WSDL files?

Mats Henricson

Ah, sorry. Must have been sleeping at the wheel there.

But I've never got the hello world example working. I get this error:

stackTraceTongue Tiederver was unable to process request.
---> |-400001|-1|API unauthorized access|

It has been like this for 3-4 weeks now, with very little response from my contact
in Ireland. Finally they told me "that there are some problems with your current
Sandbox credentials", and I got a new set of credentials. But the result is the same.

Mats





Re: Do I need the sandbox WSDL files?

Jeff Dillon - MSFT

That means your code is working correctly but your username has not been activated, and easy to fix. Ideally you would have received the activation email. Perhaps look in your Junk mail folder Please contact your Microsoft representative to have them contact API support, or go ahead and create a support ticket yourself, or post your email here and someone will contact you.

Jeff Dillon, Microsoft adCenter API Technical Support





Re: Do I need the sandbox WSDL files?

Mats Henricson

Last night I got a new set of credentials, and hello world works now.
Thanks a lot!

Mats