2

サイトで利用可能な REST Web サービスにアクセスして、REST の結果を利用したいと考えていhttp://someotherhostます。そのためのプロキシクライアントを作成しました

Apache CXFRS クライアントを使用して上記の REST サービスをヒットし、結果をファイルに書き込みたいと考えています。私は次のことを行っていますが、以下を確認して、私が間違ったことをコメントしてください。

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) MY プロキシ サービス インターフェイス

    @Path(value="/getCities") 
    public interface CityService   { 

       @POST 
       @Produces(value="text/xml") 
       public String getCities(@QueryParam("countrycode") String countryCode); 
    } 

c) サービスへの呼び出し

   CityService cityService = (CityService) context.getBean("cityServiceClient"); 
   cityService.getCities("ae"); 

d) キャメルルート

  public class CityRoutes extends RouteBuilder { 

    public void configure() throws Exception { 

   //ROUTES 
    from("cxfbean:cityServiceClient") 
      .to("file://data/xmls/cities?fileName=test.xml"); 
    } 
} 
4

1 に答える 1