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
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
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