[英]Java-ws tomcat invoke methods through http?
I made a web project in Java, using Java-WS. 我使用Java-WS在Java中创建了一个Web项目。 How can I invoke service methods through HTTP only.
如何仅通过HTTP调用服务方法。 I don't want to generate (or worse write) any java web clients, and similar stuff.
我不想生成(或更糟糕的是编写)任何Java Web客户端以及类似的东西。 I'd just like to invoke the method with a HTTP request.
我只想用HTTP请求调用该方法。 And parse the result (manually) from response.
并从响应中解析结果(手动)。
In .NET web services I invoke methods just with: 在.NET Web服务中,仅使用以下方法调用方法:
http://serviceUrl/serviceName.asmx/operationName?parametars=...
How to do the same thing in java + tomcat? 如何在java + tomcat中做同样的事情?
Edit: Let me rephrase my question. 编辑: 让我改一下我的问题。 So this is what I have done so far:
所以这是我到目前为止所做的:
I deploy the app on tomcat and it deploys fine. 我将应用程序部署在tomcat上,并且部署良好。 Now, what do I need to do to be able to invoke my WebMethods via HTTP?
现在,我需要做些什么才能能够通过HTTP调用我的WebMethod?
Typing: 输入:
http://localhost:8084/MyService/MyMethod
doesn't work. 不起作用。
Sorry if this is a stupid question, but I'm not really a Java guru, I've been working mostly on .NET. 抱歉,如果这是一个愚蠢的问题,但是我并不是Java专家,我主要在.NET上工作。
Multiple possibilities: 多种可能性:
new URL(url).openConnection().getInputStream()
new URL(url).openConnection().getInputStream()
RestTemplate
RestTemplate
In this case, if you want to do an HTTP Web Service that returns an HTTP 200 Web Response, why not look at doing a RESTFul application? 在这种情况下,如果要执行返回HTTP 200 Web响应的HTTP Web服务,为什么不考虑执行RESTFul应用程序呢?
JavaWorld briefly explains the role/use of REST. JavaWorld简要解释了REST的角色/用途。 There's been similar questions on REST tutorials in SO .
SO中的 REST教程也存在类似的问题。 I hope this helps you.
我希望这可以帮助你。
Apache CXF has a 'plain http binding', but we recommend that people write JAX-RS services, instead. Apache CXF具有“普通http绑定”,但是我们建议人们改写JAX-RS服务。 They are very, very, simple.
它们非常非常简单。 However, the plain HTTP binding is there and supports GET.
但是,纯HTTP绑定在那里并支持GET。
I generate a RESTful Web Service in NetBeans by clicking on "Generate SOAP-over-HTTP Wrapper" in my service context menu. 我通过在服务上下文菜单中单击“通过HTTP生成SOAP包装器”在NetBeans中生成RESTful Web服务。 It generated successfully, compiles and deploys fine.
它成功生成,编译和部署良好。 But I still can't figure out how to make a HTTP invoke
但是我仍然不知道如何进行HTTP调用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.