David Yu

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

Recent posts by David Yu

Hi Peer,

Thanks for the reply. However I need a bit more clarification. So if I send a SOAP request with xmlns:soap="http://www.w3.org/2003/05/soap-envelope" and receive a response with xmlns:soap="http://www.w3.org/2003/05/soap-envelope", that means I have a SOAP 1.2 reply?

The part that confuses me most is that according to the web service specification, if I send a soap 1.2 request like the one below:

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<GetJpegQuery xmlns="http://skyserver.sdss.org/">
<ra_>double</ra_>
<dec_>double</dec_>
<scale_>double</scale_>
<width_>int</width_>
<height_>int</height_>
<opt_>string</opt_>
<query_>string</query_>
</GetJpegQuery>
</soap12:Body>
</soap12:Envelope>

I should get a SOAP response similar to

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<JpegQueryResponse xmlns="http://skyserver.sdss.org/">
<ra_>123.45</ra_>
</GetJpegQueryResponse>
</soap12:Body>
</soap12:Envelope>

However, my response message is <soap xxx> instead of <soap12 xxx> although I do have the same namespace.
17 years ago
Hi everyone,

I am trying to set up a web service that sends out SOAP 1.2 requests and processes SOAP 1.2 responses. To minimize the complexity of the application, I decided to use Java SAAJ v1.3 from the JWSDP v2.0 developer kit. Using SAAJ, I can send out and receive SOAP messages without Apache Tomcat or Apache Axis.

SAAJ 1.3 is supposed to support both SOAP 1.1 and 1.2 messages. Instead of constructing the SOAP request message by using the various "add" functions. I constructed the SOAP message beforehand and pass it as an argument to the SoapPart.

StreamSource prepSoapMsg = new StreamSource(new FileInputStream("nameOfSOAPRequest.msg"));
soapPart.setContent(prepSoapMsg);

After sending the SOAP message, I am getting a SOAP response. However, how can I tell if it is a SOAP 1.2 response?

It looks like a SOAP 1.1 response, b/c my request has tag names of

<soap12:Envelope

but response has tag names of

<soap:Envelope

Please advise. If I cannot construct SOAP 1.2 messages using SAAJ, what is the simplest alternative?
17 years ago
Finally figured out what the problem was. Hooray!

It turns out that the default compiler of Eclipse is set to "5.0". After setting that to "1.4", code is able to work properly with J2SE 1.4.
Hi everyone,

I am a beginner in JDBC and in the process of setting up a simple test program. I successfully installed MySQL, j2sdk1.4.2_13 that comes with JDBC as well as JConnector.

When I attempt to run the following program in Eclipse as a "Java Application", a window appeared asking me to select the Java application. The default matching type "Activation - sun.rmi.server". I went with the default and received the following error message. I am sort of confused on what to do. Any assistance will be greatly appreciated.

Activation.main: warning: sun.rmi.activation.execPolicy system
property unspecified and no ExecPermissions/ExecOptionPermissions
granted; subsequent activation attempts may fail due to unsuccessful
ExecPermission/ExecOptionPermission permission checks. For
documentation on how to configure rmid security, refer to:

http://java.sun.com/j2se/1.4/docs/tooldocs/solaris/rmid.html
http://java.sun.com/j2se/1.4/docs/tooldocs/win32/rmid.html

Activation.main: an exception occurred: Port already in use: 1098; nested exception is:
java.net.BindException: Address already in use: JVM_Bind
java.rmi.server.ExportException: Port already in use: 1098; nested exception is:
java.net.BindException: Address already in use: JVM_Bind
at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:243)
at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:178)
at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:382)
at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:116)
at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:145)
at sun.rmi.registry.RegistryImpl.setup(RegistryImpl.java:92)
at sun.rmi.registry.RegistryImpl.<init>(RegistryImpl.java:78)
at java.rmi.registry.LocateRegistry.createRegistry(LocateRegistry.java:164)
at sun.rmi.server.Activation.main(Activation.java:2049)
Caused by: java.net.BindException: Address already in use: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:331)
at java.net.ServerSocket.bind(ServerSocket.java:318)
at java.net.ServerSocket.<init>(ServerSocket.java:185)
at java.net.ServerSocket.<init>(ServerSocket.java:97)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createServerSocket(RMIDirectSocketFactory.java:27)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createServerSocket(RMIMasterSocketFactory.java:333)
at sun.rmi.transport.tcp.TCPEndpoint.newServerSocket(TCPEndpoint.java:615)
at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:231)
... 8 more

