如何使我的简单Java Web服务工作?

时间:2021-11-27 20:33:20

In a textbook exercise, we make 3 Java classes and an XML file.

在课本练习中,我们制作了3个Java类和一个XML文件。

My questions are:

我的问题是:

  1. Where should I save these .java files? I'm using NetBeans 6.5 so the default is My Documents.
  2. 我应该在哪里保存这些.java文件?我正在使用NetBeans 6.5,因此默认为My Documents。

  3. What should I name the XML file?
  4. 我应该将XML文件命名为什么?

I am using XAMPP so the file WSDL.xml I put in xampp/httdocs but when I open 127.0.0.1:9876[/]ts?wsdl it says page not found.

我正在使用XAMPP所以文件WSDL.xml我放入了xampp / httdocs,但是当我打开127.0.0.1:9876 [/]时,它会说找不到页面。

Note: I do not need to know how to create a Java class. I need to know where to put the file in which the class is defined.

注意:我不需要知道如何创建Java类。我需要知道在哪里放置定义类的文件。

3 个解决方案

#1


Subjective opinion:
If you don't know such basic things such as placing java files into right directories, perhaps, you should first try a few much simpler examples, than creating a web service.

主观意见:如果您不了解诸如将java文件放入正确的目录之类的基本内容,或许应该首先尝试一些比创建Web服务更简单的示例。

In Netbeans, you can create a Java project, than add Java classes by doing
File -> New... -> Java -> Java Class

在Netbeans中,您可以通过执行File - > New ... - > Java - > Java Class来创建Java项目,而不是添加Java类。

To learn how to use Netbeans, visit:
http://netbeans.org/kb/

要了解如何使用Netbeans,请访问:http://netbeans.org/kb/

Especially "NetBeans IDE Java Quick Start Tutorial" might be helpful to start.

特别是“NetBeans IDE Java快速入门教程”可能对您有所帮助。

Furthermore, you don't run Java webapps with some kind of XAMP, but with Java web servers such as Glassfish or Apache Tomcat.
Both these servers are bundled with Netbeans when you use Netbeans Java profile (see table at Netbeans download page)

此外,您不使用某种XAMP运行Java Web应用程序,而是运行GlassWeb服务器(如Glassfish或Apache Tomcat)。当您使用Netbeans Java配置文件时,这两个服务器都与Netbeans捆绑在一起(参见Netbeans下载页面上的表)

#2


I think you should follow ivan_ivanovich_ivanoff's adive and start with the basics.

我认为你应该遵循ivan_ivanovich_ivanoff的追求,并从基础开始。

When you have done that, you might want to come back here and read my answer to the question Stack Overflow: Simple Java web services. It assumes you know how to compile a Java class and how to package it into a JAR, but since these are pretty basic tasks you have to learn anyhow, it might help you getting your web service up and running.

完成后,您可能想回到这里阅读我对Stack Overflow:Simple Java Web services这个问题的回答。它假设您知道如何编译Java类以及如何将其打包到JAR中,但由于这些是非常基本的任务,您无论如何都要学习它,它可能有助于您启动和运行Web服务。

#3


Look at the example code provided with the book.

查看随书提供的示例代码。

#1


Subjective opinion:
If you don't know such basic things such as placing java files into right directories, perhaps, you should first try a few much simpler examples, than creating a web service.

主观意见:如果您不了解诸如将java文件放入正确的目录之类的基本内容,或许应该首先尝试一些比创建Web服务更简单的示例。

In Netbeans, you can create a Java project, than add Java classes by doing
File -> New... -> Java -> Java Class

在Netbeans中,您可以通过执行File - > New ... - > Java - > Java Class来创建Java项目,而不是添加Java类。

To learn how to use Netbeans, visit:
http://netbeans.org/kb/

要了解如何使用Netbeans,请访问:http://netbeans.org/kb/

Especially "NetBeans IDE Java Quick Start Tutorial" might be helpful to start.

特别是“NetBeans IDE Java快速入门教程”可能对您有所帮助。

Furthermore, you don't run Java webapps with some kind of XAMP, but with Java web servers such as Glassfish or Apache Tomcat.
Both these servers are bundled with Netbeans when you use Netbeans Java profile (see table at Netbeans download page)

此外,您不使用某种XAMP运行Java Web应用程序,而是运行GlassWeb服务器(如Glassfish或Apache Tomcat)。当您使用Netbeans Java配置文件时,这两个服务器都与Netbeans捆绑在一起(参见Netbeans下载页面上的表)

#2


I think you should follow ivan_ivanovich_ivanoff's adive and start with the basics.

我认为你应该遵循ivan_ivanovich_ivanoff的追求,并从基础开始。

When you have done that, you might want to come back here and read my answer to the question Stack Overflow: Simple Java web services. It assumes you know how to compile a Java class and how to package it into a JAR, but since these are pretty basic tasks you have to learn anyhow, it might help you getting your web service up and running.

完成后,您可能想回到这里阅读我对Stack Overflow:Simple Java Web services这个问题的回答。它假设您知道如何编译Java类以及如何将其打包到JAR中,但由于这些是非常基本的任务,您无论如何都要学习它,它可能有助于您启动和运行Web服务。

#3


Look at the example code provided with the book.

查看随书提供的示例代码。