1
如何使用UTF-16編碼請求?下面是我有:用Ruby和Savon發送UTF-16編碼的SOAP請求
# Create Savon client
@client = Savon::Client.new do
wsdl.document = File.expand_path("account_list.wsdl", __FILE__)
end
# Set header encoding
@client.http.headers["Content-Type"] = "text/xml;charset=UTF-16"
# Setup ssl configuration
@client.http.auth.ssl.cert_key_file = "cert_key_file.pem"
@client.http.auth.ssl.cert_file = "cert_file.pem"
@client.http.auth.ssl.ca_cert_file = "ca_cert_file.pem"
@client.http.auth.ssl.verify_mode=:none
# Execute request
response = @client.request :account_list do
soap.body = {
:id => "18615618"
}
end
這裏是一個什麼樣的發乞討,注意編碼= 「UTF-8」:
Content-Type: text/xml;charset=UTF-16, SOAPAction: "accountList", Content-Length: 888 <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema
這是我得到的錯誤:
< s o a p : E n v e l o p e x m l n s : s o a p = " h t t p :// s c h e m a s . x m l s o a p . o r g/s o a p/e n v e l o p e/" x m l n s : w s>d
< s o a p : B o d y >
< s o a p : F a u l t >
< f a u l t c o d e > s o a p : C l i e n t </f a u l t c o d e >
< f a u l t s t r i n g > F a i l e d t o p r o c e s s S O A P r e q u e s t . S O A P b o d y n o t i n U T F - 1 6 .
</f a u l t s t r i n g >
< d e t a i l >
< w s d l _ o p s : e r r o r > F a i l e d t o p r o c e s s S O A P r e q u e s t . S O A P b o d y n o t i n U T F - 1 6 .
</w s d l _ o p s : e r r o r >
</d e t a i l >
</s o a p : F a u l t >
</s o a p : B o d y >
</s o a p : E n v e l o p e >
謝謝,期待更新!偉大的SOAP客戶端BTW。 – spectro
我不得不每次都用savon編寫自己的XML,因爲它們使用的是命名空間。 Savon爲我提供了這兩個(或三個)xml標籤,因此將這些標籤添加到已經手工製作的標籤並不難。上述問題的修補程序已發佈,因此應接受此答案。 Riight? :) –