java - sending https post request with post data using spring web -


i'm trying understand how send https post request post data using spring web or , other spring tools.

so far i've been using httpclient i'm trying convert spring :)

the https post request should ignore self signed certificate.

please provide example on how can done.

thank you

i use spring integration send http post , http://static.springsource.org/spring-integration/reference/html/http.html request-factory bean need configured allow self-signed certificates. use following wiring declare apachehttpsrequestfactory used http spring integration endpoints.

the httpclient bean can injected other spring beans , used send http requests:

@autowired private httpclient httpclient; 

here fragment of spring-intefration-context.xml:

<!-- https connection trust self signed certificates --> <bean id="sslsocketfactory" class="org.apache.http.conn.ssl.sslsocketfactory">     <constructor-arg name="truststrategy">         <bean class="org.apache.http.conn.ssl.trustselfsignedstrategy" />     </constructor-arg>     <constructor-arg name="hostnameverifier">         <bean class="org.apache.http.conn.ssl.allowallhostnameverifier" />     </constructor-arg> </bean> <bean id="httpsschemaregistry" class="org.apache.http.conn.scheme.schemeregistry">     <property name="items">         <map>             <entry key="https">                 <bean class="org.apache.http.conn.scheme.scheme">                      <constructor-arg value="https" />                     <constructor-arg value="443" />                     <constructor-arg ref="sslsocketfactory" />                 </bean>             </entry>         </map>     </property> </bean> <bean id="httpclient" class="org.apache.http.impl.client.defaulthttpclient">     <constructor-arg>         <bean class="org.apache.http.impl.conn.poolingclientconnectionmanager">             <constructor-arg ref="httpsschemaregistry" />         </bean>     </constructor-arg> </bean> <bean id="apachehttpsrequestfactory"     class="org.springframework.http.client.httpcomponentsclienthttprequestfactory">     <constructor-arg ref="httpclient" /> 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -