2017-07-26 28 views
6

Tôi có một vấn đề mà tôi tin là liên quan đến không gian tên. WSDL có thể được tải về từ đây: http://promostandards.org/content/wsdl/Order%20Shipment%20NotificationService/1.0.0/OSN-1-0-0.zipruby ​​savon và wsdl namespacing

Khi yêu cầu được tạo ra nó trông như thế này:

<soapenv:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://www.promostandards.org/WSDL/OrderShipmentNotificationService/1.0.0/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> 
<soapenv:Body> 
<tns:GetOrderShipmentNotificationRequest> 
    <tns:wsVersion>1.0.0</tns:wsVersion> 
    <tns:id>myusername</tns:id> 
    <tns:password>mypassword</tns:password> 
    <tns:queryType>3</tns:queryType> 
    <tns:shipmentDateTimeStamp>2017-07-19</tns:shipmentDateTimeStamp> 
</tns:GetOrderShipmentNotificationRequest> 
</soapenv:Body> 
</soapenv:Envelope> 

Điều này dẫn đến một lỗi xà phòng.

Khi soapUI xây dựng theo yêu cầu sử dụng WSDL cùng nó trông như thế này

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.promostandards.org/WSDL/OrderShipmentNotificationService/1.0.0/" xmlns:shar="http://www.promostandards.org/WSDL/OrderShipmentNotificationService/1.0.0/SharedObjects/"> 
<soapenv:Header/> 
<soapenv:Body> 
    <ns:GetOrderShipmentNotificationRequest> 
    <shar:wsVersion>1.0.0</shar:wsVersion> 
    <shar:id>myusername</shar:id> 
    <shar:password>mypassword</shar:password> 
    <ns:queryType>3</ns:queryType> 
    <ns:shipmentDateTimeStamp>2017-07-19</ns:shipmentDateTimeStamp> 
    </ns:GetOrderShipmentNotificationRequest> 
</soapenv:Body> 
</soapenv:Envelope> 

Bạn có thể thấy rằng soapUI đã đặt tên người dùng và mật khẩu bên trong "shar" namespace. Tôi nhận thấy rằng điều này không được liệt kê trực tiếp trong WSDL hoặc trong bất kỳ tệp XSD nào được WSDL tải trực tiếp. Nó được tải một cái gì đó như WSDL => XSD file => XSD tập tin có chứa không gian tên shar. đó có thể là vấn đề? Làm thế nào tôi có thể thêm không gian tên cho chỉ 3 của các phím? Tôi đang sử dụng savon 2.11.1 và nori 2.6.0

Trả lời

0

Tôi nghĩ Savon không giải thích các tệp XSD được liên kết, được sử dụng ở đây để tham chiếu SharedObject. Đã có một vấn đề tương tự và giải pháp duy nhất tôi tìm thấy là tự viết định nghĩa của các không gian tên.

Trong trường hợp của bạn nó có thể trông giống như thế này:

client = Savon.client do 
    endpoint "http://localhost/OrderShipmentNotificationService.svc" 
    element_form_default :qualified 
    namespace "http://www.promostandards.org/WSDL/OrderShipmentNotificationService/1.0.0/" 
    namespace_identifier :ns 
    namespaces "xmlns:shar"=>"http://www.promostandards.org/WSDL/OrderShipmentNotificationService/1.0.0/SharedObjects/" 
end 

response = client.call("GetOrderShipmentNotificationRequest") do |locals| 
    locals.message "shar:wsVersion"=>"1.0.0","shar:id"=>"myusername",... 
end 
Các vấn đề liên quan