2013-10-01 32 views
0

我有工作在我的soapUI如何翻譯SOAP消息春天的webServiceTemplate.sendSourceAndReceiveToResult WS

<soapenv:Envelope xmlns:cen="http://netadmin.ghl.com/centralizedconfig" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> 
     <soapenv:Header> 
      <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> 
      <wsse:UsernameToken wsu:Id="UsernameToken-21"> 
       <wsse:Username>admin</wsse:Username> 
       <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">secret</wsse:Password> 
       <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">xo6ADfFZ5aqvukQZjUb6IQ==</wsse:Nonce> 
       <wsu:Created>2013-10-01T06:59:20.202Z</wsu:Created> 
      </wsse:UsernameToken> 
      <wsu:Timestamp wsu:Id="TS-20"> 
       <wsu:Created>2013-10-01T06:58:47.521Z</wsu:Created> 
       <wsu:Expires>2013-10-01T07:10:47.521Z</wsu:Expires> 
      </wsu:Timestamp> 
      </wsse:Security> 
     </soapenv:Header> 
     <soapenv:Body> 
      <cen:GetXMLRequest> 
      <cen:IpAddress>10.36.28.211</cen:IpAddress> 
      </cen:GetXMLRequest> 
     </soapenv:Body> 
    </soapenv:Envelope> 

一個SOAP消息調用每當我在我的SOAP UI運行這個測試我的web服務,其完美工作很好, 我有一個難度翻譯這個肥皂消息與我的webServiceTemplate.sendSourceAndReceiveToResult調用,我是新的web服務 ,我不知道如何將我的代碼包含標題消息。 有人可以幫助我嗎?

客戶呼叫:

webServiceTemplate.sendSourceAndReceiveToResult (URL,源,結果);

我似乎無法包括在參數

+0

你在Spring配置文件中配置的攔截器的安全性頭? – VirtualTroll

+0

謝謝你,我真的已經通過配置我的客戶端彈簧來解決它 – Chizbox

回答

1

我已經加入一個攔截器在我的春天的客戶應用程序上下文

<bean id="wss4jSecurityInterceptor" 
    class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor"> 
     <property name="securementActions" value="UsernameToken" /> 
     <property name="securementUsername" value="user" /> 
     <property name="securementPassword" value="password" /> 
     <property name="validationCallbackHandler" ref="callbackHandler" /> 
    </bean> 
+0

我不明白這個解決方案...你在客戶端使用安全攔截器?這如何修改您的客戶端SOAP頭以創建您提到的wsse:Security頭參數 – IcedDante