继续获得EOF预期错误

时间:2016-03-23 11:37:39

标签: asp.net vb.net

我有SOAP的这个问题,我似乎无法解决。 无论我尝试什么,我都会收到这个错误:

  

500 - 内部服务器错误。您的资源存在问题   正在寻找,它无法显示。

当进一步挖掘错误代码时,我被告知有一个EOF预期错误?

希望你们中的一些人能够帮助我

<%
On Error Resume Next
Dim objXMLHTTP : set objXMLHTTP = Server.CreateObject("Msxml2.XMLHTTP.3.0")
Dim strFunction
Dim strRequest
Dim strResult
Dim strName
Dim strFirstName
Dim strLastname
Dim strAddress
Dim strZipCode
Dim strCity
Dim strTelephone
Dim strTelephone2
Dim strTelephone3
Dim strTelephone4
Dim strEmail
Dim strExtFields
Dim strStdFields
Dim CampaignID
Dim Page

Page = Request.Form("Page")
CampaignID = Request.Form("CampaignID")
StrName = Request.Form("Name")
StrTelephone = Request.Form("Phone")

strRequest = ""
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"">
<Body>
<InsertNewCustomer xmlns=""http://api.ivocall.dk/ivocallservice.asmx"">
<Login>Loginname</Login>
<Password>Password</Password>
<ClientID>1323</ClientID>
<IDPassword>ag4bghsitm8gatddbpt34qjndjrbsla</IDPassword>
<CampaignID>"& campaignid &"</CampaignID>
<Name>"& StrName &"</Name>
<Firstname></Firstname>
<Lastname></Lastname>
<Address></Address>
<City></City>
<ZipCode></ZipCode>
<Telephone>"& StrTelephone &"</Telephone>
<Telephone2></Telephone2>
<Telephone3></Telephone3>
<Telephone4></Telephone4>
<email></email>
<ExtFields>landingpage="& page &"</ExtFields>
<StdFields></StdFields>
<UserName></UserName>
</InsertNewCustomer>
</Body>
</Envelope>"

objXMLHTTP.open "post", "" & "http://api.ivocall.dk/ivocallservice.asmx" & "", False
objXMLHTTP.setRequestHeader "Content-Type", "text/xml; charset=UTF-8"
objXMLHTTP.setRequestHeader "Content-Length", Len(strRequest)
objXMLHTTP.setRequestHeader "SOAPAction", "http://www.ivocall.dk/ivocallservice/InsertNewCustomer"

'send the request and capture the result
Call objXMLHTTP.send(strRequest)
strResult = objXMLHTTP.responseText

'display the XML
response.write strResult
response.write strRequest 

If Err.Number <> 0 Then
        Response.Write (Err.Description)
ELSE
        Response.Write ("task done")
        Response.End
End If
%>

我真的希望你们中的一些人可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

您使用内联代码标记。

<%

它们不包含任何导入的命名空间。

此外,您似乎想要将XML复制到strRequest中,但是您没有正确地转义它,加上VB.NET(这是您正在使用的,而不是C#)并不支持多行字符串。

你为什么要用

Server.CreateObject("Msxml2.XMLHTTP.3.0")

您可以使用普通的WebRequest类,而不是ActiveX-Object。如果你想在客户端做,你需要使用JavaScript(AJAX) 如果您正在进行跨域请求,则需要使用COR(以及支持COR的浏览器),或者您需要编写代理来为您执行请求。

此外,您是否尝试在项目中添加网络引用?
Visual Studio将自动下载WSDL并生成包装类。你为什么想手工做? ...

此外,如果您想在ASPX页面中嵌入代码,请使用runat="server"在&#34;脚本&#34; -tag中执行此操作:

<%@ Register TagPrefix="RS" Namespace="Microsoft.ReportingServices.WebServer" Assembly="ReportingServicesWebServer" %>
<%@ Page Language="C#" AutoEventWireup="true" Inherits="Microsoft.ReportingServices.WebServer.ReportViewerPage" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>

<script type="text/C#" runat="server">


    protected void SetDocumentMode()
    {
        if(System.Web.HttpContext.Current == null || System.Web.HttpContext.Current.Request == null || System.Web.HttpContext.Current.Request.Browser == null || System.Web.HttpContext.Current.Request.Browser.Browser == null)
            // return "<null>";
            return; 

        if (!StringComparer.OrdinalIgnoreCase.Equals(System.Web.HttpContext.Current.Request.HttpMethod, "GET"))
            // return "<notget>";
            return;

        // fu IE 11 
        if(System.Web.HttpContext.Current.Request.Browser.Browser == "IE" || System.Web.HttpContext.Current.Request.Browser.Browser == "InternetExplorer")
        {
            if(System.Globalization.CultureInfo.InvariantCulture.CompareInfo.IndexOf(System.Convert.ToString(System.Web.HttpContext.Current.Request.QueryString), "stylesheet", System.Globalization.CompareOptions.IgnoreCase) == -1 )
            {
                System.Web.HttpContext.Current.Response.Write(@"<meta http-equiv='X-UA-Compatible' content='IE=5'>
");
                //return "<meta http-equiv=\"X-UA-Compatible\" content=\"IE=5\">"; // IE5-Quirks when no custom stylesheet (=not in iframe)
            }
            else
                System.Web.HttpContext.Current.Response.Write("<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>");
                // return "<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">"; // Switch to Standards mode when a custom stylesheet is set(=in iframe)
        }

        // return "<not ie: " + System.Web.HttpContext.Current.Request.Browser.Browser + ">";
        //return "";
    }
</script>

[...]
<%SetDocumentMode(); %>

您实际使用ASP而不是ASP.NET吗?