//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Runtime Version:2.0.50727.42
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
//------------------------------------------------------------------------------
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Serialization;
namespace ScanSource
{
namespace Europe
{
namespace WSDL
{
namespace ViesSoap
{
//
// This source code was auto-generated by wsdl, Version=2.0.50727.42.
//
///
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name = "checkVatPortSoapBinding", Namespace = "urn:ec.europa.eu:taxud:vies:services:checkVat")]
public partial class checkVatService : System.Web.Services.Protocols.SoapHttpClientProtocol
{
private System.Threading.SendOrPostCallback checkVatOperationCompleted;
///
public checkVatService()
{
this.Url = "http://ec.europa.eu/taxation_customs/vies/api/checkVatPort";
}
///
public event checkVatCompletedEventHandler checkVatCompleted;
///
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace = "urn:ec.europa.eu:taxud:vies:services:checkVat:types", ResponseNamespace = "urn:ec.europa.eu:taxud:vies:services:checkVat:types", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlElementAttribute("requestDate", Form = System.Xml.Schema.XmlSchemaForm.Unqualified, DataType = "date")]
public System.DateTime checkVat([System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] ref string countryCode, [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] ref string vatNumber, [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] out bool valid, [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] out string name, [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] out string address)
{
object[] results = this.Invoke("checkVat", new object[] {
countryCode,
vatNumber});
countryCode = ((string)(results[1]));
vatNumber = ((string)(results[2]));
valid = ((bool)(results[3]));
name = ((string)(results[4]));
address = ((string)(results[5]));
return ((System.DateTime)(results[0]));
}
/*! \brief Check code that can be used in Dynamics Ax
*
* \mistask 00025071
* \author SDB
* \date 20070212
*/
public Array check(string country, string vatNum)
{
bool validbool = false;
int valid = 0; // 0 = unknown, 1 = valid, 2 = invalid
string name;
string address;
DateTime date;
try
{
date = this.checkVat(ref country,
ref vatNum,
out validbool,
out name,
out address);
valid = (validbool ? 1 : 2);
return new object[] {country,
vatNum,
valid,
name,
address,
date};
}
catch
{
// Nothing :)
}
return new object[] {country, vatNum, 0, "", "", DateTime.Today};
}
public string get_UrlString()
{
return this.Url;
}
///
public System.IAsyncResult BegincheckVat(string countryCode, string vatNumber, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("checkVat", new object[] {
countryCode,
vatNumber}, callback, asyncState);
}
///
public System.DateTime EndcheckVat(System.IAsyncResult asyncResult, out string countryCode, out string vatNumber, out bool valid, out string name, out string address)
{
object[] results = this.EndInvoke(asyncResult);
countryCode = ((string)(results[1]));
vatNumber = ((string)(results[2]));
valid = ((bool)(results[3]));
name = ((string)(results[4]));
address = ((string)(results[5]));
return ((System.DateTime)(results[0]));
}
///
public void checkVatAsync(string countryCode, string vatNumber)
{
this.checkVatAsync(countryCode, vatNumber, null);
}
///
public void checkVatAsync(string countryCode, string vatNumber, object userState)
{
if ((this.checkVatOperationCompleted == null))
{
this.checkVatOperationCompleted = new System.Threading.SendOrPostCallback(this.OncheckVatOperationCompleted);
}
this.InvokeAsync("checkVat", new object[] {
countryCode,
vatNumber}, this.checkVatOperationCompleted, userState);
}
private void OncheckVatOperationCompleted(object arg)
{
if ((this.checkVatCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.checkVatCompleted(this, new checkVatCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
///
public new void CancelAsync(object userState)
{
base.CancelAsync(userState);
}
}
///
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void checkVatCompletedEventHandler(object sender, checkVatCompletedEventArgs e);
///
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class checkVatCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{
private object[] results;
internal checkVatCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState)
:
base(exception, cancelled, userState)
{
this.results = results;
}
///
public System.DateTime Result
{
get
{
this.RaiseExceptionIfNecessary();
return ((System.DateTime)(this.results[0]));
}
}
///
public string countryCode
{
get
{
this.RaiseExceptionIfNecessary();
return ((string)(this.results[1]));
}
}
///
public string vatNumber
{
get
{
this.RaiseExceptionIfNecessary();
return ((string)(this.results[2]));
}
}
///
public bool valid
{
get
{
this.RaiseExceptionIfNecessary();
return ((bool)(this.results[3]));
}
}
///
public string name
{
get
{
this.RaiseExceptionIfNecessary();
return ((string)(this.results[4]));
}
}
///
public string address
{
get
{
this.RaiseExceptionIfNecessary();
return ((string)(this.results[5]));
}
}
}
}
}
}
}