我有我使用作出一些Web服務調用一個服務,每個Web服務有一個DEV,TST和珠三角等同。目前,我一直在製作Web服務的實例,然後交換URL的某些部分,以根據需要在各個環境之間進行更改。問題與動態Web服務URL
我設法得到這個工作,但最近我最近更改了代碼,以使用數據庫來包含不同的環境中的相同服務的不同的URL,但是URL現在導致調用的問題,我得到以下錯誤消息:
System.Web.Services.Protocols.SoapException: Possible SOAP version mismatch: Envelope namespace http://schemas.xmlsoap.org/wsdl/ was unexpected. Expecting http://schemas.xmlsoap.org/soap/envelope/.
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at VRLSAPData.web.vrl.InvoiceList.ZB2B_WS_FUNCTIONS_006_SRV.ZB2bCustomerInvoiceList(ZB2bCustomerInvoiceList ZB2bCustomerInvoiceList1) in c:\Users\pigramm\Testing\VS 2010 Projects\VRLSAPData\VRLSAPData\Web References\web.vrl.InvoiceList\Reference.cs:line 81
at VRLSAPData.SAPAllInvoices.AllInvoices(String environment, String companyNumber, String customerNumber, String dateFrom, String dateTo) in c:\Users\pigramm\Testing\VS 2010 Projects\VRLSAPData\VRLSAPData\SAPAllInvoices.cs:line 31
我正在通話中的代碼如下:
public static web.vrl.InvoiceList.ZB2B_WS_FUNCTIONS_006_SRV ConnectToSapAllInvoicesService(string environment = "tst")
{
var sapInvoiceListProxy = new web.vrl.InvoiceList.ZB2B_WS_FUNCTIONS_006_SRV();
sapInvoiceListProxy.AllowAutoRedirect = true;
sapInvoiceListProxy.Url = GetServiceURL(environment, "AllInvoices");
sapInvoiceListProxy.Timeout = 900000;
sapInvoiceListProxy.Credentials = sapLogin;
return sapInvoiceListProxy;
}
GetServiceURL()
會從基礎上,通過它傳遞的名稱和環境數據庫中的URL,我已經檢查過了resul返回的時間與預期的一樣。
我曾嘗試調試代碼,但我無法找到任何錯誤,該網址似乎是正確的,當複製到Web瀏覽器按預期工作。有人知道這裏出了什麼問題嗎?
這個問題似乎與上面陳述的一樣,但我覺得這可以更好地向其他人解釋,我可以通過添加一個Web服務並比較其在sapInvoiceListProxy之前出現的URL來找到正確的URL。 Url'被我的方法調用改變了 – 2014-09-08 07:08:25