2016-07-27 8 views
0

私はsavon 2.11.1を使用していますが、私が覚えている以上にXML Webサービスのことを忘れてしまったことは間違いありません。次のような問題を持つ:名前空間/無効なコンテンツ

<wsdl:definitions xmlns:ns="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://myhost.com/ns/2008/08/15/webservices/ASUserManagement_1/wsdl" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsdws="http://myhost.com/ns/2008/08/15/webservices/AccessServices" name="ASUserManagement_1" targetNamespace="http://myhost.com/ns/2008/08/15/webservices/UserManagement/wsdl"> 
<wsdl:types> 
<xs:schema xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://myhost.com/ns/2008/08/15/webservices/AccessServices"> 
<xs:include schemaLocation="http://myhost.com:80/service/UserManagement?xsd=1"/> 
</xs:schema> 
</wsdl:types> 
<wsdl:message name="GetUserDetailsInput"> 
<wsdl:part name="GetUserDetails" element="xsdws:GetUserDetails"/> 
</wsdl:message> 
</wsdl:message> 
<wsdl:message name="GetAllUserDetailsInput"> 
<wsdl:part name="GetAllUserDetails" element="xsdws:GetAllUserDetails"/> 
</wsdl:message> 
<wsdl:portType name="ASUserManagement"> 
<wsdl:operation name="GetUserDetails_1"> 
<wsdl:input message="tns:GetUserDetailsInput"/> 
<wsdl:output message="tns:GetUserDetailsOutput"/> 
</wsdl:operation> 
<wsdl:operation name="GetAllUserDetails_1"> 
<wsdl:input message="tns:GetAllUserDetailsInput"/> 
<wsdl:output message="tns:GetAllUserDetailsOutput"/> 
</wsdl:operation> 
</wsdl:portType> 
<wsdl:binding name="ASUserManagementBinding" type="AAA-ASUserManagement"> 
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> 
<wsdl:operation name="GetUserDetails_1"> 
<soap:operation soapAction="GetUserDetails_1"/> 
<wsdl:input> 
<soap:body parts="GetUserDetails" use="literal"/> 
</wsdl:input> 
<wsdl:output> 
<soap:body parts="GetUserDetailsResponse" use="literal"/> 
</wsdl:output> 
</wsdl:operation> 
<wsdl:operation name="GetAllUserDetails_1"> 
<soap:operation soapAction="GetAllUserDetails_1"/> 
<wsdl:input> 
<soap:body parts="GetAllUserDetails" use="literal"/> 
</wsdl:input> 

は、だから、微調整(簡潔にするためにトリミングされた)私が見る実際のWSDL宣言でよく見る

Savon::SOAPFault: (S:Client) org.xml.sax.SAXParseException; cvc-elt.1: Cannot find the declaration of element 'xsdws:GetUserDetails'. 

:そう

client = Savon.client(wsdl: 'http://myhost.com/service?wsdl') 
client.operations 
=> [:get_user_details_1, :get_all_user_details_1, :set_user_details_1] 
client.call(:get_user_details_1, message: { uuid: "ABC" }) 

は私にエラーメッセージが表示されましたxs:schema要素で宣言されている名前空間を含めることができます。

client = Savon.client(wsdl: 'http://myhost.com/service?wsdl', namespace: 'http://myhost.com/ns/2008/08/15/webservices/AccessServices') 
client.call(:get_user_details_1, message: { uuid: "ABC" }) 
Savon::SOAPFault: (S:Client) org.xml.sax.SAXParseException; cvc-complex-type.2.4.a: Invalid content was found starting with element 'uuid'. One of '{"http://www.reuters.com/ns/2008/08/15/webservices/AAA-AccessServices_1":uuid}' is expected. 

ない私がここで間違ってやっていることを確認 - 自動生成された.NETクライアントプロキシコードからサンプル有効な要求をフィドラーで次のようになります。

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetAllUserDetails xmlns="http://myhost.com/ns/2008/08/15/webservices/AccessServices"><uuid>ABC</uuid></GetAllUserDetails></soap:Body></soap:Envelope> 

私は過ちを犯してきた任意のアイデア?

答えて

0

log_levelとlogをtrueに設定している間に、namespace_identifierとnamespaceをクライアント内のパラメータとして設定できます。

Savon.client(
     wsdl: "http://myhost.com/service?wsdl", 
     log: true, 
     log_level: :debug, 
     pretty_print_xml: true, 
     namespace_identifier: :xsdws, 
     namespaces: {"xmlns:xsdws" => "http://myhost.com/ns/2008/08/15/webservices/AccessServices","xmlns:tns"=>"http://myhost.com/ns/2008/08/15/webservices/ASUserManagement_1/wsdl"} 

    ) 

これは、あなたが問題を見つけ出すのに役立ちます。

乾杯