v3 gives an error; v2 does not

When I call CampaignManagement.GetCampaigns(..)
and reference to v3 wsdls, I catch this error: "There is an error in XML document (1, 552)."

If I change all the references to v2, it's smooth sailing.

The context of the call itself is some of the very first I wrote and has worked countless times before. Why do you think there is a difference and what do you advise?

-Tal

[393 byte] By [tal_raviv] at [2008-2-26]
# 1
Have you updated to version 3.51?

"The AdCenterCampaign.BudgetAmt property has been renamed to the AdCenterCampaign.MonthlyBudgetAmount property.
This change has been made to the V3 CampaignManagement WSDL document."

If not, it is probably your problem ;)

Ludo-R at 2007-9-4 > top of Msdn Tech,Windows Live Developer Forums,Microsoft adCenter: Development...
# 2
Good point Ludo - I considered this too. The error occurs in the call to the GetCampaigns(int,int) method itself, not in use of its returned array.
The other weird thing is that it's an "XML error" which has never happened for other code problems.
tal_raviv at 2007-9-4 > top of Msdn Tech,Windows Live Developer Forums,Microsoft adCenter: Development...
# 3

I am getting a similar error calling GetAccounts. For now I am using v2 to get the accounts and v3 for everything else. I have this happening with two separate projects and on different computers. Oddly enough GetCampaigns works for me.

I am using VS.NET 2005 and generate the web service proxies with wsdl.exe like this:

"C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin\wsdl" /n:MsnAdCenterAPI.CustomerManagement /o:CustomerManagement.cs /l:CS https://adcenterapi.microsoft.com/v3/CustomerManagement/CustomerManagement.asmx?wsdl

Tibor

TiborBiro at 2007-9-4 > top of Msdn Tech,Windows Live Developer Forums,Microsoft adCenter: Development...
# 4

Hello,

This issue is currently under investigation. Tibor, would you please clarify your last message? I noticed you mentioned using v2 to get accounts yet you showed the v3 WSDL URL below.

Additionaly, it would be useful to have a "screenshot" of the error or the text output of the exception if possible.

Please reply with this at your earliest convenience so that we can proceed in investigating this issue.

Best Regards,

JasonDT - MSFT

JasonDTMSFT at 2007-9-4 > top of Msdn Tech,Windows Live Developer Forums,Microsoft adCenter: Development...
# 5

Hi Jason,

I found the problem as I took another look at it this morning.

Like I said, I am using VS.NET 2005.

If I generate the proxies with the .NET 1.1 wsdl like this

"C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin\wsdl.exe" /n:MsnAdCenterAPI.CustomerManagement /o:CustomerManagement.cs /l:CS https://adcenterapi.microsoft.com/v3/CustomerManagement/CustomerManagement.asmx?wsdl

I am getting the following error:

"System.InvalidOperationException: There is an error in XML document (1, 625). > System.InvalidOperationException: Instance validation error: '' is not a valid value for PaymentOption.\r\n at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderCustomerManagement.Read34_PaymentOption(String s)\r\n at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderCustomerManagement.Read36_AdCenterAccount(Boolean isNullable, Boolean checkType)\r\n at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderCustomerManagement.Read43_GetAccountsResponse()\r\n at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer1.Deserialize(XmlSerializationReader reader)\r\n at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)\r\n End of inner exception stack trace \r\n at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)\r\n at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)\r\n at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)\r\n at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)\r\n at MsnAdCenterAPI.CustomerManagement.CustomerManagement.GetAccounts(Int32 APIFlags) in C:\\Documents\\Projects\\TestMsnApi\\TestMsnApi\\Engines\\MsnAdCenterApi\\CustomerManagement.cs:line 43\r\n at TestMsnApi.Form1.GetAccount(String accountNumber) in C:\\Documents\\Projects\\TestMsnApi\\TestMsnApi\\Form1.cs:line 41"

Anyway, generating the proxy with the .NET 2.0 wsdl like this works perfectly.

"C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\wsdl.exe" /n:MsnAdCenterAPI.CustomerManagement /o:CustomerManagement.cs /l:CS https://adcenterapi.microsoft.com/v3/CustomerManagement/CustomerManagement.asmx?wsdlAll

Regards,

Tibor

