Create a client with Apache cxf, soapUI(or Eclipse) and Fiddler

1.7k views Asked by At

My goal is to create a client to a web service with Apache CXF, located in a host (https://serverOutOfThisWorld) that I could only arrive through a putty tunnel.

L8400 -> serverOutOfThisWorld:443

I've added in my host the following:

 localhost serverOutOfThisWorld

So I could put in my browser

https://serverOutOfThisWorld:8400/Bus/SomeWebService?wsdl

And now, I can reach to this wsdl from a web browser without problem. But this WSDL has some imports that points out to this web, eg:

 <xsd:import namespace="http://inter.es/scsp/esquemas/datos" 
        schemaLocation="https://serverOutOfThisWorld/scehma/data.xml"/>
 <xsd:import ....

Therefore, the next step is, with Fiddler, trying to map any invocation to serverOutOfThisWorld:433 to my serverOutOfThisWorld:8400. Ok, I created in the Tools/HOSTS options with this:

serverOutOfThisWorld:8400 serverOutOfThisWorld

And, now, I can navigate to this url in a browser: https://serverOutOfThisWorld/Bus/SomeWebService?wsdl

And, with the proxy defined in SoapUI to make use of Fiddler, I can create a New->Soap Project based in that URL.

But my problem comes when I try to create a client with SoapUI, and Tools>Apache CFX. It seems that the URLs are not override. In The soapUI log, I see:

Mon Jun 22 14:07:22 CEST 2015:INFO:command: [cmd.exe, /C, wsdl2java.bat, -p, my.packages, -d, C:\eclipsewks\PruebaWS\src, -client, -exsh, false, -dns, true, -dex, true, -verbose, https://serverOutOfThisWorld:443/Bus/SomeWebService?wsdl]

It seems that in cmd/wsdl2Java is not using fiddler...

Other option is trying the same with eclipse.. but at last, eclipse also uses wsd2java for creating the client. What can I do?

2

There are 2 answers

1
bhdrkn On BEST ANSWER

It may not a direct answer to your question. Let me try to explain what I do when I am in a situation like this.

Instead using proxies and redirections, I simply download all the Wsdl and xsd files to the same directory. After that I update all the import statements with simple file names. Since all the files are in same directory, I just use names in import statements no other path definitions are needed.

If i want to use SoapUI, I just use my version of WSDL and then update endpoint to the real one(In your case this will be fiddler address) if needed.

If i want to generate java client, i just simply use command line with wsdl2java. Again, while using this client, I override its connection address accordingly.

0
Aitor On

Finally, I managed to get working this. You have to edit the wsdl2java (.bat or sh) and put the options to get the proxy in Fiddler working:

"%JAVA_HOME%\bin\java" -Xmx128M -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=8888 -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=8888

Now I hava other problem (with same classes name), but this is another problem (probably solved with binding names or something).