SSIS C#客户端发送SOAP请求并接收响应
我尝试创建一个C#SSIS脚本,用于向web服务发送SOAP请求(并获取结果) 我在这里看到了代码: 我有一个错误,但无法在SSIS中进行调试。 我犯了个错误 无法执行脚本,因为SSIS中的脚本任务中出现“脚本入口点无效”错误 这是我的代码:SSIS C#客户端发送SOAP请求并接收响应,c#,soap,ssis,client,send,C#,Soap,Ssis,Client,Send,我尝试创建一个C#SSIS脚本,用于向web服务发送SOAP请求(并获取结果) 我在这里看到了代码: 我有一个错误,但无法在SSIS中进行调试。 我犯了个错误 无法执行脚本,因为SSIS中的脚本任务中出现“脚本入口点无效”错误 这是我的代码: namespace ST_75982b92bbab4c2594c76b05097b7cd1 { /// <summary> /// ScriptMain is the entry point class of the scri
namespace ST_75982b92bbab4c2594c76b05097b7cd1
{
/// <summary>
/// ScriptMain is the entry point class of the script. Do not change the name, attributes,
/// or parent of this class.
/// </summary>
[Microsoft.SqlServer.Dts.Tasks.ScriptTask.SSISScriptTaskEntryPointAttribute]
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
{
public static HttpWebRequest CreateWebRequest()
{
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(@"https://preprod.secureholiday.net/ASPX/ShProcess/Api.asmx?wsdl");
webRequest.Headers.Add(@"SOAP:Action");
webRequest.ContentType = "text/xml;charset=\"utf-8\"";
webRequest.Accept = "text/xml";
webRequest.Method = "POST";
return webRequest;
}
public static void Execute()
{
// TODO: Add your code here
HttpWebRequest request = CreateWebRequest();
XmlDocument soapEnvelopeXml = new XmlDocument();
soapEnvelopeXml.LoadXml(@"<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:web=""http://webservices.secureholiday.net/"">
<soapenv:Header/>
<soapenv:Body>
<web:SetPricingGrid>
<web:User>
<web:idEngine>XXXX</web:idEngine>
<web:password>XXXX</web:password>
<web:user>XXXX</web:user>
</web:User>
<web:PricingGrid>
<web:GridConfiguration>
<web:EstablishmentId>15509</web:EstablishmentId>
<web:ProductId>81332</web:ProductId>
<!--<web:GridId>269614</web:GridId>-->
<web:GridModel>ByNight</web:GridModel>
<web:Visibility>Yield</web:Visibility>
<web:PublicNames>
<web:PublicName>
<web:Lg>FR</web:Lg>
<web:Label>Grille nuitée Yield FNS 24/04/2019 11h29</web:Label>
</web:PublicName>
</web:PublicNames>
<!--<web:ExclusiveEngineIds>
<web:int>1554</web:int>
</web:ExclusiveEngineIds>-->
<web:IsEstablishmentValidationRequired>false</web:IsEstablishmentValidationRequired>
</web:GridConfiguration>
<web:PricingConfiguration>
<web:Account>
<web:AccountModel>Percent</web:AccountModel>
<web:Value>30</web:Value>
</web:Account>
<web:BookingFeesPrice>10</web:BookingFeesPrice>
<web:Person>
<web:MinPersonQuantity>4</web:MinPersonQuantity>
<web:MaxPersonQuantity>6</web:MaxPersonQuantity>
<web:IncludedPersonQuantity>4</web:IncludedPersonQuantity>
</web:Person>
</web:PricingConfiguration>
<web:PricingPeriods>
<!--Zero or more repetitions:-->
<web:PricingPeriod>
<web:StartDate>2019-04-01</web:StartDate>
<web:IncludedEndDate>2019-06-30</web:IncludedEndDate>
<web:Price>20</web:Price>
<web:StayDuration>
<web:DurationModel>GreaterThanOrEqual</web:DurationModel>
<web:NightQuantity>3</web:NightQuantity>
</web:StayDuration>
</web:PricingPeriod>
<web:PricingPeriod>
<web:StartDate>2019-07-01</web:StartDate>
<web:IncludedEndDate>2019-08-31</web:IncludedEndDate>
<web:Price>35</web:Price>
<web:StayDuration>
<web:DurationModel>GreaterThanOrEqual</web:DurationModel>
<web:NightQuantity>7</web:NightQuantity>
</web:StayDuration>
</web:PricingPeriod>
<web:PricingPeriod>
<web:StartDate>2019-09-01</web:StartDate>
<web:IncludedEndDate>2019-10-15</web:IncludedEndDate>
<web:Price>25</web:Price>
<web:StayDuration>
<web:DurationModel>GreaterThanOrEqual</web:DurationModel>
<web:NightQuantity>2</web:NightQuantity>
</web:StayDuration>
</web:PricingPeriod>
</web:PricingPeriods>
</web:PricingGrid>
</web:SetPricingGrid>
</soapenv:Body>
</soapenv:Envelope>");
using (Stream stream = request.GetRequestStream())
{
soapEnvelopeXml.Save(stream);
}
using (WebResponse response = request.GetResponse())
{
using (StreamReader rd = new StreamReader(response.GetResponseStream()))
{
string soapResult = rd.ReadToEnd();
Console.WriteLine(soapResult);
}
}
}
static void Main(string[] args)
{
Execute();
}
#region ScriptResults declaration
/// <summary>
/// This enum provides a convenient shorthand within the scope of this class for setting the
/// result of the script.
///
/// This code was generated automatically.
/// </summary>
enum ScriptResults
{
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
};
#endregion
}
}
名称空间ST_75982b92bbab4c2594c76b05097b7cd1
{
///
///ScriptMain是脚本的入口点类。请勿更改名称、属性、,
///或该类的父级。
///
[Microsoft.SqlServer.Dts.Tasks.ScriptTask.SSISScriptTaskEntryPointAttribute]
公共部分类ScriptMain:Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
{
公共静态HttpWebRequest CreateWebRequest()
{
HttpWebRequest webRequest=(HttpWebRequest)webRequest.Create(@)https://preprod.secureholiday.net/ASPX/ShProcess/Api.asmx?wsdl");
webRequest.Headers.Add(@“SOAP:Action”);
webRequest.ContentType=“text/xml;charset=\”utf-8\”;
webRequest.Accept=“text/xml”;
webRequest.Method=“POST”;
返回webRequest;
}
公共静态void Execute()
{
//TODO:在此处添加代码
HttpWebRequest请求=CreateWebRequest();
XmlDocument soapEnvelopeXml=新的XmlDocument();
soapEnvelopeXml.LoadXml(@)
XXXX
XXXX
XXXX
15509
81332
拜夜
产量
FR
格栅nuitée产量FNS 2019年4月24日11h29
假的
百分比
30
10
4.
6.
4.
2019-04-01
2019-06-30
20
更伟大的
3.
2019-07-01
2019-08-31
35
更伟大的
7.
2019-09-01
2019-10-15
25
更伟大的
2.
");
使用(Stream=request.GetRequestStream())
{
soapEnvelopeXml.Save(流);
}
使用(WebResponse=request.GetResponse())
{
使用(StreamReader rd=newstreamreader(response.GetResponseStream())
{
字符串soapResult=rd.ReadToEnd();
控制台写入线(soapResult);
}
}
}
静态void Main(字符串[]参数)
{
执行();
}
#区域脚本结果声明
///
///这个枚举在这个类的范围内提供了一个方便的速记来设置
///脚本的结果。
///
///此代码是自动生成的。
///
枚举脚本结果
{
Success=Microsoft.SqlServer.Dts.Runtime.dtsesecresult.Success,
Failure=Microsoft.SqlServer.Dts.Runtime.dtsesecresult.Failure
};
#端区
}
}
请添加您收到的错误消息,或尝试以更清晰的方式描述它。通过在代码中插入断点,然后单步执行,您将获得更好的错误。这是我遇到的错误:无法执行脚本,因为脚本入口点无效“SSIS中脚本任务中的错误”