简体   繁体   English

使用Java调用静态Web服务(非SOAP)

[英]Calling a restful web service (non SOAP) with java

I'm trying to develop, using Java, a simple application that call a web-service restful which returns an xml and then I need to provide the result to a jsp page. 我正在尝试使用Java开发一个简单的应用程序,该应用程序调用一个可返回xml的web服务restful,然后需要将结果提供给jsp页面。 I was thinking to use CXF but what is not clear is the fact that the restful service can have different urls with parameters like: 我当时在考虑使用CXF,但尚不清楚的是,RESTful服务可以使用以下参数来具有不同的url:

http://ws-host.com/rest/products?BRAND=020&LOCALE=en_gb?product_code=600200 http://ws-host.com/rest/products?BRAND=020&LOCALE=en_gb?product_code=600200

http://ws-host.com/rest/products?BRAND=020&LOCALE=en_gb&VEHICLE_BRAND=test http://ws-host.com/rest/products?BRAND=020&LOCALE=en_gb&VEHICLE_BRAND=test

or 要么

http://ws-host.com/rest/dealers?BRAND=020&LOCALCE=en_gb&SEARCH_TERM=Test http://ws-host.com/rest/dealers?BRAND=020&LOCALCE=en_gb&SEARCH_TERM=Test

How can I do that? 我怎样才能做到这一点? I'm a bit confused. 我有点困惑。 Thanks 谢谢

CXF supports JSR-339 spec so you can use this API to create your mappings with different parameters. CXF支持JSR-339规范,因此您可以使用此API创建具有不同参数的映射。

You can use @QueryParam annotation, here is an example 您可以使用@QueryParam注释, 这是一个示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM