2011-07-22 36 views
0

我正在嘗試調用正在查找soap信封內的xml字符串的第三方webservice。但是,當我傳入一個xml字符串時,服務器以400錯誤請求進行響應。如果我將xml留出,那麼web服務會正確返回一個錯誤,指出它正在等待該參數。我已經和web服務的開發者談過了,他們不確定爲什麼會發生這種情況。在SOAP信封內發送XML字符串

這是我發送的SOAP信封,有問題的節點是<web:xmlString>

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservices.example.com/"> 
    <soapenv:Header/> 
    <soapenv:Body> 
     <web:AddWidget> 
     <web:Key>6F257576-2F95-4764-8539</web:Key> 
     <web:listID>62017</web:listID> 
     <web:Type>S</web:Type> 
     <web:format>HTML</web:format> 
     <web:xmlString><xml><Emails><Emailaddress>[email protected]</Emailaddress><User1>263885</User1></Emails></xml></web:xmlString> 
     <web:sfID>1536</web:sfID> 
     </web:AddWidget> 
    </soapenv:Body> 

我試圖把在引號的XML字符串,其編碼等沒有運氣。

+0

不可能回答沒有看到WSDL和XML Schema爲Web服務 – skaffman

回答

0

我認爲你需要這樣做。

<web:xmlString><xml><Emails><Emailaddress>[email protected]</Emailaddress><User1>263885</User1></Emails></xml></web:xmlString> 

不確定。你可以嘗試,或嘗試不使用標籤對。

<web:xmlString><Emails><Emailaddress>[email protected]</Emailaddress><User1>263885</User1></Emails></web:xmlString> 

以上兩種情況都應該有效。 其他方面,您需要更好地查看XSD(如果有)或WSDL。 HTH

+1

-1:可以在文檔中間沒有XML文檔。 –

+0

ZZZ ..你說得對。所以另一個選項可以工作。 – Gyan

+0

仍然沒有幫助OP,這並不奇怪,因爲他提供的信息很少。 –

0

我知道它的老,但下面的一個也可能會幫助你或後期的;) 遲到比從未好。

你可以把它作爲原始XML

<web:xmlString><xml><Emails><Emailaddress>[email protected]</Emailaddress><User1>263885</User1></Emails></xml></web:xmlString> 

如果你聲明的xmlString爲XElement數據類型