Я хочу получить результат REST, нажав веб-службу REST, доступную на сайте http://someotherhost
. я написал прокси-клиент для него
Я хочу запустить вышеупомянутую службу REST с помощью клиента apache CXFRS и записать результат в файл. для чего я делаю следующее, может ли кто-нибудь пересмотреть ниже и прокомментировать то, что я сделал неправильно.
a) Моя конфигурация контекста верблюда с apache cxf такая, как показано ниже
<jaxrs:client address="http://someotherhost/test/" id="cityServiceClient" username="test"
password="pwd"
serviceClass="com.santosh.proxy.service.city.CityService">
<jaxrs:features>
<ref bean="loggingFeature" />
</jaxrs:features>
</jaxrs:client>
<camelContext xmlns="http://camel.apache.org/schema/spring">
<package>com.santosh.routes</package>
<routeBuilder ref="cityserviceroutebuilder" />
</camelContext>
b) Мой сервисный прокси-интерфейс
@Path(value="/getCities")
public interface CityService {
@POST
@Produces(value="text/xml")
public String getCities(@QueryParam("countrycode") String countryCode);
}
в) Позвонить в сервис
CityService cityService = (CityService) context.getBean("cityServiceClient");
cityService.getCities("ae");
г) Верблюжий путь
public class CityRoutes extends RouteBuilder {
public void configure() throws Exception {
//ROUTES
from("cxfbean:cityServiceClient")
.to("file://data/xmls/cities?fileName=test.xml");
}
}