¿Alguien puede dar una muestra del servicio web SOAP WSDL con un archivo wsdl?

Necesito crear un servidor de jabón con un archivo wsdl y permitir que mis clientes usen el servicio web con clientes de jabón sin modo wsdl.

Realmente agradecería si alguien puede publicar un ejemplo de código de servicio web en funcionamiento. Tengo problemas con un cliente de jabón que no es wsdl. Nadie en stackoverflow pudo responder mis preguntas anteriores, por lo que ahora solicito un código de muestra.

preguntado el 03 de diciembre de 13 a las 12:12

Tendré que buscar en mi código anterior para obtener una muestra, pero usé el marco YII para crear un servidor de jabón y generar mi wsdl. Es bastante fácil, pero veré si puedo encontrar algo de tiempo para publicar el código. -

@Rob Si tiene algo de experiencia con los servicios web, ¿puede echar un vistazo a esta pregunta? stackoverflow.com/questions/20366539/…. -

1 Respuestas

lets go, This is a sample hello world soap web service program, Go through the program,  if u doesn't understand anything ask me ...

actually, there are few styles available in soap binding, here i have used the rpc

    package com.kowthal.ws;

    import javax.jws.WebMethod;
    import javax.jws.WebService;
    import javax.jws.soap.SOAPBinding;
    import javax.jws.soap.SOAPBinding.Style;

    //Service Endpoint Interface
    @WebService
    @SOAPBinding(style = Style.RPC)
    public interface HelloWorld{

        @WebMethod String getHelloWorldAsString(String name);
     }


This is for implementation panel, the returned value will be mapped in soap webservice call
   package com.kowthal.ws;

    import javax.jws.WebService;

    //Service Implementation
    @WebService(endpointInterface = "com.kowthal.ws.HelloWorld")
    public class HelloWorldImpl implements HelloWorld{

        @Override
        public String getHelloWorldAsString(String name) {
            return "soap done by " + name;
        }

    }

this is the endpoint, here i had bind the data with specific url please note down the packages

    package com.kowthal.endpoint;

    import javax.xml.ws.Endpoint;
    import com.kowthal.ws.HelloWorldImpl;

    //Endpoint publisher
    public class HelloWorldPublisher{

        public static void main(String[] args) {
           Endpoint.publish[juz tag]("http://localhost:9988/ws/hello", new HelloWorldImpl());
        }

    }

This one is for client side communication

    package com.kowthal.client;

    import java.net.URL;
    import javax.xml.namespace.QName;
    import javax.xml.ws.Service;
    import com.kowthal.ws.HelloWorld;

    public class HelloWorldClient{
        public static void main(String[] args) throws Exception {
     URL url = new URL[juz tag]("http://localhost:9988/ws/hello?wsdl");
           QName qname = new QName[juz tag]("http://ws.kowthal.com/", "HelloWorldImplService");
                Service service = Service.create(url, qname);
                HelloWorld hello = service.getPort(HelloWorld.class);
                System.out.println(hello.getHelloWorldAsString("kowthal"));
            }

        }

after that using this url u can retrive the xml data
[juz tag]"http://localhost:9988/ws/hello?wsdl"

Respondido el 09 de diciembre de 13 a las 12:12

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.