aparna chi

Greenhorn
+ Follow
since May 19, 2004
Merit badge: grant badges
For More
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 aparna chi

Hi,

I am trying to access a webmethods webservice through a static client in java. I am using weblogic 8.1 ant task clientgen to generate the static client jar.

I am able to access if the webservice is deployed on weblogic. But unable to invoke it when it is running on webMethods.

Can anybody tell me a reason for this and suggest way around for this?

Thanks in advance.
19 years ago
We have some string constants like key1 = "value" in our system. These constants are used in multiple places throughout system using the key e.g. key1 here.

There are two ways of accessing these
1) I make a properties file constants.properties in which i put the values as key1 = value. And then access them through resource bundle.

2) I make a java class like:
public class ConstantsClass
{
public static final String key1 = "value";
}
and now access them as ConstantsClass.key1 wherever i need them.

So I want to know the which is best solution 1 or 2. I am saying that 1 is better and some are saying 2 is better. Their argument is that it will be resource intensive to have a properties file. I am saying that since it is web application which will utimately deployed as an ear , if we use a constants class we will have to rebuild and redeploy the whole application even for some small change.

I basically want to know the concrete differences between two apporaches and their effect on application. And which one to use in which case. Basically what's the better way and why in such situation.

Thanks for the replies.
19 years ago
Consider the scenario that you have some strings in your application. Whose value may change some time in future.

What would be the best possible solution for this?
Using properties file and loading them through resource bundle
or
Using a java class which contains public static final strings for the changing values.

Which one is better and why?

Thanks
19 years ago
Consider the scenario that you have some strings in your application. Whose value may change some time in future.

What would be the best possible solution for this?
Using properties file and loading them through resource bundle
or
Using a java class which contains public static final strings for the changing values.

Which one is better and why?

Thanks
19 years ago
Hi ,

I have two applications deployed on weblogic 8.1. Both have separate set of webservices . When I try to invoke these web services through a simple java application client it is possible to invoke the service normally. But when i try to invoke the webservice in one application through a dynamic client in other webservice it fails giving following error:

javax.xml.rpc.JAXRPCException: failed to invoke operation 'execute' due to an error in the soap layer (SAAJ); nested exception is: Message[ failed to serialize xml:weblogic.xml.schema.binding.SerializationException: mapping lookup failure. class=interface javax.xml.soap.SOAPElement class context=TypedClassContext{schemaType=['http://example/xsd']:inputDTO}]StackTrace[

javax.xml.soap.SOAPException: failed to serialize xml:weblogic.xml.schema.binding.SerializationException: mapping lookup failure. class=interface javax.xml.soap.SOAPElement class context=TypedClassContext{schemaType=['http://example/xsd']:inputDTO}
at weblogic.webservice.core.DefaultPart.toXML(DefaultPart.java:292)
at weblogic.webservice.core.DefaultMessage.toXML(DefaultMessage.java:610)
at weblogic.webservice.core.ClientDispatcher.send(ClientDispatcher.java:193)
at weblogic.webservice.core.ClientDispatcher.dispatch(ClientDispatcher.java:130)
at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.java:439)
at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.java:425)
at weblogic.webservice.core.rpc.CallImpl.invoke(CallImpl.java:536)
at weblogic.webservice.core.rpc.CallImpl.invoke(CallImpl.java:389)
at myclient.WebserviceClient.executeWeb(WebserviceClient.java:190)
at java.lang.Thread.run(Thread.java:536)
Caused by: weblogic.xml.schema.binding.SerializationException: mapping lookup failure. class=interface javax.xml.soap.SOAPElement class context=TypedClassContext{schemaType=['http://example/xsd']:inputDTO}
at weblogic.xml.schema.binding.RuntimeUtils.lookup_serializer(RuntimeUtils.java:151)
at weblogic.xml.schema.binding.RuntimeUtils.invoke_serializer(RuntimeUtils.java:187)
at weblogic.xml.schema.binding.RuntimeUtils.invoke_serializer(RuntimeUtils.java:174)
at weblogic.webservice.core.DefaultPart.toXML(DefaultPart.java:284)
... 12 more
]

at weblogic.webservice.core.rpc.CallImpl.invoke(CallImpl.java:545)
at weblogic.webservice.core.rpc.CallImpl.invoke(CallImpl.java:389)
at myclient.WebserviceClient.executeWeb(WebserviceClient.java:190)
at java.lang.Thread.run(Thread.java:536)


Can anybody please tell me the cause and workaround for this problem ?

