简体   繁体   English

通过NetBeans在Java Web服务中获取方法?

[英]GET method in java web service via netbeans?

i'm currently creating a java web service via Netbeans. 我当前正在通过Netbeans创建一个Java Web服务。 I'm deploying the web service to a Tomcat 7. I'm able to call the web service via the POST method but i'd like to use GET as well. 我正在将Web服务部署到Tomcat7。我可以通过POST方法调用该Web服务,但是我也想使用GET。 I have no idea how to make GET work. 我不知道如何使GET工作。 Is it a config issue with tomcat, do i need to add specific code in the web service, ...? 这是tomcat的配置问题,我是否需要在Web服务中添加特定的代码,...?

When you are saying "web services" you mean SOAP, right? 当您说“ Web服务”时,您指的是SOAP,对吗? Or may be REST? 还是REST?
SOAP web services over HTTP can only use POST, since the POST body contains the SOAP Request, while GET request cannot contain body. 通过HTTP的SOAP Web服务只能使用POST,因为POST正文包含SOAP请求,而GET请求不能包含正文。

NetBeans will create SOAP based webservice by default , unless you ask for RESTFULL webservices. NetBeans默认情况下将创建基于SOAP的Web服务,除非您要求提供RESTFULL Web服务。 You cannot call a SOAP webservice via GET. 您无法通过GET调用SOAP Web服务。

you need to request webservice url as normal in java, but first you must make webservice to run with get method by adding in web.config under system.web 您需要在Java中正常请求Web服务url,但是首先必须通过在system.web下添加web.config来使Web服务与get方法一起运行

<webServices>
    <protocols>
        <add name="HttpGet"/>
        <add name="HttpPost"/>
    </protocols>
</webServices>

then request your webservice and send paramters in querysting normally. 然后请求您的Web服务并正常发送参数。

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

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