Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 更改Axis Web服务';s网址_Java_Web Services_Url_Webserver_Axis - Fatal编程技术网

Java 更改Axis Web服务';s网址

Java 更改Axis Web服务';s网址,java,web-services,url,webserver,axis,Java,Web Services,Url,Webserver,Axis,我正在使用Axis创建一个web服务,并在运行时使用AdminClient在运行时部署我的web服务。运行java文件后,我可以使用此URL访问web服务 http://127.0.0.1:8099/axis/services/MyWebService . 我想知道如何在运行时更改使用axis部署的web服务的URL。 我想将该URL更改为 http://127.0.0.1:8099/axis/services/MyWebService . http://127.0.0.1:8099/MyW

我正在使用Axis创建一个web服务,并在运行时使用AdminClient在运行时部署我的web服务。运行java文件后,我可以使用此URL访问web服务

http://127.0.0.1:8099/axis/services/MyWebService .
我想知道如何在运行时更改使用axis部署的web服务的URL。 我想将该URL更改为

http://127.0.0.1:8099/axis/services/MyWebService .
http://127.0.0.1:8099/MyWebService (OR) http://127.0.0.1:8099 .
我该怎么做?有什么建议吗

http://127.0.0.1:8099/axis/services/MyWebService .
这是我的密码

http://127.0.0.1:8099/axis/services/MyWebService .
import java.io.FileInputStream;
import java.io.InputStream;
import java.net.ServerSocket;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.axis.transport.http.SimpleAxisServer;

public class AxisTest {

    // start SimpleAxisServer
    public AxisTest(){        
    }
    public static void main(String[] args){
        try {
            int port = 8099;
            SimpleAxisServer server = new SimpleAxisServer();

            System.out.println("Opening server on port: "+ port);

            ServerSocket ss = new ServerSocket(port);
            ss.setSoTimeout(10000);
            server.setServerSocket(ss);

            server.start();
            System.out.println("Starting server...");

            // Read the deployment description of the service

            String deploymenDescriptorFileName = "deploy.wsdd";
            InputStream deploymentDescriptorStream = new     FileInputStream(deploymenDescriptorFileName); 

            // Now deploy our  web service            
            org.apache.axis.client.AdminClient adminClient;

            adminClient = new org.apache.axis.client.AdminClient();

            System.out.println("Deploying receiver server web service...");
            String process = adminClient.process(
                    new org.apache.axis.utils.Options(new String[] {"-ddd","-tlocal"}), 
                    deploymentDescriptorStream);
            System.out.println("Process : "+process);
            System.out.println("Server started. Waiting for connections on: " + port);

        } catch (Exception ex) {
            Logger.getLogger(AxisTest.class.getName()).log(Level.SEVERE, null, ex);
        } 
    }
}

您可以在wsdd文件中设置它,从

http://127.0.0.1:8099/axis/services/MyWebService .


stringy05
答案几乎是正确的。是的,你可以找到它

http://127.0.0.1:8099/axis/services/MyWebService .
要获得您想要的,您应该添加

http://127.0.0.1:8099/axis/services/MyWebService .
正如教程中所说:

http://127.0.0.1:8099/axis/services/MyWebService .
Axis servlet的路径。这应该与服务相同 在web.xml中定义的servlet映射。用于显示所选项目的列表 服务。默认值为“/services/”

http://127.0.0.1:8099/axis/services/MyWebService .
您应该修改
web.xml
,如下所示:

http://127.0.0.1:8099/axis/services/MyWebService .
<servlet-mapping>
   <servlet-name>AxisServlet</servlet-name>
   <url-pattern>/*</url-pattern>
</servlet-mapping>

AxisServlet
/*

我将在我的代码中解释我是如何做到这一点的。 我有两个类:Publisher和Deployer。 -Publisher发布(创建wsdl等)-这里我们提到了URL -Deployer在publisher中给定的URL上部署它们

http://127.0.0.1:8099/axis/services/MyWebService .
在Publisher中,我将URL(自定义)作为参数之一传递

http://127.0.0.1:8099/axis/services/MyWebService .
发布者代码:-发布者类应该扩展Java2WSDL。它应该有一个arg构造函数,我们可以在其中设置自定义WSDL文件名、Web服务的URL等。将这些元素添加到列表中,并将列表作为参数传递给“super.run(List)

http://127.0.0.1:8099/axis/services/MyWebService .
要从Publisher.java的main()方法在其run()方法中传递的示例参数:-

http://127.0.0.1:8099/axis/services/MyWebService .
因此,这就是发布定制web服务的方式

http://127.0.0.1:8099/axis/services/MyWebService .
现在部署它们:- java应该扩展org.apache.axis.client.AdminClient类。 要从其main()方法在“super.process(list)”中传递的示例参数:-

http://127.0.0.1:8099/axis/services/MyWebService .
我没有在代码中提供每一个细节。
希望这有帮助。

是的,我可以调用我的WSDL,你可以在其中编辑服务的端点。我按照你的建议添加了端点。它在wsdl文件中也发生了更改,但我无法访问。我按照您的建议添加了端点,就像它的显示消息“AXIS引擎无法找到要调用的目标服务!targetService为null”
http://127.0.0.1:8099/axis/services/MyWebService .