Search code examples
javaweb-servicessoapwsdljava-ws

Invoking SOAP methods JAX-WS


I have the following problem and would really appreciate any pointers:

I am trying to implement a SOAP service using a top-down approach - I have been given a WSDL file and am supposed to write a soap service that corresponds to it.

I generated the necessary files using wsgen - so far so good. I am now trying to do an initial test and prove that the service works, but have been unsuccessful. This is one of the methods that was generated, the echo method:

@WebMethod(operationName = "Echo", action = "http://tempuri.org/echo")
@RequestWrapper(localName = "Echo", targetNamespace = "http://tempuri.org/", className = "org.tempuri.Echo")
@ResponseWrapper(localName = "EchoResponse", targetNamespace = "http://tempuri.org/", className = "org.tempuri.EchoResponse")
public void echo(@WebParam(name = "DatumTimePost", targetNamespace = "http://tempuri.org/") String dateTimePost,
        @WebParam(name = "EchoResult", targetNamespace = "http://tempuri.org/", mode = WebParam.Mode.OUT) Holder<String> echoResult,
        @WebParam(name = "DateTimeExt", targetNamespace = "http://tempuri.org/", mode = WebParam.Mode.OUT) Holder<String> DateTimeExt);

The method is a part of a service named Service1Soap, which has the following annotations:

@WebService(name = "Service1Soap", targetNamespace = "http://tempuri.org/")
@XmlSeeAlso({
    ObjectFactory.class
})

I exposed the service using an Endpoint:

Endpoint.publish("http://localhost:8080/ws/hello", new Service1SoapImpl());

However, when I try to invoke the Echo method using SoapUI, here is what I get as a response:

<faultstring>Cannot find dispatch method for {http://tempuri.org/echo}Echo</faultstring>

I try to invoke the method by putting http://localhost:8080/ws/hello in the request uri field in SoapUI, while the request itself has been generated by SOAPUI itself after importing the wsdl.

I have pretty much run out of ideas regarding what I am doing wrong so any sort of hope would be greatly appreciated.


Solution

  • For what you've posted, this is the only difference I can find:

    Endpoint.publish("http://localhost:8080/ws/hello", new Service1Soap()
    {
    
        @Override
        public String uparivanje(String datum, String spisakTransakcija)
        {
            // TODO Auto-generated method stub
            return null;
        }
    
        @Override
        public void storno(String idTransakcijaStornoPosta, String idTransakcijaPosta, String posta, String idRadnik, String datumVreme, Holder<String> stornoResult, Holder<String> idTransakcijaStornoExt, Holder<String> brojTelefona, Holder<String> username)
        {
            // TODO Auto-generated method stub
    
        }
    
        @Override
        public void echo(String datumVremePosta, Holder<String> echoResult, Holder<String> datumVremeExt)
        {
            // TODO Auto-generated method stub
        }
    
        @Override
        public void dopuna(String idTransakcijaPosta, String idKorisnik, String iznos, String posta, String idRadnik, String datumVreme, Holder<String> dopunaResult, Holder<String> idTransakcijaExt, Holder<String> brojTelefona, Holder<String> username)
        {
            // TODO Auto-generated method stub
    
        }
    });