簡體   English   中英

JAVA | CXF JAXRS非Spring客戶端

[英]JAVA | CXF JAXRS Non-Spring client

我們正在嘗試為我們的cxf jaxrs服務提供一個非spring客戶。 (不是網絡客戶端)

我們在spring上下文中具有以下元素(用於啟用kerberos身份驗證):

<http:conduit name="*.http-conduit">
        <http:authorization>
            <sec:AuthorizationType>Negotiate</sec:AuthorizationType>
        </http:authorization>
</http:conduit>

知道如何將其轉換為Java代碼嗎?

客戶端代碼示例:

JAXRSClientFactoryBean clientBean = new JAXRSClientFactoryBean();
clientBean.setResourceClass(ServiceClassName.class);
clientBean.setAddress(restful-service-url);

CXF文檔沒有明確指出: http ://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-以無彈簧依賴的方式以編程方式創建客戶端

謝謝,
蓋亞特里

dma_k為您指出了有關SOAP服務的正確信息。 如果您正在尋找REST服務的直接答案,請查看http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-ConfiguringClientsatRuntime

YourService proxy = JAXRSClientFactory.create(YourService.class);
ClientConfiguration config = WebClient.getConfig(proxy);
HTTPConduit conduit1 = (HTTPConduit)config.getConduit();
System.out.println(conduit1.getClient().getProxyServer());

此代碼使您可以訪問REST服務的管道,然后根據需要對其進行配置。 您只需要通過WebClient.getConfig()方法即可。

問候,加百利

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM