2010-02-24 61 views
4

有沒有一種方法,使通常會產生這樣的如何讓C#web服務產生soapenv命名空間而不是soap?

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
<soap:Header> 
<DHeader xmlns="http://www.abc.com" /> 
</soap:Header> 
    <soap:Body> 
    <Response xmlns="http://www.abc.com"> 
     <Result> 
     <ErrorObject ObjectID="string" ErrorCode="" />   
     </Result> 
    </Response> 
    </soap:Body> 
</soap:Envelope> 

XML生成XML這樣的C#/。NET Web服務。

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> 
    <soapv:Header> 
    <DHeader xmlns="http://www.abc.com" /> 
    </soapenv:Header> 
    <soapenv:Body> 
    <Response xmlns="http://www.abc.com"> 
     <Result> 
     <ErrorObject ObjectID="string" ErrorCode="" />   
     </Result> 
    </Response> 
    </soapenv:Body> 
</soapenv:Envelope> 

此嘗試解決了使用.NET Web服務的AXIS客戶端的問題。 AXIS在soap命名空間上窒息,需要一個soapenv命名空間。改變AXIS方面是不可能的。

任何想法或意見將是偉大的。

這是根據要求的確切錯誤。

line -1: Element [email protected]://www.w3.org/2003/05/soap-envelope is not a valid [email protected]://schemas.xmlsoap.org/soap/envelope/ document or a valid substitution. 

回答

1

soapenv不是一個命名空間 - 它是一個命名空間前綴。

只要前綴引用相同的名稱空間,soapsoapenv指的是相同的事物,並且具有相同的含義。

AXIS的任何版本都被破壞得特別嚴重,以至於不能處理前綴。你應該假設你有一個不同的問題。請發佈您收到的確切錯誤。

+0

這就是他們得到的。 line -1:Element Envelope @ http://www.w3.org/2003/05/soap-envelope不是有效的Envelope @ http://schemas.xmlsoap.org/soap/envelope/文檔或有效的代換。 也感謝對前綴命名空間事物的更正。 – cbg 2010-02-24 23:59:57

+1

您發佈的XML不使用「w3.org/2003/05/soap-envelope」命名空間。你發佈的XML不會給你這個錯誤。嘗試發送您在此發佈的XML。 – 2010-02-25 00:46:33

+0

這意味着它是不可能的? – 2015-01-16 03:55:58

相關問題