TiborBiro at 2007-9-4 > top of Msdn Tech,Windows Live Developer Forums,Microsoft adCenter: Development...
# 6

Tibor,

Thank you for confirming that this now works for you. I can't say why dotnet 2.0 worked for you when 1.1 did not... it could have been some odd configuration issue.

Please dont hestitate to reply should you have any further questions or comments; or if I can be of assistance in any other way.

Best Regards,

JasonDT - MSFT

JasonDTMSFT at 2007-9-4 > top of Msdn Tech,Windows Live Developer Forums,Microsoft adCenter: Development...
# 7

I use dotnet 1.1 and get the same error as Tibor. I therefore have to continue using V2.

On V3 i get an error message that says something like invalid value for PaymentOption. Here is the soap response:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetAccountsResponse xmlns="http://adcenter.microsoft.com/syncapis">
<GetAccountsResult>
<AdCenterAccount>
<AccountId>360</AccountId>
<AccountName>Esearchvision - FR</AccountName>
<AccountNumber>X0008715</AccountNumber>
<Status>Active</Status>
<PreferredLanguageType>English</PreferredLanguageType>
<SalesHouseCustomerId>0</SalesHouseCustomerId>
<BillToCustomerId>0</BillToCustomerId>
<PaymentOptionsType xsi:nil="true" />
<PreferredCurrencyType>USDollar</PreferredCurrencyType>
</AdCenterAccount>
</GetAccountsResult>
</GetAccountsResponse>
</soap:Body>
</soap:Envelope>

The stub generated by Visual Studio 2003 looks like this:

<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://adcenter.microsoft.com/syncapis")> _
Public Class AdCenterAccount
Public AccountId As Integer
Public AccountName As String
Public AccountNumber As String
Public Status As AccountStatus
Public PreferredLanguageType As LanguageType
Public SalesHouseCustomerId As Integer
Public BillToCustomerId As Integer
Public AgencyContactName As String
Public PaymentOptionsType As PaymentOption
Public PreferredCurrencyType As CurrencyType
Public CreditCard As AdCenterCreditCard
End Class

Isn't there some kind of nullable stuff missing in the generated stub ? Could you please fix this bug before cutting of V2 ;-)

Best regards,

Peer Jakobsen

PeerJakobsen at 2007-9-4 > top of Msdn Tech,Windows Live Developer Forums,Microsoft adCenter: Development...
# 8
Peer,
I too am recieving this sort of message when using the V3 API for CustomerManagement and the GetAccounts() method. I am a very new/green user of the VS tools (came from an IBM developement environment) and was wondering if you could point me in the direction to expose the SOAP request/response, so I can better debug my environment. I've had my hands full with the migration from V1-V3 and hope to better understand all my debugging options.

When in VS 2003 the following is generated after adding the web reference, https://adcenterapi.microsoft.com/v3/customermanagement/customermanagement.asmx?WSDL:

<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://adcenter.microsoft.com/syncapis")> _
Public Class AdCenterAccount

'<remarks/>
Public AccountId As Integer

'<remarks/>
Public AccountName As String

'<remarks/>
Public AccountNumber As String

'<remarks/>
Public Status As AccountStatus

'<remarks/>
Public PreferredLanguageType As LanguageType

'<remarks/>
Public SalesHouseCustomerId As Integer

'<remarks/>
Public BillToCustomerId As Integer

'<remarks/>
Public AgencyContactName As String

'<remarks/>
Public PaymentOptionsType As PaymentOption

'<remarks/>
Public PreferredCurrencyType As CurrencyType

'<remarks/>
Public CreditCard As AdCenterCreditCard
End Class

When in VS 2005 the following is generated after adding the web reference, https://adcenterapi.microsoft.com/v3/customermanagement/customermanagement.asmx?WSDL:

<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.42"), _
System.SerializableAttribute(), _
System.Diagnostics.DebuggerStepThroughAttribute(), _
System.ComponentModel.DesignerCategoryAttribute("code"), _
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://adcenter.microsoft.com/syncapis")> _
Partial Public Class AdCenterAccount

Private accountIdField As System.Nullable(Of Integer)

Private accountNameField As String

Private accountNumberField As String

Private statusField As AccountStatus

Private preferredLanguageTypeField As LanguageType

Private salesHouseCustomerIdField As System.Nullable(Of Integer)

Private billToCustomerIdField As System.Nullable(Of Integer)

