I'm sure it's possible, but can't seem to figure it out. My app makes a POST request for some HTML and I'd like to somehow just retrieve a certain part of the HTML document. So I've set my expected-response-type as javax.xml.transform.Source. The response goes to a channel that will eventually have an xpath-expression for the node of HTML I want, but for now I'm simply testing to at least get an attribute value from the html root element.
At first when I ran my app, it told me that no MessageConverter could be found for javax.xml.transform.Source, so I created my own list of messageConverters and referenced it on the message-converters attribute. The list contains a SourceHttpMessageConverter. However when I run the app, I still get the same error. Maybe I'm not taking the correct approach.
Code:<channel id="conferenceStandingsRequestChannel"/> <int-http:outbound-gateway id="conferenceStandings" request-channel="conferenceStandingsRequestChannel" url="${nhl.conference.standings.url}" http-method="POST" expected-response-type="javax.xml.transform.Source" charset="UTF-8" reply-channel="conferenceStandingsResponseChannel" message-converters="messageConverters"> <int-http:uri-variable name="season" expression="payload"/> </int-http:outbound-gateway> <int-xml:xpath-transformer input-channel="conferenceStandingsResponseChannel" output-channel="myChannel" xpath-expression="/html/@xmlns" evaluation-type="STRING_RESULT"/> <service-activator input-channel="myChannel" ref="conferenceStandingsMessageHandler" method="handleMessage"/> <util:list id="messageConverters"> <beans:bean class="org.springframework.http.converter.xml.SourceHttpMessageConverter"/> <beans:bean class="org.springframework.http.converter.StringHttpMessageConverter"/> </util:list>


Reply With Quote