-1

In php have a class SoapClient I need a equivalente class in Java, anyone know a class or library?

example, in PHP i can make this:

$client = new SoapClient("http://xxx/yy/login.php?wsdl");
$ticket=$client->__soapCall('getXxx',array('login','senha')); 

how to i Do this in java?

ademar111190
  • 14,215
  • 14
  • 85
  • 114

3 Answers3

2

Maybe would be a good idea consider to apply Apache CXF. You can simple pass the WSDL to a class generator that will generate a Java API automatically for you.

The generated API will be a bunch of classes that has a kind of Façade. This Façade can be instantiated and used as other java class. The logic behind it is more or less like this: When some method is invoked the generated classes will create a SOAP request, request it to the webservice end-point, get the response, convert it into Java object and return it as a normal method invocation.

Apache CXF

Give a try, I'm pretty sure you will like it (I worked a long time with SOAPServer and SOAPClient too in PHP).

Some hints:

  1. You can download it and use WSDL to Java to generate a Java Façade: https://cwiki.apache.org/CXF20DOC/wsdl-to-java.html simple like wsdl2java -client HelloWorld.wsdl
  2. After java generation you can add the generated bunch of classes into your project and start using it (of course Apache CXF libs needs to be imported too).
Francisco Spaeth
  • 23,493
  • 7
  • 67
  • 106
1

It depends to WS framework you are using, for example, axis arcitecture describe how can you use client side axis application, Spring WS provides other way to develop, JavaEE other, BTW for testing you can use soapUI appliction

Sergii Zagriichuk
  • 5,389
  • 5
  • 28
  • 45
1

Apache SOAP for Java has defined various classes to build your own SOAP client.
You can refer to an article on client implementation at 'Client-Side SOAP'

Ravinder Reddy
  • 23,692
  • 6
  • 52
  • 82