Private agencyContactNameField As String

Private paymentOptionsTypeField As System.Nullable(Of PaymentOption)

Private preferredCurrencyTypeField As CurrencyType

Private creditCardField As AdCenterCreditCard

'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(IsNullable:=true)> _
Public Property AccountId() As System.Nullable(Of Integer)
Get
Return Me.accountIdField
End Get
Set
Me.accountIdField = value
End Set
End Property

'''<remarks/>
Public Property AccountName() As String
Get
Return Me.accountNameField
End Get
Set
Me.accountNameField = value
End Set
End Property

'''<remarks/>
Public Property AccountNumber() As String
Get
Return Me.accountNumberField
End Get
Set
Me.accountNumberField = value
End Set
End Property

'''<remarks/>
Public Property Status() As AccountStatus
Get
Return Me.statusField
End Get
Set
Me.statusField = value
End Set
End Property

'''<remarks/>
Public Property PreferredLanguageType() As LanguageType
Get
Return Me.preferredLanguageTypeField
End Get
Set
Me.preferredLanguageTypeField = value
End Set
End Property

'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(IsNullable:=true)> _
Public Property SalesHouseCustomerId() As System.Nullable(Of Integer)
Get
Return Me.salesHouseCustomerIdField
End Get
Set
Me.salesHouseCustomerIdField = value
End Set
End Property

'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(IsNullable:=true)> _
Public Property BillToCustomerId() As System.Nullable(Of Integer)
Get
Return Me.billToCustomerIdField
End Get
Set
Me.billToCustomerIdField = value
End Set
End Property

'''<remarks/>
Public Property AgencyContactName() As String
Get
Return Me.agencyContactNameField
End Get
Set
Me.agencyContactNameField = value
End Set
End Property

'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(IsNullable:=true)> _
Public Property PaymentOptionsType() As System.Nullable(Of PaymentOption)
Get
Return Me.paymentOptionsTypeField
End Get
Set
Me.paymentOptionsTypeField = value
End Set
End Property

'''<remarks/>
Public Property PreferredCurrencyType() As CurrencyType
Get
Return Me.preferredCurrencyTypeField
End Get
Set
Me.preferredCurrencyTypeField = value
End Set
End Property

'''<remarks/>
Public Property CreditCard() As AdCenterCreditCard
Get
Return Me.creditCardField
End Get
Set
Me.creditCardField = value
End Set
End Property
End Class

David

okiebugmv at 2007-9-4 > top of Msdn Tech,Windows Live Developer Forums,Microsoft adCenter: Development...
# 9

What happens if you use v2.0 of the .NET framework, i.e. C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v2.0\Bin\wsdl ?

ShaiKariv-MSFT at 2007-9-4 > top of Msdn Tech,Windows Live Developer Forums,Microsoft adCenter: Development...
# 10

I am not on V2. And i cant use a V2 generated file in my V1.1 project.

PeerJakobsen at 2007-9-4 > top of Msdn Tech,Windows Live Developer Forums,Microsoft adCenter: Development...
# 11

Hello,

This issue has been verified: there is a current compatibilty issue involving nullable primitives and DotNet Framework 1.1.

Our V3 WSDLs use Nullable primitives (a feature fully supported by DotNet Framework 2.0 and greater but not 1.1) this explains why developers using the older DotNet Framework 1.1 experience this issue.

I would suggest that those who use DotNet Framework 1.1 migrate to DotNet Framework 2.0 (or above) for an immediate workaround (not to mention the long-term benefits of migrating to the newer framework).

NOTE: Current users of DotNet Framework 2.0 or above and Java/Perl/PHP/etc. users are NOT affected by this issue, please continue migrating to our V3 WSDLs if you have not already done so.

Please feel free to contact me should you have any further questions or comments; or if I can be of asssitance in any other way.

Best Regards,

JasonDT - MSFT

JasonDTMSFT at 2007-9-4 > top of Msdn Tech,Windows Live Developer Forums,Microsoft adCenter: Development...
# 12
OK, after obtaining VS 2005 and importing my project the API was behaving as expected.
Thanks everyone,
David
okiebugmv at 2007-9-4 > top of Msdn Tech,Windows Live Developer Forums,Microsoft adCenter: Development...

Windows Live Developer Forums

Site Classified