2016-08-25 2 views
5

나는 Rails에서 무거운 SOAP API로 작업하는 멋진 작업을했습니다. SOAP 서비스에는 세 가지 바인딩이 있습니다. wsHttpBinding, x509로 wsHttpBinding 및 사용자 정의 바인딩. 저는 wsHttpBinding으로 끝점 두 개를 칠 수 있지만 세 번째는 사용자 이름과 암호가 필요합니다.이 사용자 이름과 암호는 작동하지 않습니다. 나는 cert 때문에 x509를 피할 것이고 사용자 정의 바인딩은 SoapUI에서 훌륭하게 작동하지만 Savon과 함께하면 아래 오류가 발생합니다.사용자 정의 바인딩이있는 Savon

EndpointDispatcher에서 ContractFilter가 일치하지 않기 때문에받는 사람에게 ''동작이있는 메시지를 처리 ​​할 수 ​​없습니다. 계약 불일치 (보낸 사람과받는 사람 간의 동작이 일치하지 않음) 또는 보낸 사람과받는 사람 사이의 바인딩/보안 불일치가 원인 일 수 있습니다. 발신자와 수신자가 동일한 계약 및 동일한 바인딩 (메시지, 전송, 없음과 같은 보안 요구 사항 포함)을 가지고 있는지 확인하십시오.

Savon으로 생성 된 정확한 XML을 가져 와서 SoapUI에 저장하면 작동합니다.

이것이 바인딩 문제 일 수 있습니까? 이 사용자 지정 바인딩을 사용하도록 지시하는 방법이 있습니까?

는 여기에 편집 # 1

이 도움 넣다 여기에 내 현재 클라이언트 설치가

<bindings> 
    <customBinding> 
    <binding name="cust"> 
     <textMessageEncoding messageVersion="Soap12" /> 
     <httpTransport /> 
    </binding> 
    <binding name="cust1"> 
     <textMessageEncoding messageVersion="Soap12" /> 
     <httpTransport /> 
    </binding> 
    <binding name="cust2"> 
     <textMessageEncoding messageVersion="Soap12" /> 
     <httpTransport /> 
    </binding> 
    </customBinding> 
</bindings> 
<endpoint address="http://api.xyz.com/stuff.svc/cust" 
    binding="customBinding" bindingConfiguration="cust" contract="stuff.Xstuff" 
    name="cust" /> 

의 App.config

에서 발견 한 바인딩 사용자 정의입니다.

@client = Savon.client(
     wsdl: 'http://api.xyz.com/stuff.svc?wsdl', 
     wsse_auth: %w'username password', 
     wsse_timestamp: true, 
     raise_errors: false, 
     log: true, 
     log_level: :debug, 
     soap_version: 2, 
     pretty_print_xml: true, 
     convert_request_keys_to: :none, 
     use_wsa_headers: true, 
     headers: {'Content-Type' => 'application/soap+xml; charset=utf-8'} 

편집 # 2

나는이 문제를 발견했다. Savon은 SoapUI와 같은 Content-Type의 동작을 설정하지 않았습니다. Savon과 SoapUI 요청을 다시 비교해 보도록 제안한 @RicardoPontual 덕분에,이 문제는 내가 더 가까이서보고 문제를 알게했습니다.

headers: {'Content-Type' => 'application/soap+xml;charset=UTF-8;action="tempuri.org/stuf‌​f/set_table_stuff"'} 
+0

savon 클라이언트와 SOAP UI 모두에서 비누 메시지를 검사하려고 시도 했습니까? 서비스 로깅을 활성화하면 들어오는 비누 메시지를 검사하고 관련 차이점을 찾을 수 있습니다. –

+0

나는 savon이 필요한 헤더 나 네임 스페이스를 보내지 않는다고 의심하고, 두 요청을 비교하고 결과를 게시 해보십시오. –

+0

@RicardoPontual 지금까지 두 요청을 비교해 보았습니다.하지만이 제안을 통해 다시 살펴 보았습니다. 그리고 그 문제를 발견했습니다! SoapUI가 Content-Type에서 작업을 설정하고 있음을 알 수 있습니다. 그래서이 헤더로 { 'Content-Type'=> 'application/soap + xml; charset = UTF-8; action = "http://tempuri.org/stuff/set_table_stuff"'} 헤더를 변경했습니다. 이제 작동합니다. 사본이 제대로 설정하지 않은 것 같습니다. – KevinM

답변

1

우리가 의견 이야기 무엇에 기반하여, 싶어 소비하는 작업의 조치를 헤더를 추가

@client = Savon.client(
     wsdl: 'http://api.xyz.com/stuff.svc?wsdl', 
     wsse_auth: %w'username password', 
     wsse_timestamp: true, 
     raise_errors: false, 
     log: true, 
     log_level: :debug, 
     soap_version: 2, 
     pretty_print_xml: true, 
     convert_request_keys_to: :none, 
     use_wsa_headers: true, 
     headers: {'Content-Type' => 'application/soap+xml;charset=UTF-8;action="tempuri.org/stuf‌​f/set_table_stuff"'} 
    ); 
2

는이 같은 콘텐츠 유형에 헤더를 action="tempuri.org/stuf‌​f/set_table_stuff"'을 설정해야합니다

@client = Savon.client(
     wsdl: 'http://api.xyz.com/stuff.svc?wsdl', 
     wsse_auth: %w'username password', 
     wsse_timestamp: true, 
     raise_errors: false, 
     log: true, 
     log_level: :debug, 
     soap_version: 2, 
     pretty_print_xml: true, 
     convert_request_keys_to: :none, 
     use_wsa_headers: true, 
     headers: {'Content-Type' => 'application/soap+xml; charset=UTF-8; action="tempuri.org/stuf‌​f/set_table_stuff";'}