2011-07-03 2 views
2

전에 SOAP을 사용해 왔지만 여러 해 전에 사용해 본 결과 도움이 될만한 것이 확실합니다. "비누 클라이언트"OS X 용 응용 프로그램은 내가 원하는 응답을 얻을 수 있습니다 사용Savon이 올바른 XML을 형성하지 못함

짧은 이야기 ...

  • .
  • client.request :foo_web_serivce, :language_count, :body => { :foo_app_id => "...", :session_id => "..." }을 사용하는 경우 Status 200이 표시되지만 내 결과는 -1입니다. app_id가 인식되지 않는다고 생각합니다.
  • Savon의 호출 (<foo_web_service:LanguageCount>)이 아닌 Soap Client 호출 (<LanguageCount>)을 복제하려고하면 Status 500이 표시됩니다.

미리 감사드립니다. 나는과 같이 콘솔에 그것을하려고 할 때, 그러나

User-Agent: Mac OS X; WebServicesCore (357) 
Content-Type: text/xml 
Host: redacted 
Soapaction: http://tempuri.org/redacted/LanguageCount 

<?xml version="1.0" encoding="utf-8"?> 
    <SOAP-ENV:Envelope 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 
    SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> 
     <SOAP-ENV:Body> 
     <LanguageCount xmlns="http://tempuri.org/"> 
      <fooAppID xsi:type="xsd:string">12345678-1234-1234-1234-123456789123</fooAppID> 
      <sessionID xsi:type="xsd:string">12345678-1234-1234-1234-123456789123</sessionID> 
     </LanguageCount> 
     </SOAP-ENV:Body> 
    </SOAP-ENV:Envelope> 

: 내가 올바른 요청 XML 인 것을 알 수 있습니다 SOAP 클라이언트를 사용하여

긴 이야기 ...

내가 foo_web_service의 네임 스페이스를 사용할 때
ruby-1.8.7-p302 > client = Savon::Client.new do |wsdl, http, wsse| 
ruby-1.8.7-p302 >  wsdl.document = "http://FooService.cloudapp.net/FooService.svc?wsdl" 
ruby-1.8.7-p302 ?> end 
=> #<Savon::Client:0x1055e2dc8 @http=#<HTTPI::Request:0x1055e2bc0>, @wsse=#<Savon::WSSE:0x1055e2b98>, @wsdl=#<Savon::WSDL::Document:0x1055e2c10 @request=#<HTTPI::Request:0x1055e2bc0>, @document="http://FooService.cloudapp.net/FooService.svc?wsdl">> 
ruby-1.8.7-p302 > 
ruby-1.8.7-p302 > client.request :language_count, :body => {:Foo_app_id => "12345678-1234-1234-1234-123456789123", :session_id => "12345678-1234-1234-1234-123456789123"} 
Retrieving WSDL from: http://FooService.cloudapp.net/FooService.svc?wsdl 
HTTPI executes HTTP GET using the net_http adapter 
SOAP request: http://Fooservice.cloudapp.net/FooService.svc 
SOAPAction: "LanguageCount", Content-Type: text/xml;charset=UTF-8 
<?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:wsdl="http://tempuri.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><LanguageCount><FooAppId>12345678-1234-1234-1234-123456789123</FooAppId><sessionId>12345678-1234-1234-1234-123456789123</sessionId></LanguageCount></env:Body></env:Envelope> 
HTTPI executes HTTP POST using the net_http adapter 
SOAP response (status 500): 
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcode xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none">a:ActionNotSupported</faultcode><faultstring xml:lang="en-US">The message with Action 'LanguageCount' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).</faultstring></s:Fault></s:Body></s:Envelope> 
Savon::SOAP::Fault: (a:ActionNotSupported) The message with Action 'LanguageCount' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None). 

는하지만, 내가 얻을 :

ruby-1.8.7-p302 > client = Savon::Client.new do |wsdl, http, wsse| ruby-1.8.7-p302 >  wsdl.document = "http://FooService.cloudapp.net/FooService.svc?wsdl" ruby-1.8.7-p302 ?> end => 
#<Savon::Client:0x105882498 @http=#<HTTPI::Request:0x105882358>, @wsse=#<Savon::WSSE:0x105882330>, @wsdl=#<Savon::WSDL::Document:0x105882380 @request=#<HTTPI::Request:0x105882358>, @document="http://FooService.cloudapp.net/FooService.svc?wsdl">> ruby-1.8.7-p302 > ruby-1.8.7-p302 > client.request :Foo_web_service, :language_count, :body => {:Foo_app_id 
=> "12345678-1234-1234-1234-123456789123", :session_id => "12345678-1234-1234-1234-123456789123"} Retrieving WSDL from: http://FooService.cloudapp.net/FooService.svc?wsdl HTTPI executes HTTP GET using the net_http adapter SOAP request: http://Fooservice.cloudapp.net/FooService.svc SOAPAction: "http://tempuri.org/FooService/LanguageCount", Content-Type: text/xml;charset=UTF-8 <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:Foo_web_service="http://tempuri.org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><Foo_web_service:LanguageCount><FooAppId>12345678-1234-1234-1234-123456789123</FooAppId><sessionId>12345678-1234-1234-1234-123456789123</sessionId></Foo_web_service:LanguageCount></env:Body></env:Envelope> HTTPI executes HTTP POST using the net_http adapter SOAP response (status 200): <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><LanguageCountResponse xmlns="http://tempuri.org/"><LanguageCountResult>-1</LanguageCountResult></LanguageCountResponse></s:Body></s:Envelope> 
=> #<Savon::SOAP::Response:0x105a2cca8 @http=#<HTTPI::Response:0x105a28ce8 @body="<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"><s:Body><LanguageCountResponse xmlns=\"http://tempuri.org/\"><LanguageCountResult>-1</LanguageCountResult></LanguageCountResponse></s:Body></s:Envelope>", @raw_body="<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"><s:Body><LanguageCountResponse xmlns=\"http://tempuri.org/\"><LanguageCountResult>-1</LanguageCountResult></LanguageCountResponse></s:Body></s:Envelope>", @code=200, @headers={"x-powered-by"=>"ASP.NET", "x-aspnet-version"=>"4.0.30319", "content-type"=>"text/xml; charset=utf-8", "date"=>"Sat, 02 Jul 2011 23:40:56 GMT", "server"=>"Microsoft-IIS/7.0", "content-length"=>"214", "cache-control"=>"private"}>, @soap_fault=Savon::SOAP::Fault, @http_error=Savon::HTTP::Error> ruby-1.8.7-p302 > 

답변

7

짧게 요약하면 3 가지를 변경해야합니다.

  1. 가 명시 적으로 같은이 SOAPAction라고
  2. client.request 호출의 끝에 response = client.request "LanguageCount"
  3. 에 추가 :xmlns => "http://tempuri.org/"response = client.request :language_count을 변경 : 봤는데으로 client.http.headers["SOAPAction"] = '"http://tempuri.org/FooService/LanguageCount"'

희망이 사람을 도와줍니다 주말 동안 SOAP 지옥에서 그리고 잘하면 내가 다른 사람을 거기에서 멈추게 할 것이다.

+0

나는 1, 3 점을 계산했지만 2는 나에게 고통의 세계를 구해 주었다. - 감사합니다! – robd

관련 문제