I have registered all the data types with respective names explicitly. Even then it is not working.

Please help me on this.

Thanks and Regards
Aparna
19 years ago
I am actually new webservices. Can you tell me how to configure the webservice to recognize the types?
19 years ago
Hello,

I have created a webservice. But when i am trying to invoke the webservice through a custom class for getting the service i am getting error that

Unable to find request type mapping for that custom class. But the class is placed in the jar file and class path the program compiles fine but while running it gives this error.

Can anybody please tell me the cause and solution for this error?

Thanks
Aparna
19 years ago
Hi,

I have already tried this and this works but with pstmt.setString it does not work. And the problem is that i can not hardcode the string value as it may contain space or some value depending on what the calling client sets.

So i want to know why it does not work with setString? And is there any workaround this.

Thanks
Aparna
Hi,

This is the code i am running. The method getJDBCConnection returns a connection object.

Connection con = DataBaseUtil.getJDBCConnection();
String sqlQ = "SELECT item_code FROM item WHERE description = ?";
PreparedStatement pstmt = con.prepareStatement(sqlQ) ;
pstmt.setObject(1," ");
ResultSet rs = pstmt.executeQuery();
int count = 0;
while(rs.next())
{
System.out.println("in while loop "+rs.getString(1));
++count;
}

And there are records which match the criteria if I execute the query as

SELECT item_code FROM item WHERE description = ' '

in TOAD it works and gives me desired result.

But with the prepared statement code it does not work.

Thanks
Thanks for reply. But i don't want to set null value. I want to set exactly one space. Actually i tried with that to but it did not work.
The difference here is i don't want to set null but a space.

Thanks and regards
Aparna
Hi,

I have query like

select * from abc where xyz=' '

When i execute this query using a tool like TOAD it works fine and returns results that it is supposed to return.

But when i try the same thing with jdbc

PrepareStatment pstmt= con.prepareStatement("select * from abc where xyz = ?");
pstmt.setString(1," ");

ResultSet rs = pstmt.executeQuery();

The query does not return any results. Why this happens? Is there any way to set the " " in PreparedStatement?

Thanks
Hi,
Thanks.
I just want to know can i declare a property in action form as:

int a

and have getter & setters like

public void setA(int a)
{
this.a = a;
}

public int getA()
{return this.a}

What will happen if i write this code in ActionForm?
19 years ago
Hi,

I have one question about the struts action form properties:

What type of properties can be used in action forms? Should we use only String and boolean properties or we can use any type of properties? Is it necessary to have some kind of converter if other types of properties are used?
19 years ago
The Struts in Action book in in action forms chapter mentions that Action Forms should use only String and boolean properties. Does this mean that we can not or should not user properties of other types? What will be the happen if properties of other types are used?
19 years ago
Thanks.
Here is the code for my factory:

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import javax.ejb.EJBHome;
import javax.ejb.EJBLocalHome;

import javax.naming.InitialContext;
import javax.naming.NamingException;

import javax.rmi.PortableRemoteObject;
public class EJBHomeFactory
{
private Map ejbHomes;
private static EJBHomeFactory aFactorySingleton;
InitialContext ctx;
/**
* EJB home factory private constructor
*/
private EJBHomeFactory() throws NamingException
{
ctx = new InitialContext();
this.ejbHomes = Collections.synchronizedMap(new HashMap());
}
/*
* Returns the singleton instance of EJBHomeFactory
*/
public static EJBHomeFactory getFactory()
{
try
{
if(EJBHomeFactory.aFactorySingleton == null)
{
EJBHomeFactory.aFactorySingleton = new EJBHomeFactory();
}
}catch(Exception e)
{
System.out.println("exception in static ejb home factory "+e);
}
return EJBHomeFactory.aFactorySingleton;
}
/**
* Look up and cache an EJBHome object using a home class.
*/
public EJBHome lookUpHome(Class homeClass)
{
EJBHome anEJBHome;
anEJBHome = (EJBHome)this.ejbHomes.get(homeClass);
try
{
if(anEJBHome == null)
{
anEJBHome = (EJBHome)PortableRemoteObject.narrow(ctx.lookup(homeClass.getName()), homeClass);
this.ejbHomes.put(homeClass, anEJBHome);
}
}catch(Exception e)
{
System.out.println("exception in look up home "+e);
}
return anEJBHome;
}
}
I am not sure whether the object of this class will get garbage collected if no other class in the system is referring to it.
Can you help me out with this?