This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 21 Developer Study Guide: Exam 1Z0-830 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.

Thomas Olausson

Greenhorn
+ Follow
since Feb 08, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Thomas Olausson

I have a SOAP web service project with a WSDL.

Every time I deploy it locally to my test WAS6 server in my RAD6 workbench , it seems that the deployment step invokes wsdl2java.

While this isn't a problem itself, I don't want that to run at deployment time. I've created my SOAP classes before deployment (because other classes use them). I actually put them in a jar as class files too, because I can't change the source of the SOAP classes anyway.

Is there a way to turn this auto wsdl2java behavior off?

I know when you deploy a WAR to a standalone WAS5/6 you have the option of "deploy web services", which to me is a misleading option. If you check that option, wsdl2java runs at deployment time, just like the above behavior in my test workbench.

This process is kinda slow, so that's why I don't need the server to run it every time.

Any tips?

/Tom
19 years ago
I've created java client and stub classes from a WSDL file, using the web service client wizard in WSAD5.

Say I have MyClass, _Helper, _Ser and _Deser
This class has a reference to MyOtherClass, which has its helper and ser/deser.

I want to serialize MyClass to XML and save the xml somewhere.

So I thought I could do something like this:


This works fine, but as soon as I do this
myClass.setMyOtherClass(new MyOtherClass());
after instantiating myClass, I get a nullpointer exception.
Obviously, it doesn't know how to serialize the child object.

So, how can I tell the serializer to do this? The SerizalizationContext seems to have a TypeMappingRegistry where this information can be stored, but creating my own dummy implementation of that interface wasn't easy.

As a client, I do get a ServiceStub that seems to register all these types, but it's all done in private methods.

In my case, I have quite a few object references, so I don't want to manually register the types, since the wizard has done it for me already.

Anyone with any tips here? All I want is to get the XML that a SOAP request would produce.

/Thomas
19 years ago
Hehe,
I love when I post something here and figure out the solution myself.
Solved it this way:

Websphere App Server has a scriptable interface to the Mbean server, via a command line tool called wsadmin.
So, to turn on and off a message listener port, one's gotta do this:

First, login to the mbean server with wsadmin


Stop the message listener port called "MyPort"


Start it:


Add a cron job that takes up and down the port, or script it with Quartz
[ March 22, 2005: Message edited by: Thomas Olausson ]
I want to create a interface to a service with a limited uptime.
In my case, the backend is only open say 9am-5pm.
If a request is received outside of these hours, queue the msg and work on it when the uptime window comes back.

So I thought a asynchronous approach with a JMS queue (point to point) would be good.
client -> work queue -> message bean (MDB)

But how do I solve the time aspect of the service?

I would like to use the JMS framework here, but can't use a message selector, because it only looks at the timestamp of the message, not the current time.

I've thought of three workarounds, but neither flies well, any tips here?

1. Control the message listener port to be up only 9-5.
We're using Webspher App Server, so I could script something that would turn off and on the listener port, via cron.

2. Use two queues: the client puts the message on a "stage queue", and a special message bean decides if the message was received during uptime,
if so, put it on the work queue where the regular message bean runs.
if not, don't acknowledge the message and keep retrying until the time window comes back.

3. The message bean itself knows what the uptime is and sleeps for 5 minutes before trying again. It keeps doing so until the uptime window is back.
If I have 10 MDB in the pool and 10 messages, 10 threads will just sit there in this wait loop.

/Thomas
[ March 21, 2005: Message edited by: Thomas Olausson ]
I'm talking about the existing wizards.
The wizard clearly runs wsdl2java but also something else that creates the jax-rpc and the deployment descriptor 'webservices.xml'

The two latter files I want to script in ant as well.
19 years ago
I'm trying to script the generation of WSDL files in Websphere studio 5.1.
With a wizard, you can select a wsdl and create skeleton classes.

I know I can do most of that with the Ant task WSDL2java,
but the wizard is also creating the jax-rpc-mapping for each port, how do I create that?
This file is referenced in the WEB-INF/webservices.xml

I could create the mapping it with a xdoclet, but that assumes I created the java classes myself. Since I'm starting with the WSDL to generate classes, I don't have the meta information.

Regards,
/Tom
19 years ago
Is there a easy way to force the web container servlet to call destroy() ?
With struts development, it's necessary to reload the ActionServlet.

I can do Server->Restart project->MyEAR, but it's a pretty lengthy process.

/Tom
19 years ago
Is there any chance you can migrate this data to LDAP?
If you put users/roles in a LDAP server, such as OpenLDAP, active directory, secureway, you can use the LDAP "User registry" in Websphere App Server.

With web apps you control login with security entries in web.xml.
According to the j2ee spec:
http://java.sun.com/webservices/docs/1.3/tutorial/doc/Security4.html

In a servlet, you can do


In JSPs you can do similar, or use appropriate JSTL/struts tags.

There's a WAS overview here
http://publib.boulder.ibm.com/infocenter/wasinfo/index.jsp?topic=/com.ibm.wasee.doc/info/ee/ae/welc_security.html

If you can't migrate to LDAP, you can write a Custom User Registry.
http://publib.boulder.ibm.com/infocenter/wasinfo/index.jsp?topic=/com.ibm.wasee.doc/info/ee/ae/tsec_tbucs.html
That page has a sample with a file based user reg, but it shows you what interface you need to implement.

In your webpages and servlets, you would still be able to do isUserInRole()..., because this interface goes through the JAAS layer. It's transparent to the programmer.
If you later migrate to LDAP, you don't need to change apps, but rather how users/roles are stored.

A lot of developers (including me!) wrote their own "JAAS layers".
It's meaningless to run an app server and write these layers yourself.

Hope that helps,

Regards,
/Tom
19 years ago
Is the LTPA specifcation proprietary to IBM?

In other words, can I read/decipher/create my own LTPA tokens.
If yes, I could create a ServletFilter for tomcat apps or similar filters for IIS apps.

/Tom
19 years ago
The IBM documentation is a little vague on what config options you have with the apache module.

In the examples I've seen, apache and was runs on the same server.
Isn't that a non-typical? A web server normally sits in a DMZ, and the WAS server on another network.

To take advantage of fail over and load balancing, those two services won't run on the same server.

Does the was apache module need anything else from the WAS install directory?
Since I have to separate machines, the httpd server doesn't have access to
any files in /opt/WebsSphere/,
I basically copied the mod_was_ap20_http.so to the httpd's modules directory.

/Tom
20 years ago
I have this setup (both Linux, suse 9)
web server: Apache 2.0.46 + was_ap20_module
app server: WAS 5.1

The web server "proxies" /myapp to WAS. This worked fine until
yesterday. Now, the apache log says

child pid 8080 exit signal Segmentation fault (11)

everytime I hit /myapp.

I've turned the LogLevel up to Trace

Log LogLevel="Trace"


in the plugin-cfg.xml file, and it does say that

TRACE: mod_was_ap20_http: as_map: WebSphere will handle: /myapp

but that's about it. The request is never handled by WAS,
so the plugin must die on its way.

Has anyone gotten this before? The WAS server is running and I can
hit the /myapp url straight on WAS.

My only fallback it to use Apache's own reverse proxy module or remove the web server completely from the picture.

/Tom
[ October 20, 2004: Message edited by: Tom Bombadyll ]
20 years ago
I don't know how many times I've started writing something
in the forums and as I'm writing I realize why I'm having the problem:

Our virus scanner was the problem. Turn it off and the icons are good.

Tip for mankind: stay away from McAfee, which is the virus itself.

Regards,
Tom
20 years ago
Running Websphere Studio App Developer 5.1.2 on Win2K.

This morning when I started WSAD, all the icons are just black boxes.
I mean every icon in the toolbar section/perspective list is just a little black box!
It's kind of hard to navigate in WSAD now.

I read somewhere that the icon cache in Windows, \winnt\ShellIconCache can get corrupt. Removed that file and restarted, same problem.

Reinstalled WSAD, same problem.

There must be some Windows setting that has changed.
Anyone encountered this?

My colleague, running the same setup, has the exact same problem.
Only option now is to reinstall Win2K.

Regards,
/Tom
20 years ago
I can't find any documentation covering this scenario:

I'm using Apache2 and the WAS plugin.
WAS runs on a separate server than apache.

The WAS server has SSL configured, on port 9443.
This is so you don't need root to start Websphere.

Apache listens on 443.

With the generated plugin-cfg.xml, this scenario won't work:

# Client (HTTPS 443) Apache (HTTPS 9443) WebSphere App server



I get a The host <> on port 443 has not been defined when I hit the web server. If I reconfigure apache to listen on 9443, it works fine.

I could change WAS to listen on 443, but don't like that setup.
Is there a way to change plugin-cfg to understand this "port shift"?

I don't really need https between apache and WAS, it would be better
in terms of perfomance if that traffic is over http.
I can't see a way of getting that to work either.

Regards,
/Tom
[ July 07, 2004: Message edited by: Tom Bombadyll ]
20 years ago
I can live with that. But how can I easily make my code transparent to the environment?
We have dev, qa, prod environments and normally apps don't need to worry about the environment (and doesn't even know), because WAS is already config'd for it.

Is there a formal way of getting rid of doing
if(TEST)
connect to ldap-test
else if(QA)
connect to ldap-qa
else if(PROD)
connect to ldap-prod
?

I can move this to properties, but still need code that knows the environment, and the properties couldn't be managed through the WAS console.

Can this be done with a resource environment provider? Haven't found any documentation on what that is though, I'm just suspecting.

Regards,
/Thomas
20 years ago