After Java creates the webservice, you can access the wsdl, but cannot access the service.

problem description

refer to the online code ( https://www.cnblogs.com/xdp-g.). After opening the service, the browser cannot access the service directly, but can access its wsdl.

https://bbs.csdn.net/topics/3...jdk1.81.7

related codes

package com.junzhang.webservice;

import javax.xml.ws.Endpoint;

/**
 * Endpoint()webservice
 * @author oiu
 *
 */
public class WebServicePublish {

     public static void main(String[] args) {
            //WebServiceWeberviceURLURL:http://ip:/xxxx            
            String address = "http://127.0.0.1:8002/Webservice";
            //EndpointpublishWebService
            Endpoint.publish(address , new WebServiceImpl());
            System.out.println("webservice!");
        }
}

package com.junzhang.webservice;

import javax.jws.WebService;

@WebService
public class WebServiceImpl implements WebServiceI{

     @Override
        public String sayHello(String name) {
            System.out.println("WebService sayHello "+name);
            return "sayHello "+name;
        }

        @Override
        public String save(String name, String pwd) {
            System.out.println("WebService save "+name+" "+pwd);
            return "save Success";
        }
        
}

package com.junzhang.webservice;

import javax.jws.WebMethod;
import javax.jws.WebService;

/**
 * interface@WebService@WebMethod
 * @author oiu
 *
 */

@WebService
public interface WebServiceI {

     //@WebMethodWebServiceI
    @WebMethod
    String sayHello(String name);
    
    @WebMethod
    String save(String name,String pwd);
    
}

what result do you expect? What is the error message actually seen?

May.23,2021

* * Hello, have you solved this problem? have you encountered the same

? < hr >

like questions bold text *

Menu