update 2
I don't understand your question maybe. (could you provide the wdsl of your servive?) To create a client like your php code:
use:
package com.mkyong.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.mkyong.ws.HelloWorld;
public class HelloWorldClient{
public static void main(String[] args) throws Exception {
URL url = new URL("http://localhost:9999/ws/hello?wsdl");
//1st argument service URI, refer to wsdl document above
//2nd argument is service name, refer to wsdl document above
QName qname = new QName("http://ws.mkyong.com/", "HelloWorldImplService");
Service service = Service.create(url, qname);
HelloWorld hello = service.getPort(HelloWorld.class);
System.out.println(hello.getHelloWorldAsString("mkyong"));
}
}
copy this file to com/mkyong/client. To compile use javac com/mkyong/client/HelloWorldClient.java
and to run use java com/mkyong/client/HelloWorldClient
, see also: Compiling four java files within one package using javac and making a java package in the command line
"Mapped" to your php example http://localhost:9999/ws/hello?wsdl
will be the equivalent of http://hostname:port/
and executeCommand
will be the same as hello.getHelloWorldAsString
.
update try JAX-WS (http://jax-ws.java.net/)
From http://www.mkyong.com/webservices/jax-ws/jax-ws-hello-world-example/:
package com.mkyong.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);
}
Beside the answer here: Working Soap client example you could find many tutorials which tell you how to write a soap client in java: