Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ssis XML:';src&x27;不是意外的标记。预期的令牌是'=';_Ssis - Fatal编程技术网

Ssis XML:';src&x27;不是意外的标记。预期的令牌是'=';

Ssis XML:';src&x27;不是意外的标记。预期的令牌是'=';,ssis,Ssis,我有一个在VS2008中开发的DTSX代码,它运行在SQL 2008上。现在我需要使用VS 2015迁移到2017年。 此DTSX的任务是使用他们提供的web服务从第三方网站获取XML。 现在我总是遇到这样的错误: “src”是意外标记。所需的令牌为“=”。第8行,位置7 我试过加密包 public void Main() { String requestUrl = `"https://myTemlurl/XMLj/X-ShipmentStatus";` Uri conwa

我有一个在VS2008中开发的DTSX代码,它运行在SQL 2008上。现在我需要使用VS 2015迁移到2017年。 此DTSX的任务是使用他们提供的web服务从第三方网站获取XML。 现在我总是遇到这样的错误:

“src”是意外标记。所需的令牌为“=”。第8行,位置7

我试过加密包

public void Main()

{

    String requestUrl = `"https://myTemlurl/XMLj/X-ShipmentStatus";`

    Uri conwayUri = new Uri(requestUrl);

    String username = "userABC";

    String password = "pwd1234";

    String authType = "basic";

    String tracking = "VEG123456";

    NetworkCredential myCred = new NetworkCredential(username, password);
    CredentialCache myCache = new CredentialCache();
    myCache.Add(conwayUri, authType, myCred);

    string today = DateTime.Today.Month.ToString() + "/" + DateTime.Today.Day.ToString() + "/" + DateTime.Today.Year.ToString().Remove(0, 2);

    ArrayList trackNums = new ArrayList();
    `trackNums.Add(tracking);`

    String xmlRequest = "";
    xmlRequest += "<ShipmentStatusRequest testmode=\"N\">";
    xmlRequest += "<CustomerNumber>493116471</CustomerNumber>";
    xmlRequest += "<ReportType>M</ReportType>";
    xmlRequest += "<ShipmentRole>B</ShipmentRole>";
    xmlRequest += "</ShipmentStatusRequest>";

    // Encode the Request String and set up the POST data
    xmlRequest = HttpUtility.UrlEncode(xmlRequest);
    String postData = "ShipmentStatusRequest=" + xmlRequest;
    ASCIIEncoding encoding = new ASCIIEncoding();
    byte [] postBuffer = encoding.GetBytes(postData);

    // Set up the HTTP Request
    HttpWebRequest wReq = (HttpWebRequest) WebRequest.Create(conwayUri);
    wReq.ContentType="application/x-www-form-urlencoded";
    wReq.ContentLength = postBuffer.Length;
    wReq.Method="POST";
    wReq.Timeout=180000;
    wReq.KeepAlive = false;
    wReq.ReadWriteTimeout = 180000;
    wReq.Credentials = myCache;
    wReq.PreAuthenticate = true;

    Stream reqStream = null;
    reqStream = wReq.GetRequestStream();
    reqStream.Write(postBuffer,0,postBuffer.Length);
    reqStream.Close();  

    try
    {
        HttpWebResponse wResp = (HttpWebResponse)wReq.GetResponse();
        Stream respStream = wResp.GetResponseStream();
        XmlTextReader xmlReader = new XmlTextReader(respStream);
        XmlDocument xmlStatus = new XmlDocument();
        xmlStatus.Load(xmlReader);

        //The entire XML Response String
        String respString = xmlStatus.InnerXml;
        respString = respString.Replace("<PRONmbr>", "</Shipment><Shipment><PRONmbr>");
        respString = respString.Replace("</ShipmentStatusResponse>", "</Shipment></ShipmentStatusResponse>");
        respString = respString.Replace("?dest=privacy.\"></Shipment>", "?dest=privacy.\">");

        Dts.Variables["User::Results"].Value = respString;

        // Clean up resources
        //reqStream.Close();
        xmlReader.Close();
        respStream.Close();
        wResp.Close();
        Dts.TaskResult = (int)ScriptResults.Success;
    }
    catch(Exception ex)
    {
        Dts.TaskResult = (int)ScriptResults.Failure;                
    }
}
public void Main()
{
字符串requestUrl=`”https://myTemlurl/XMLj/X-ShipmentStatus";`
Uri conwayUri=新Uri(请求URL);
字符串username=“userABC”;
字符串密码=“pwd1234”;
字符串authType=“基本”;
字符串跟踪=“VEG123456”;
NetworkCredential myCred=新的NetworkCredential(用户名、密码);
CredentialCache myCache=新的CredentialCache();
Add(conwayUri、authType、myCred);
string today=DateTime.today.Month.ToString()+“/”+DateTime.today.Day.ToString()+“/”+DateTime.today.Year.ToString().Remove(0,2);
ArrayList trackNums=新的ArrayList();
`trackNums.Add(跟踪)`
字符串xmlRequest=“”;
xmlRequest+=“”;
xmlRequest+=“493116471”;
xmlRequest+=“M”;
xmlRequest+=“B”;
xmlRequest+=“”;
//对请求字符串进行编码并设置POST数据
xmlRequest=HttpUtility.UrlEncode(xmlRequest);
字符串postData=“ShipmentStatusRequest=“+xmlRequest;
ascienceoding encoding=新的ascienceoding();
byte[]postBuffer=encoding.GetBytes(postData);
//设置HTTP请求
HttpWebRequest wReq=(HttpWebRequest)WebRequest.Create(conwayUri);
wReq.ContentType=“application/x-www-form-urlencoded”;
wReq.ContentLength=postBuffer.Length;
wReq.Method=“POST”;
wReq.Timeout=180000;
wReq.KeepAlive=false;
wReq.ReadWriteTimeout=180000;
wReq.Credentials=myCache;
wReq.PreAuthenticate=true;
Stream reqStream=null;
reqStream=wReq.GetRequestStream();
请求流写入(postBuffer,0,postBuffer.Length);
reqStream.Close();
尝试
{
HttpWebResponse wResp=(HttpWebResponse)wReq.GetResponse();
Stream respStream=wResp.GetResponseStream();
XmlTextReader xmlReader=新的XmlTextReader(respStream);
XmlDocument xmlStatus=新的XmlDocument();
加载(xmlReader);
//整个XML响应字符串
String respString=xmlStatus.InnerXml;
respString=respString.Replace(“,”);
respString=respString.Replace(“,”);
respString=respString.Replace(“?dest=privacy.\”>”,“?dest=privacy.\”>”;
Dts.Variables[“User::Results”]。Value=respString;
//清理资源
//reqStream.Close();
xmlReader.Close();
respStream.Close();
wResp.Close();
Dts.TaskResult=(int)ScriptResults.Success;
}
捕获(例外情况除外)
{
Dts.TaskResult=(int)ScriptResults.Failure;
}
}
我想知道我哪里出错了。
谢谢

顺便说一句:这行reqStream=wReq.GetRequestStream();给我Length='((System.Net.ConnectStream)reqStream)。Length'引发了一个类型为'System.NotSupportedException'Position='((System.Net.ConnectStream)reqStream)的异常。Position'引发了一个类型为'System.NotSupportedException'的异常。大家好,在我将https://更改为http://之后,作业开始工作,这让我担心,因为它应该是一个安全的url。有什么想法吗?顺便说一句:编写这些代码的开发人员很久以前就离开了,不知道第三方应该联系谁。