Masrudyn Main

Greenhorn
+ Follow
since May 13, 2009
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 Masrudyn Main

My web service needs to read configurable parameters from a configuration file. This is done by a properties file which is called by loadProperties. This is done for every web service call.

Is there a better way to do this - for example to load the config at start up and is cached so that every web service call do not need to read from the properties file?

How can I do this? Is there a better way/technique? Thanks.
10 years ago
I'm creating a bottom-up web service from a java class using Axis2

In the java class, I am using java.util.Date

When the WSDL is generated by Axis, the element has type="xs:date". How do I generate the element to have a type of type="xs:dateTime" instead?

11 years ago
BTW, it seems to me that Axis2 is processing the parameters by position rather than by name. This is the first time I am using Axis2 for writing webservices. Is that how Axis2 behaves?
11 years ago
The SOAP request sends only the NRIC element and value but when it gets to Axis2, it interprets it as the CIF element value. I found out by printing all the parameters that has been passed to my web service class.

I've already set the minOccurs= 0 in my WSDL (see my first post). Actually the WSDL was generated by Axis2. I'm writing a bottom-up webservice

11 years ago
Hi,

Thanks for your reply - I was expecting Axis to figure out which parameter the request has by looking at the element name. In the example request:
<int:getPartyId>
<int:NRIC>S7654321F</int:NRIC>
</int:getPartyId>

I was passing element NRIC - so shouldn't Axis assign that to the second parameter (NRIC), instead? Or this is not how it works?

The problem here is that my Webservice is being accessed by another middleware and it will not pass any elements if they are null.

If the above is the right behaviour, does that mean I have to change my code to use name value pairs instead?
11 years ago
Hi I'm using Axis2 for my webservices. My service has 5 parameters:
- <xs:sequence>
<xs:element minOccurs="0" name="CIF" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="NRIC" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="PP" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="CountryOfPPIssue" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="FIN" nillable="true" type="xs:string" />
</xs:sequence>

When the request does not passed in all the elements, Axis2 will reorder the parameter, thus screwing up my code. Eg. when the first parameter CIF is not passed in, now the second parameter NRIC becomes the first parameter CIF:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:int="http://interact.unica.ocbc.com">
<soapenv:Header/>
<soapenv:Body>
<int:getPartyId>
<int:NRIC>S7654321F</int:NRIC>
</int:getPartyId>
</soapenv:Body>
</soapenv:Envelope>

Is there something wrong in my config? Please help. Thanks.

11 years ago
Hi,

I want to build a simple GUI to handle CSV files. I believe JTable can do the job but I would like to try using JavaFX... so is there a similar JTable in JavaFX? Any sample codes to get me started? Thanks!
12 years ago
Ok, I'm much clearer now. Thanks so much everyone!
12 years ago
Thanks guys for all your replies.. actually for both instances I did do a cast:

final Offer[] daoOffers = (Offer[])daoManager.executeAndClose(new DAOCommand() {

final List<Offer> daoOffers = (List<Offer>)daoManager.executeAndClose(new DAOCommand()

But somehow the compiler does not like it when I am cast List<Offer>. There's no problem when I cast Offer[].

I'm using JDK 1.6. My workaround is for my "executeAndClose" method to return Offer[] and then convert the Offer[] to List<Offer> but I would like to know why. It seems that when I am returning a List, the compiler does not like it?
12 years ago
Can someone help?

When I changed my code from using arrays

final Offer[] daoOffers = (Offer[])daoManager.executeAndClose(new DAOCommand() {
public Object execute (DAOManager manager) {
return manager.getOfferDao().findOffersByCampaign(daoCampaign);
}
});


to

final List<Offer> daoOffers = (List<Offer>)daoManager.executeAndClose(new DAOCommand() {
public Object execute (DAOManager manager) {
return manager.getOfferDao().findOffersByCampaign(daoCampaign);
}
});


I get the following warning message :
Type safety: Unchecked cast from Object to List<Offer>

Is there something wrong with my code? It's just a warning message but I would like to understand why..
12 years ago
hi,

thanks for your reply. I was using the connection pool in glassfish. Anyway, after much troubleshooting, I found out that the problem was due to glassfish 2.1 not supporting jdk6 on AIX. Here's the thread which I posted on glassfish forum:
http://forums.java.net/jive/thread.jspa?messageID=350608񕦐
The stored proc only does 1 thing: write a timestamp to a database table.

I can see the record being inserted but my webservice does not execute the next line after calling the stored procedure method.

What could be wrong?
I have a webservice running on glassfish that is calling an oracle stored procedure. Clients make about 30-50 request per second on that webservice.

The problem is that only 2-3 calls can be made to the webservice before glassfish hangs (can't even login to the console). When I do not make the stored procedure call, everything runs fine.

Is there something wrong with my code:

public void callStoredProcedure(String param)
{
Connection cnx = null;
try
{
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("jdbc/mandplbs");
cnx = ds.getConnection();
}
catch(NamingException ex)
{
ex.printStackTrace();
}
catch(SQLException ex)
{
ex.printStackTrace();
}

if(cnx != null)
try
{
String sql = "{call mandplbs_test_proc(?)}";
CallableStatement stmt = cnx.prepareCall(sql);
stmt.setString(1, param);
boolean results = stmt.execute();
do
{
if(results)
{
ResultSet rs = stmt.getResultSet();
rs.close();
}
System.out.println();
results = stmt.getMoreResults();
} while(results);
stmt.close();
}
catch(SQLException ex)
{
ex.printStackTrace();
logger.debug("Uncaught exception", ex);
}
}
i solved the problem - I didn't specify the correct endpoint URL in my WSDL.. so when the client was trying to consume my webservice, the app server was throwing the default HTML page.. thanks for reading this post
12 years ago
is that the cause of the problem? The XML string was constructed by the code stubs by JAXWS wsgen
12 years ago