Using Tomcat 5.0 and Eclipse 3.1.
In your Tomcat/bin directory, there is a file called catalina.bat. From the command prompt, just run catalina to see the options. You'll see one option called:
jpda start Start Catalina under JPDA debugger
That's the one you need. I had endless problems running this until I changed the relevant part of the bat file to:
%_EXECJAVA% -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %ACTION%
i.e. the address and transport are specified in the command line rather than in environment options.
Now start Tomcat with this option.
In Eclipse, the project is set up in the normal way with java classes etc.
Breakpoint where you want the code to stop inside Tomcat (e.g. inside a web service)
and then select Run / Debug / Remote Java Application.
You only need to worry about the Connect tab. "Connection Type" is "Standard (Socket Attach)", host is e.g. "localhost" and the port is the port specified in the command line above under the "address" option i.e. 8000. Then press the "Debug" button.
Now invoke whatever to force your Tomcat code to execute e.g. running a web service client which invokes the web service you want to debug.
Bingo - Eclipse will catch the breakpoint and change to the Debug perspective.
Enjoy!
Ideas and thoughts about Microsoft Identity, C# development, cabbages and kings and random flotsam on the incoming tide
Wednesday, November 09, 2005
Thursday, November 03, 2005
SOAP : Compiling Axis WSDL2Java
So you've run Axis WSDL2Java and got all the Java files in their package and are battling to compile it all.
Don't sweat.
Add the following construct to the command line for WSDL2Java:
--buildFile
This constructs the build.xml file for you and then it's as simple as running "Ant".
Enjoy!
Don't sweat.
Add the following construct to the command line for WSDL2Java:
--buildFile
This constructs the build.xml file for you and then it's as simple as running "Ant".
Enjoy!
SOAP : Administer Axis
The "Administer Axis" feature is disabled by default for security reasons. To enable it, navigate to:
C:\Tomcat 5.0\webapps\axis\WEB-INF\web.xml
(This assumes that Axis is running inside Tomcat 5.0)
Then uncomment the section with the comment:
-- uncomment this if you want the admin servlet --
Enjoy!
C:\Tomcat 5.0\webapps\axis\WEB-INF\web.xml
(This assumes that Axis is running inside Tomcat 5.0)
Then uncomment the section with the comment:
-- uncomment this if you want the admin servlet --
Enjoy!
SOAP : Watch the obvious
From the Axis SOAP install documentation:
set AXIS_HOME=/usr/axis
set AXIS_LIB=$AXIS_HOME/lib
set AXISCLASSPATH=%AXIS_LIB%\axis.jar;%AXIS_LIB%\commons-discovery.jar;
%AXIS_LIB%\commons-logging.jar;%AXIS_LIB%\jaxrpc.jar;%AXIS_LIB%\saaj.jar;
%AXIS_LIB%\log4j-1.2.8.jar;%AXIS_LIB%\xml-apis.jar;%AXIS_LIB%\xercesImpl.jar
So you cut and paste and make a .bat file that does this and nothing works. Pull out hair. Hang on, lets have a look at the \lib directory. Ah!
It's not "commons-logging.jar" but rather "commons-logging-1.0.4.jar" and so on.
Sometimes it's the obvious that screws you!
Enjoy!
set AXIS_HOME=/usr/axis
set AXIS_LIB=$AXIS_HOME/lib
set AXISCLASSPATH=%AXIS_LIB%\axis.jar;%AXIS_LIB%\commons-discovery.jar;
%AXIS_LIB%\commons-logging.jar;%AXIS_LIB%\jaxrpc.jar;%AXIS_LIB%\saaj.jar;
%AXIS_LIB%\log4j-1.2.8.jar;%AXIS_LIB%\xml-apis.jar;%AXIS_LIB%\xercesImpl.jar
So you cut and paste and make a .bat file that does this and nothing works. Pull out hair. Hang on, lets have a look at the \lib directory. Ah!
It's not "commons-logging.jar" but rather "commons-logging-1.0.4.jar" and so on.
Sometimes it's the obvious that screws you!
Enjoy!
Thursday, October 27, 2005
WL : Posting SOAP request directly to the SOAP server
It's often useful to make changes to the SOAP request to see what happens. Normally, you have to do this via code and then re-compile the client.
However, you can do this via the command line.
Run the Weblogic "setDomainEnv.cmd" first to set up the environment and then:
java weblogic.webservice.tools.debug.Post "file name"
where "file name" is a file that contains the SOAP request.
Using this you can add / change the request parameters by simply using a text editor.
Much simpler.
An example of the file format is:
POST ...method... HTTP/1.1
Content-Type: text/xml
SOAPAction: ""
User-Agent: Java/1.4.2_06
Host: ...host...
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
#?xml version="1.0" encoding="utf-8"?*
#env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"*
#env:Header/*
#env:Body*
#method*
#param*value#/param*
#/method*
#/env:Body*
#/env:Envelope*
Note:
# = Left square bracket
* = Right square bracket
Enjoy!
However, you can do this via the command line.
Run the Weblogic "setDomainEnv.cmd" first to set up the environment and then:
java weblogic.webservice.tools.debug.Post "file name"
where "file name" is a file that contains the SOAP request.
Using this you can add / change the request parameters by simply using a text editor.
Much simpler.
An example of the file format is:
POST ...method... HTTP/1.1
Content-Type: text/xml
SOAPAction: ""
User-Agent: Java/1.4.2_06
Host: ...host...
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
#?xml version="1.0" encoding="utf-8"?*
#env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"*
#env:Header/*
#env:Body*
#method*
#param*value#/param*
#/method*
#/env:Body*
#/env:Envelope*
Note:
# = Left square bracket
* = Right square bracket
Enjoy!
WL : Getting a Weblogic SOAP wire trace
If you are using the BEA Weblogic webservices for a Java SOAP client, you can see what is being sent on the wire by adding the following VM command line argument:
-Dweblogic.webservice.verbose=true
e.g. if you are using Eclipse, you can specify this under "Run / Arguments / VM Arguments".
The console will then display something like:
!-------------------- REQUEST ----------------
URL :
Headers :
SOAPAction: [""]
Content-Type: [text/xml]
... SOAP request
!-------------------- END REQUEST ------------
!-------------------- RESPONSE ---------------
URL : Response Code :200
Headers :
Date=Wed, 26 Oct 2005 19:15:40 GMT
Server=Apache
Keep-Alive=timeout=30, max=199
Connection=Keep-Alive
Transfer-Encoding=chunked
Content-Type=text/plain; charset=ISO-8859-1
Envelope :
... SOAP response
!-------------------- END RESPONSE -----------
Enjoy!
-Dweblogic.webservice.verbose=true
e.g. if you are using Eclipse, you can specify this under "Run / Arguments / VM Arguments".
The console will then display something like:
!-------------------- REQUEST ----------------
URL :
Headers :
SOAPAction: [""]
Content-Type: [text/xml]
... SOAP request
!-------------------- END REQUEST ------------
!-------------------- RESPONSE ---------------
URL : Response Code :200
Headers :
Date=Wed, 26 Oct 2005 19:15:40 GMT
Server=Apache
Keep-Alive=timeout=30, max=199
Connection=Keep-Alive
Transfer-Encoding=chunked
Content-Type=text/plain; charset=ISO-8859-1
Envelope :
... SOAP response
!-------------------- END RESPONSE -----------
Enjoy!
Thursday, October 20, 2005
.NET : Web services behind firewall
If you are trying to generate the web service proxy classes by using "Add Web Reference" from Visual Studio 2003 and the URL you are trying to get to is behind a firewall, you are screwed! Big time!
There's no way to do it.
You need to run Visual Studio command line (See earlier post) and then run "wsdl.exe".
Just type "wsdl" and you'll get the options. You'll note that you can specify the firewall address and the user logon / password to get you through the firewall as options. Bingo!
e.g. wsdl http://URL.wsdl /proxy:xx.xx.xx.xx /pu:User /pp:Password
So now you can go ahead and generate the proxy stubs. Add this file to your project and you are away.
But wait - there's more!
When you try and run the program to actually access the web service behind the firewall you will have exactly the same problem - the dreaded "407 Proxy Authentication Required ( The ISA Server requires authorization to fulfill the request. Access to the Web Proxy service is denied. )"
The way around this is to programmatically specify the proxy / logon / password.
Assume that you have the proxy configured in IE under "Tools / Options / Connections / LAN Settings". (Note that this does NOT allow user logon / password to be specified).
(See also :
The proxy settings on this computer are not configured correctly for Web discovery).
You create the webservice from the proxy class in the normal way.
using System.Net;
...
wsName = new WebServiceName ();
// Use default IE setting as above.
wsName.Proxy = System.Net.WebProxy.GetDefaultProxy();
// Set credentials
wsName.Proxy.Credentials = new NetworkCredential("User", "Password");
Enjoy!
There's no way to do it.
You need to run Visual Studio command line (See earlier post) and then run "wsdl.exe".
Just type "wsdl" and you'll get the options. You'll note that you can specify the firewall address and the user logon / password to get you through the firewall as options. Bingo!
e.g. wsdl http://URL.wsdl /proxy:xx.xx.xx.xx /pu:User /pp:Password
So now you can go ahead and generate the proxy stubs. Add this file to your project and you are away.
But wait - there's more!
When you try and run the program to actually access the web service behind the firewall you will have exactly the same problem - the dreaded "407 Proxy Authentication Required ( The ISA Server requires authorization to fulfill the request. Access to the Web Proxy service is denied. )"
The way around this is to programmatically specify the proxy / logon / password.
Assume that you have the proxy configured in IE under "Tools / Options / Connections / LAN Settings". (Note that this does NOT allow user logon / password to be specified).
(See also :
The proxy settings on this computer are not configured correctly for Web discovery).
You create the webservice from the proxy class in the normal way.
using System.Net;
...
wsName = new WebServiceName ();
// Use default IE setting as above.
wsName.Proxy = System.Net.WebProxy.GetDefaultProxy();
// Set credentials
wsName.Proxy.Credentials = new NetworkCredential("User", "Password");
Enjoy!
Friday, October 14, 2005
WL : Logging to a Weblogic log file
There doesn't seem to be any way to programmatically log to the access.log but you can log to the server.log. In the jsp file:
(Note: # is "left square bracket %" and * is "% right square bracket").
#@ page import="weblogic.logging.NonCatalogLogger"*
#
NonCatalogLogger serverLogger;
serverLogger = new NonCatalogLogger ("Name of application");
serverLogger.info ("Some information message");
*
Enjoy!
(Note: # is "left square bracket %" and * is "% right square bracket").
#@ page import="weblogic.logging.NonCatalogLogger"*
#
NonCatalogLogger serverLogger;
serverLogger = new NonCatalogLogger ("Name of application");
serverLogger.info ("Some information message");
*
Enjoy!
Thursday, October 06, 2005
Misc : African recipes, African cooking and African Cookbook
e-book download with heaps of recipes from Africa
African recipes, African cooking and African Cookbooks, The African Recipes Book, Real food from Africa
Try the bobotie, the brandy pudding and the Cape Malay pickled fish.
Yum!
Enjoy!
African recipes, African cooking and African Cookbooks, The African Recipes Book, Real food from Africa
Try the bobotie, the brandy pudding and the Cape Malay pickled fish.
Yum!
Enjoy!
BB : Running simulator without IDE / JDE
Obviously you need the IDE / JDE to develop the application. However, the simulator can be run without starting up the IDE. The IDE requires the Java 2 SDK Standard Edition. The simulator does not.
Assume you want to run the simulator on a laptop which does not have the J2SE platform installed.
First install the BlackBerry Java Development Environment (JDE) from the Blackberry site. Then copy across the program files app.code, app.cso, app.debug and app.jar into the "C:\Program Files\Research In Motion\BlackBerry JDE 4.0.2\simulator" directory on the laptop. (This path assumes that you have installed the 4.0.2 JDE).
Now run the required simulator file from that directory e.g. 7100v.bat.
Enjoy!
Assume you want to run the simulator on a laptop which does not have the J2SE platform installed.
First install the BlackBerry Java Development Environment (JDE) from the Blackberry site. Then copy across the program files app.code, app.cso, app.debug and app.jar into the "C:\Program Files\Research In Motion\BlackBerry JDE 4.0.2\simulator" directory on the laptop. (This path assumes that you have installed the 4.0.2 JDE).
Now run the required simulator file from that directory e.g. 7100v.bat.
Enjoy!
Monday, October 03, 2005
Misc : English Cut
Sometimes you stumble across a blog that is so different and potentially looks so interesting that you just have to stop and read it.
Here's one: English Cut, a really interesting blog about bespoke Savile Row tailoring.
Atom feed
Enjoy!
Here's one: English Cut, a really interesting blog about bespoke Savile Row tailoring.
Atom feed
Enjoy!
Subscribe to:
Posts (Atom)