2016-03-23 69 views
-2

我有這個問題,我似乎無法解決的SOAP。 不管我怎麼努力,然後我不斷收到此錯誤:保持EOF預期錯誤

500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed.

在進一步深挖下錯誤代碼,我聽說有一個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 
%> 

我真的希望你們中的一些可以幫助我她嗎?

+0

這是一般性信息。在這裏查找並顯示確切的錯誤以及發生的情況。 http://stackoverflow.com/questions/5385714/deploying-website-500-internal-server-error/5385884#5385884 – Aristos

+0

錯誤必須處理XML字符串,因爲您已將它放在這裏... – Aristos

+0

''這是問題嗎? – Shanid

回答

0

您使用內嵌代碼標籤。

<% 

它們不包含任何導入的命名空間。

此外,你似乎想要將XML複製到strRequest中,但是你沒有正確地轉義它,再加上VB.NET(這是你使用的而不是C#)不支持多行字符串。

你們爲什麼使用

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

您可以使用正常的WebRequest類,而不是一個ActiveX-對象。如果你想在客戶端做,你需要使用JavaScript(AJAX)。
如果您正在進行跨域請求,則需要使用COR(以及支持COR的瀏覽器),或者您需要編寫一個可以爲您提供請求的代理。

此外,您是否嘗試添加一個Web引用到您的項目?
Visual Studio將自動下載WSDL並生成包裝類。你爲什麼想手工做? ...

此外,如果你想在ASPX頁面中嵌入代碼,做一個「劇本」 - 標記使用runat="server"

<%@ 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?