1
我有一個位於反向代理後面的web服務。現在發生了什麼是當我嘗試添加Web引用來測試Web服務,然後它說它無法下載wsdl文件。這是因爲當請求被髮送時它是https://uat.mywebservice.com/Service/Service.asmx,但是當它遇到反向代理並且然後輪胎下載wsdl和disco文件時,它將鏈接改變爲http://myservice.comp.com/Service/Service.asmx?wsdl,並且這不是正確的鏈接,因爲myservice.comp.com是隻是反向代理上的名稱空間。發生了什麼是肥皂文件中的標題正在更新到這個命名空間,而不是實際的主機名是uat.mywebservice.com,我能夠看到這使用fiddler迪斯科文件有不正確的地址。我通過使用wsdl.exe工具創建了一個代理類,然後將該類中的所有不正確鏈接更新爲正確的主機名。
有沒有什麼辦法可以確保地址在點擊反向代理時保持正確。
錯誤:
<?xml version="1.0" encoding="utf-8" ?>
- <discovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/disco/">
<contractRef ref="http://mvwebservice.comp.com/Service/Service.asmx?wsdl" docRef="http://mvwebservice.comp.com/Service/Service.asmx" xmlns="http://schemas.xmlsoap.org/disco/scl/" />
<soap address="http://mywebservice.comp.com/Service/Service.asmx" xmlns:q1="http://tempuri.org/" binding="q1:ServiceSoap" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
<soap address="http://mywebservice.comp.com/Service/Service.asmx" xmlns:q2="http://tempuri.org/" binding="q2:ServiceSoap12" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
</discovery>
正確
<?xml version="1.0" encoding="utf-8" ?>
- <discovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/disco/">
<contractRef ref="https://uat.mvwebservice.com/Service/Service.asmx?wsdl" docRef="https://uat.mvwebservice.com/Service/Service.asmx" xmlns="http://schemas.xmlsoap.org/disco/scl/" />
<soap address="https://uat.mywebservice.com/Service/Service.asmx" xmlns:q1="http://tempuri.org/" binding="q1:ServiceSoap" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
<soap address="https://uat.mywebservice.com/Service/Service.asmx" xmlns:q2="http://tempuri.org/" binding="q2:ServiceSoap12" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
</discovery>
這是什麼excatly我問題是http://blog.graffen.dk/post/Accessing-a-NET-Web-Service-located-behind-a-proxy.aspx我已經嘗試過這裏提出的解決方案。它適用於.Net環境。我不確定不同平臺上的客戶如何使其工作 – Pinu 2012-04-18 19:24:54