2010-01-05 119 views
1

HI,重新創建Web服務

我的工作是創造出充當另一個web服務,我們有一個Web服務,所以客戶端不會注意到其中的差別。我創建了我的整個web服務,並且在我使用它時輸出都是相同的。關鍵是,我創建了一個clientapplication,我用舊的web服務,如果我改變Web引用的URL到新的服務,然後重試我得到一個錯誤:

System.Web.Services.Protocols.SoapException: The server did not recognize the HTTP-header SOAPAction

如果我期待在參考的差異在我的兩個Web服務中.cs我注意到有一個屬性的小差異,這是我認爲的問題。

新服務:

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.3053")] 
    [System.Diagnostics.DebuggerStepThroughAttribute()] 
    [System.ComponentModel.DesignerCategoryAttribute("code")] 
    [System.Web.Services.WebServiceBindingAttribute(Name="SprWebServiceSoap", Namespace="http://ws.hl7.trispark.com/")] 
    public partial class SprWebService : System.Web.Services.Protocols.SoapHttpClientProtocol { 

老服務:這是用來

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.3053")] 
    [System.Diagnostics.DebuggerStepThroughAttribute()] 
    [System.ComponentModel.DesignerCategoryAttribute("code")] 
    [System.Web.Services.WebServiceBindingAttribute(Name="SprWebServiceRemoteBinding", Namespace="http://ws.hl7.trispark.com/")] 
    public partial class SprWebService : System.Web.Services.Protocols.SoapHttpClientProtocol { 

同時,也是方法而不同:

新:

[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://ws.hl7.trispark.com/invoke", RequestNamespace="http://ws.hl7.trispark.com/", ResponseNamespace="http://ws.hl7.trispark.com/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] 
     public invokeResponse invoke(invoke inv) { 

老:

[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare)] 
     [return: System.Xml.Serialization.XmlElementAttribute("invokeResponse", Namespace="http://ws.hl7.trispark.com/types")] 
     public invokeResponse invoke([System.Xml.Serialization.XmlElementAttribute("invoke", Namespace="http://ws.hl7.trispark.com/types")] invoke invoke1) { 

首先,我想這個問題可能是我的版本是在VS2008中創建和舊的在VS2005,所以我重新在2005年,但這並沒有改變任何東西。

事情是我沒有舊的代碼,所以我不能看到使用什麼特定的屬性。

有沒有人有任何想法,我必須設置爲獲得相同的東西?

非常感謝!

回答

1

你有舊服務的DLL嗎?如果你有DLL,如果它是.net服務,你可以使用Reflector來反向工程。

+0

其他Web服務是在java中創建的,所以這是一個沒有去:( – WtFudgE 2010-01-05 12:30:24

+0

你有沒有看任何的Java反編譯器這可能是唯一的事情,如果你想要的嗎? 100%肯定只有另外一種方式是將xsd/wsdl的內容與實際內容進行比較,以便讓它們匹配。另外一件你可能會嘗試的產品就是像SOAPScope這樣的產品,它可以讓你真正看到完整的SOAP數據包通過網絡傳輸,然後您可以從SOAP角度推斷出您需要的任何更改。 – 2010-01-05 15:14:32

0

我的猜測是檢查使用的命名空間,我有一個類似的問題,它鑽到了名稱空間問題的差異。檢查:

[WebService的空間(namespace =「http://tempuri.org/」]

這是默認的,這可能是在新的互聯網服務和舊的Web服務可能會使用一些其他的命名空間

+0

命名空間都是:[WebService(Namespace =「http://ws.hl7.trispark.com/」)] – WtFudgE 2010-01-05 12:25:16

0

嘗試比較這兩種服務的WSDL - 看看你是否能找到任何線索有

爲了得到它,你添加到URL ?WSDLhttp://aspnet.15seconds.com/010430/SampleService.asmxhttp://aspnet.15seconds.com/010430/SampleService.asmx?WSDL分別見例如結束

編輯:
我不是WSDL大師,所以不能告訴你問題在哪裏。
您可能會考慮的另一個選擇是將請求的嗅探與服務進行比較 - 這可以提供其他線索。

+0

我試過這樣做,我沒有看到太多的區別但我在閱讀wsdl文件時並不那麼出色。我不確定是否允許我這樣做(如果不是,我很抱歉,我不會再這樣做),但這些是兩個wsdl的: http://users.telenet.be/ i_dislike_mushrooms/tmp/old.txt http://users.telenet.be/i_dislike_mushrooms/tmp/new.txt – WtFudgE 2010-01-05 13:03:28