Test Program:

import java.sql.*;

public class JDBCtest {
public static void main(String args[]){
System.out.println(
"Copyright 2004, R.G.Baldwin");
try {
Statement stmt;

//Register the JDBC driver for MySQL.
Class.forName("com.mysql.jdbc.Driver");

//Define URL of database server for
// database named mysql on the localhost
// with the default port number 3306.
String url =
"jdbc:mysql://localhost:3306/mysql";

//Get a connection to the database for a
// user named root with a blank password.
// This user is the default administrator
// having full privileges to do anything.
Connection con =
DriverManager.getConnection(
url,"root", "password");

//Display URL and connection information
System.out.println("URL: " + url);
System.out.println("Connection: " + con);

//Get a Statement object
stmt = con.createStatement();

//Create the new database
stmt.executeUpdate(
"CREATE DATABASE JunkDB");
//Register a new user named auser on the
// database named JunkDB with a password
// drowssap enabling several different
// privileges.
stmt.executeUpdate(
"GRANT SELECT,INSERT,UPDATE,DELETE," +
"CREATE,DROP " +
"ON JunkDB.* TO 'auser'@'localhost' " +
"IDENTIFIED BY 'drowssap';");
con.close();
}catch( Exception e ) {
e.printStackTrace();
}//end catch
}//end main
}//end class JDBCtest.java
Let me add to the topic so that it's more specific. Assuming that I want to use RMI or use JDBC, how do I know which technology or package to use?
17 years ago
Hi everyone,

One of the biggest confusion I have with Java is that Java has so many different technologies and so many different packages. There are JRE, JDK, JEE and it appears that they each support different libraries and classes.

Does anyone know any online resource that provides a clarification and summary of each?

That will be extremely helpful. Thanks!
17 years ago
Actually I have a question on how to obtain the certificate afterwards. I received the Sun Examination Score report following the exam. Will the certificate be mailed to me, or do I have to register somehow?
17 years ago
Yay, free at last, words cannot expressed how happy I am at the moment.

I had been preparing for the exam since September. This week, I actually took a week off from work to give myself plenty of time to do and understand the mock exams available.

Practice Final Exam from the book are a bit more difficult than the actual exam. I scored around mid and high 60s on those two. I was actually surprised by the number of questions on Date, Locale, Dateformat. I think I came across at least 3 and it requires knowledge on the methods available to those classes. Not knowing too many methods available to the Locale class, I guessed the answers.

Anyway, many thanks to the members on this forum for their generious support and assistance. I think I deserve a break from Java before enrolling a Java course.
17 years ago
yeah it is unreasonable I do admit. On the bright side, after trying again with a different email account, I was finally able to log in and downloaded the bonus exam.

thanks for the help I received. Sorry if I caused any unnecessary trouble,
Hi Javier,

Yeah that is what I am referring to. I cannot register. Even though it claims that it had sent me the password for access, I never received anything from them. If it's not too much trouble, may I "borrow" your account? I just want to have as much practice as possible before the actual exam.
Hi,

If it's not too much to ask for and if someone doesn't mind, may I have someone's registered username and password to login to LearnKey. The obstacle preventing me from acquiring the bonus exam is the registration process. I figure if someone already has a registered account, I can just log in and download the exam.

Many thanks!
Check out the link below, although I haven't tried it myself:

http://faq.javaranch.com/view?ScjpFaq#mocks
Hi,

As I mentioned in the previous posts, my exam is near. I noticed there are a number of Math, shift operations in a number of mock exams. I am wondering do I need to know them for the 1.5 exam? so far, I had been skipping them as they do not appear in the K&B text book.

Also, things like NAN and positive infinity, negative infinity, are they necessary or not?

thanks,
David Yu
Hi everyone,

I am doing the free mock exams available and stumbled upon a question that I need clarification on. For the question below:

Question 9

public class Boxing9 {
public static void main(String[] args) {
int i = 10;
method(i);
}
static void method(Object o){
System.out.println("Object called");
}
static void method(Number n){
System.out.println("Number called");
}
}


What will be the output for the above program?
1)Object called
2)Number called
3)Compiler Error
4)Runtim Exception

Why is the answer Number called instead of Object called? Even the answer indicates that the integer will be boxed to an Integer then widen to an Object:

Answer

2)Number Called
Explanation: The int i was boxed to a Integer.The Integer reference was widened to an Object (since Integer extends Object).The method() method got an Number reference that actually refers to a Integer object.