解決:Java調用.net的webService產生“服務器未能識別 HTTP 標頭 SOAPAction 的值”錯誤


前些日子做項目,雙方采用webservice的方式進行數據通訊,我用.net開發的webservice接口,對方用java+axis訪問我 的webservice。由於對方在調用我的webservice時,沒有指定SoapAction,沒有指定RequestNameSpace,所以請 求時總是出現“服務器未能識別 HTTP 標頭 SOAPAction 的值”錯誤。由於沒有辦法修改對方的調用方式,故只好從我開發的webservice上想辦法解決這個問題。

 

經過一些嘗試,發現如下辦法解決了此問題,既修改我的webservice接口定義的一些屬性,示例如下

 

第一步:在webservice類上加屬性

 

[SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]

public class Service1 :System.Web.Services.WebService

 

 

 

 

第二步:在webservice方法上加屬性

 

[WebMethod]

[SoapRpcMethodAttribute(Action = "", RequestNamespace = "")]

public void NotifyStatus(int eventID,String sessionID,int res,String para1)

{

[SoapDocumentMethod(Use = System.Web.Services.Description.SoapBindingUse.Encoded,Action = "", ParameterStyle = SoapParameterStyle.Bare, RequestNamespace = "")]

(在Class):

 [WebService(Namespace = "")]
    [SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]

 

}

 

 

-------------------------------------

此 Web 服務不符合 WS-I Basic Profile v1.1。

請檢查下面每個標准化聲明是否存在沖突。請按建議修正沖突,或向 <webServices> 配置節添加設置,對整個 vroot 關閉 BP 1.1 一致性警告。

要對整個 vroot 關閉 BP 1.1 一致性警告,請從應用程序配置文件的 <conformanceWarnings> 節移除“BP1.1”值:

<configuration>
<system.web>
<webServices>
<conformanceWarnings>
<remove name='BasicProfile1_1'/>
</conformanceWarnings>
</webServices>
</system.web>
</configuration>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM