Pawan Pangty

Greenhorn
+ Follow
since Aug 03, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Pawan Pangty

Hi all,

I have created some web service stubs from the WSDL for the usage in the Java Desktop application.
The desktop java application utilise the web service stubs to download the data from the DB to the local machine.

Now, I want a kind of mechanism, which allows the java desktop application to get hosted or initiated using some activex control in IIS.
And download the data to the client, which hits the IIS server.
[My requirement is to initiate a java desktop application through an activex control on IIS]

My approach :

I tried manipulating the java application code , so that it can be accessed using an applet in an html.
The intention is to provide the download path of the client machine and let the applet download the data to the client machine.
The activex control does call the required html file, which further initiates the applet.

I did manage to sign the jars required etc to resolve the initial hiccups....
But, now I am getting an Access exception from the Websphere server, saying that the Access exception reading the server property.
Is there any way to resolve this or some better method to achive my goal.

Thanks in advance.
Pawan
15 years ago
Hope you find the following helpful.
In the WSAD 5.1, create a simple Web project and add the following java code in javasource folder.

com.source;
public Class HelloWorld {

public String getMessage(){

return "Hello World";
}
}
I am assuming that the Server is configured and the created Web Project is added to it.

Once, this is done..do the following :

1. Right click the HelloWorld.java and opt for option => Web Services => Generate WSDL Files
2. A box opens :Select the Web project (Current Project) where you want the WSDL to be generated. Click Next
3. Select the HelloWorld class as the java bean . Click next
4. Make sure the getMessage() method is selected in the Methods option
5. Style and Use ocument/Literal
6. Click finish.

The above will create :
1. An HelloWorld_SEI.java (Service End Interface = SEI) for the class HelloWorld.java in the same package as HelloWorld
This interface contains the methods exposed as Webservices.
2. A WSDL in the WebContent for the HelloWorld class in the WebContent which represents the above SEI.

Create the Client stubs for the HelloWorld Webservice. :
7. Navigate to WebContent/ wsdl/HelloWorld.wsdl file.
8. Right Click and navigate to => Web Services => Generate Client
9. Another box will open :
10. Keep the following values : Client proxy type : Java proxy; Check "Overwrite files without warning" and "Create folders when necessary" options......Click next
11. Select your Server and Web service runtime as IBMWebSphere 5.0.2 .
12. Select a different Client Web Project or create a new one . Click Next
13. Click Finish.

Run the Server.
Write an java class using the created stubs to access the Webservice method "getMessage()".

Hope this works for you.

Regards,
Pawan
15 years ago
Hi all,

I managed to resolve the entity bean JNDI lookup exception.
Now, I am able to expose the Session Beans as the Webservices directly.

Actually, I had not provided Entity Bean reference in the web.xml file present in the Web layer.I missed this part and it was required.

Making the Webservices calls directly relates to the Session Bean methods.
So, session bean JNDI was lookup not required.

This Entity Bean call made in the Session Bean method was indirectly routed by the Webservice Interface present in the Web layer.

So, I provided the reference of the Entity Bean in the web.xml file of the Web Layer.This worked.

Hope this workaround sounds reasonable.

Thanks for the helpful links and comments.

Regards,
Pawan
15 years ago
Hey Rajneesh,

Thanks for the very descriptive reply.
Actually, my intention is to expose the Sesison Beans as Web Services for cross application integration.

Presently, my working model includes a work around for the above exception.
I have created additional service classes in my web layer to call the Session Bean methods.
These classes are exposed as the Web Services for the MS and java clients.

So, in a nutshell, I have a web router, which exposes the Web Services for the service classes.
These service classes in turn call the Session Bean methods using the remote interface and service locator.

I have used the WebSphere Studio Application Developer 5.1.0, which supports j2ee 1.3 and EJB 2.0.

From an article, I have read, it says that EJB 2.1 supports Web Services.
If, it is so, the what about EJB 2.0?

My work around through the web router does work fine.
But, I want do implement the same by directly exposing the Session Beans of the Business layer as Web Services for cross platform integration.

Any tips / solutions for the same?

Thanks in advance.
Pawan
15 years ago
Hi all,

I need to create a WEB SERVICE for my session bean .
The session bean in turn calls an Entity bean.Service Locator is used for the lookup etc.
Actually, I want to expose all my stateless session beans in the Business layer as Web Services.

For the time being, I have gone with the following approach, which results in exception.
I generated a WSDL for the Session Bean using a customized SEI for the required methods
in the Session Bean.
The WSDL and the necessary classes were created in my Web Layer.
Then, I created the proxy classes from the WSDL for the stub implementation.

Everything is right till here..
I access the stub to access the Session Bean methods.
In the Session Bean method, I look for Entity Bean JNDI name.
The code blasts here, saying that it could not find the Entity Bean with that JNDI name.
However, my Entity Bean works fine when tested individually in IBM WSAD server.
It fails, when I call it from the Session Bean.

I have observed one thing over here.
I dont lookup for the Session Bean JNDI name while calling the Session Bean from my stubs.
Is this the problem, then can someone please guide me on this.

Thanks in advance.
Regards,
Pawan
15 years ago
The removal of the log statement will not effect the functionality in any case

The only difference will be of the logging of the statements and somewhat of speed.

The Log4j has the different logging levels. like debug, info, fatal, error
During the development process, a dev might keep the Logging level as debug as a precautionary measure
to debug the program.
For this, the logging level can be set to DEBUG.
The logger will chk for the DEBUG enabled part and process the if statement accordingly.

However, when the code is deployed , the end user may not be interested in the full debug statements.
The level then might be set to INFO or fatal in that case.
For those scenarios, the above mentioned debug statement will be skipped.

So, this can be pretty much useful for the debug purpose without changing much in the code.
The logger level set in the log4j properties file will decide the process.

Hope, something useful conveyed for the above.

Regards,
Pawan
Hi all,

I want to send attachment using web services in wsad 5.1.0.
The following is the class for which the wsdl and SEI is generated .

public class AttachmentService {

public DataHandler downloadAttachment(String p_filepath){
FileDataSource source = new FileDataSource(p_filepath);
DataHandler handler = new DataHandler(source);
return handler;
}
}

SEI :

public interface AttachmentService_SEI extends java.rmi.Remote
{
public javax.activation.DataHandler downloadAttachment(java.lang.String p_filepath);
}

I created the client for the above which resulted in the following stub creation :
AttachmentService.java
AttachmentServiceService.java
AttachmentServiceServiceLocator.java
AttachmentServiceSoapBindingStub.java

The AttachmentService.java class exposes the following methods :

public interface AttachmentService extends java.rmi.Remote {
public java.lang.byte[] downloadAttachment(java.lang.String p_Filepath) throws java.rmi.RemoteException;
}

Here, the DataHandler gets converted to byte [] .
I want to maintain the DataHandler return type as its is in the AttachmentService_SEI.java as well as the above stub creation.

Does any one has come across anything of this type?
Do i have to make additional changes for the serializer/Deserialzer portion.
Waiting for your responses.

Thanks in advance.
Pawan
15 years ago
I created a wsdl for a class returning an Array object of a use defined complex type( Eg. UserData[] ) for a method say getWorkspaces().

The SEI for the above is :

public interface TestOne_SEI extends java.rmi.Remote
{
public com.proto.data.UserData[] getWorkspaces();
}

The UserData class is as follows :
public class UserData implements Serializable {
private String name;
/**
* @return
*/
public String getName() {
return name;
}
/**
* @param string
*/
public void setName(String string) {
name = string;
}

}
The generation of the client was done using IBM Websphere 5.0.2 (Web Service Runtime ) in WSAD 5.1.0.
However, the testing of the client resulted in an error :

faultCode: {http://websphere.ibm.com/webservices/}Server.generalException
faultString: java.lang.IllegalAccessException: WSWS3214E: Error: Null setter method specified.
faultActor: null
faultDetail:
stackTrace: java.lang.IllegalAccessException: WSWS3214E: Error: Null setter method specified.
at com.ibm.ws.webservices.engine.utils.BeanPropertyDescriptor.set(BeanPropertyDescriptor.java:186)
at com.ibm.ws.webservices.engine.encoding.ser.BeanDeserializer.setIt(BeanDeserializer.java:524)
at com.ibm.ws.webservices.engine.encoding.ser.BeanDeserializer.onSimpleChild(BeanDeserializer.java:435)
at com.ibm.ws.webservices.engine.events.P2DConverter.flush(P2DConverter.java:724)
at com.ibm.ws.webservices.engine.events.P2DConverter.endElement(P2DConverter.java:391)
at sax.SAX2DocumentEntityParserBase.endElementAction(Unknown Source)
at util.DocumentEntityParserBase.endElementEvent(Unknown Source)
at com.ibm.xml.b2b.scan.latin.LatinWFCDocumentScanner.scanEndElement(Unknown Source)
at com.ibm.xml.b2b.scan.latin.LatinWFCDocumentScanner.scanContent(Unknown Source)
at com.ibm.xml.b2b.scan.latin.LatinWFCDocumentScanner.scanDocument(Unknown Source)
at sax.latin.LatinWFCSAX2DocumentEntityParser.scanDocument(Unknown Source)
at util.DocumentEntityParserBase.parse(Unknown Source)
at sax.SAX2DocumentEntityParserBase.parseEntity(Unknown Source)
at sax.SAX2DocumentEntityParserBase.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)

I am using the default serialization/deserialization.
Am I missing something ??

Thx in advance ...
Pawan
15 years ago