所以XML請求字符串我進入薩翁client.call是如下(注意這個工程,我得到迴應):薩翁消息請求
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tem="http://tempuri.org/"
xmlns:mun="http://schemas.datacontract.org/2004/07/External.Service.Bo">
<soap:Header/>
<soap:Body>
<tem:GetInformationsForCoordinates>
<tem:coordReq>
<mun:Coordinates>
<mun:Coordinate>
<mun:Id>1</mun:Id>
<mun:QualityIndex>90</mun:QualityIndex>
<mun:X>-110.5322</mun:X>
<mun:Y>35.2108</mun:Y>
</mun:Coordinate>
</mun:Coordinates>
</tem:coordReq>
<tem:analysisTypes>
<mun:AnalysisType>Additional</mun:AnalysisType>
</tem:analysisTypes>
</tem:GetInformationsForCoordinates>
</soap:Body>
</soap:Envelope>
而不是通過在作爲XML這是不確實可行我想傳遞一個消息,所以我可以添加多個(可能的座標的陣列),多個分析類型容易等
Ruby代碼我不得不這樣做到目前爲止是:
coordinate = { Id: '1', QualityIndex: 90, X: -110.5322, Y: 35.2108}
coordinates = {Coordinates: [coordinate] }
coordinateReq = {coordReq: {coordinates: coordinates} }
然後我通過coor dinateReq到client.call - 我可以在Ruby中看到下面安慰產生的請求:
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:tns="http://tempuri.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<env:Body>
<tns:GetInformationsForCoordinates>
<coordReq>
<coordinates>
<Coordinates>
<Id>1</Id>
<QualityIndex>90</QualityIndex>
<X>-110.5322</X>
<Y>35.2108</Y>
</Coordinates>
</coordinates>
</coordReq>
</tns:GetInformationsForCoordinates>
</env:Body>
</env:Envelope>
有幾個問題 - 有沒有方法可以讓我的namespance門添加到類似於我絃斷XML正確的屬性(即Id/QualityIndex等)。在我的例子中,用Ruby代碼座標是小寫,然後座標是大寫,而它應該是大寫,但不是複數。最後,我需要包含分析類型(注意小寫字母大寫T),然後是AnalysisType,其中可能有多個請求,並且AnalysisType也需要mun命名空間。
你可以嘗試通過這些選項:'element_form_default:qualified','namespace_identifier:mun'到薩翁客戶端。 – Magnuss