Java soap client to wsdl url
Question: i want to call soap function with a few parameters. I did it python but how
can i do it on java ?

my code on python :

    
    
            url = 'http://78.188.50.246:8086/iskultur?singleWsdl'
            client = Client(url)
    
            d = dict(UserId='a', UserPass='b', Barkod=str(value))
    
            result = client.service.Stok(**d)
            return int(result)
    

how can i do it on java ?

Thanks for all


Answer: First you need to generate proxy classes. You can do that using `wsimport`
(it's a Java SE tool):

    
    
    wsimport -keep http://78.188.50.246:8086/iskultur?singleWsdl
    

This will generate classes (in packages) and place the results in the current
directory. I tested your URL and it generated two package hierarchies (one
starting in 'org' and the other in 'com'). The command above will keep the
source code, so you can move those directories to your Java project source
path (later you should include this code generation step in your build
process).

with the generated classes in your classpath, you now create a `Service`
instance from your `WSDL` (passing the URL and the namespace qualified name of
your service). I got that information from the WSDL.

    
    
    URL wsdlLocation = new URL("http://78.188.50.246:8086/iskultur?singleWsdl");
    QName serviceName = new QName("http://tempuri.org/", "EbWCFtoLogo");
    
    Service service = Service.create(wsdlLocation, serviceName);
    

Then you get a proxy where you can call your SOAP methods with
`Service.getPort()` passing the interface of the port (`IEbWCFtoLogo`). Now
you have a reference where you can call your remote SOAP methods.

    
    
    IEbWCFtoLogo proxy = service.getPort(IEbWCFtoLogo.class);
    

The `wsimport` tool generated a `stok()` method that receives 3 parameters. I
called with some of the values you used and it returned `-1.0` in the code
below:

    
    
    double value = proxy.stok("a", "b", "code");
    System.out.println("Result: " + value);
    

