Tagged with " webservice"
19 Nov
2007

WebService mit PHP Server und Java Client

  • english
  • german

For my current private project that answers to the nice name "Telrunya" I'm trying to access a PHP web service through a Java client. I once heard in a .NET codecamp that WebServices are super cool and that it doesn't matter in which language they are implemented. But that doesn't apply if you're communication between 2 different technologies. In the Guxx blog I found the reversed case, how to access a java server through a PHP client. There is also a Java bridge developed by Zend that manages the conversion of the objects. But that seems to be an independent server or at least a server modul but that isn't considered by me. (furthermore it costs money)

Anyway, I tried the whole thing withion NetBeans IDE with JAX-WS. My WSDL file (document) written in Eclipse was successfully parsed and the Java files for client etc. were created. The client was also able to access the service but it failed to convert the values. Monitoring the HTTP traffic I can see that the right values are returned, but the Java client returns "null". I already read a lot of documentations and tutorials but I didn't find out anything about converting the received data.
Maybe someone has an advide for me?

Well, the old school alternative works but it is lond winded. Therefore I simply create an URL in Java, set my SOAP function as "RequestProperty" and send an handmade (or even by soapUI created) SOAP envelope. The result is the corresponding envelope returned that now has to be stripped and the relevant data has to be extracted. It could be so simply with JAX-WS but isn't....

17 Nov
2007

WebServices testen mit soapUI

Seit einiger Zeit beschäftige ich mich WebServices im Rahmen eines Projektes mit ein paar Freunden. Aktuell arbeite ich auch gerade wieder an einem privaten Projekt, welches WebServices nutzt.
Geschrieben ist ein Service ja relativ schnell, wobei "schreiben" da eher nicht ganz passt. Ich nutze hauptsächlich Eclipse mit WST, wobei der Editor da einige Bugs hat, Refactoring funktioniert meistens nicht und die normale Generation einer WSDL ist auch nicht ganz sauber.
Um also zu testen, ob meine WSDL und der entsprechende SoapServer (habe ich bisher nur in PHP gemacht) richtig definiert und implementiert sind, verwende ich soapUI. Das ist eine sehr coole Java-Applikation, mit der man WebServices eben testen kann: einfach in der Bedienung und übersichtlich. Ich nutze das meist wirklich nur, um zu prüfen, ob die gewünschten Daten bei entsprechender Eingabe zurückgesendet werden.
soapUI erstellt auch automatisch anhand der WSDL Beispielanfragen mit den benötigten Parametern, aber es kann noch viel mehr: es ist eine ganze Testumgebung für WebServices inklusive Validierung, LoadTests und WebService Simulation. Da ich bisher noch nicht so weit gekommen bin, mal Tests für Serviceanfragen zu erstellen, kann ich zum Rest nicht wirklich viel sagen. Aber wer sich dafür interessiert, sollte sich das Programm mal anschauen.

http://www.soapui.org