Chart Krobtragolchai

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

Recent posts by Chart Krobtragolchai

Hi Mark D. Hansen,

After I have read your book in the first 20-pages, I feel that your book is interesting. Your book is up-to-date, concise, practical and straight. I can tell that your book is the best Java Web Services book currently.

Why is Java Web Services so Hard ? --> This article speaks corresponding to my thinking critically. I feel like a dull & innocent child when I came across the Java Web Services world. Many detailed specification must be taken some times to accustom and understand.

In my opinion, it had been better if your book became Head First Java Web Services. Fun and friendly-brained.

In your book, you do not mention about the Java IDE you used. Maybe the maintainance reason of IDE version. I feel that the IDE tool is one of the important factor in the Java Web Services project development.

Which tool is your favorite when you work with Java Web Services project? I want the un-biased answer from your opinion.

Which tool is you used to write the example code in your book ? Do not tell me that you use the Notepad to write your code, especially dealing with WSDL.

I am very honor to talk with you.
17 years ago
Dear the author of Ajax And Php ,

Do not forget to answer my questions !!

Regards,
Hi Cristian Darie, Bogdan Brinzarea, Filip Chereches-Tosa & Mihai Bucica,


I am java developer, not php developer.

However, I would like to know what time you take to become the AJAX master.

First , I think AJAX make like easier than Java Script.(Yes, in user !!)

But in the developer perspective, I can say that it is not easy.

The second question : AJAX with PHP is easier than AJAX with Java or not ??

Thank you very much
Hi Mike Keith and Merrick Schincariol,

I would like to ask you some questions about EJB 3 ?

1. What happen about my Java developer career if I can write the EJB 3 but I cannot write or maintain the EJB 2.0 or 2.1 ?

2. What happen about my Java developer career if I can write the EJB 2.0 or 2.1 but I cannot write the EJB 3 ?

3. Is any content/tutorial of EJB 2.0 or 2.1 in your book ?

4. Can I deploy the EJB 2.0/2.1 file to the server that supported EJB 3 without changing any code?

Please answer the first and second questions from your experience.
Tell the current and future situation (Next 2-3 years).

In my opinion, EJB 3 is easy to develop when compared to EJB 2.0 or 2.1 but I cannot still find any server (in the real world) supported to deploy the EJB 3 files.

In the automotive world, EJB 3 is look like the NGV engine, while EJB 2.0/2.1 is look like the oil engine.
Hello Sas Jacobs,

I would like to ask you some questions about this book.

My question is "How much time do you spend to finish the Beginning XML with DOM and Ajax: From Novice to Professional (456 pages) ?".

Please also tell me your inspiration to write this book.

There have been many books about XML and AJAX already in the market such as Head Rush AJAX. Why I should buy your book ?

About my profile, I am a java developer in Thailand.
I have 4 Java Certifications - SCJP, SCWCD, SCBCD, and SCJWSD.

I write the "Talui* Java Web Services" book (Thai Language) to help the Java programmer in Thailand to learn the Java Web Services Technology.

*Talui in Thai means "Discovery".

You can see it at www.j2concept.cjb.net

Regards,
Chart K.
I use NetBeans 5.0 to create the simple JAX-RPC client to connect to Google Web API Service.

At the deploy time on Sun App 8.2, it generate :

In-place deployment at D:\Sun_workspace\NetBean\GoogleWebService\build\web
Start registering the project's server resources
Finished registering server resources
moduleID=GoogleWebService
deployment started : 0%
Deploying application in domain failed; Error while running ejbc -- Fatal Error from EJB Compiler -- jaxrpc compilation exception
; requested operation cannot be completed
D:\Sun_workspace\NetBean\GoogleWebService\nbproject\build-impl.xml:439: Deployment error:
The module has not been deployed.
See the server log for details.
BUILD FAILED (total time: 38 seconds)

Do you have any comment or suggestion ??
I try to deploy by Admin console but it give the same result.
I use NetBeans 5.0 to create the simple JAX-RPC client to connect to Google Web API Service.

At the deploy time on Sun App 8.2, it generate :

In-place deployment at D:\Sun_workspace\NetBean\GoogleWebService\build\web
Start registering the project's server resources
Finished registering server resources
moduleID=GoogleWebService
deployment started : 0%
Deploying application in domain failed; Error while running ejbc -- Fatal Error from EJB Compiler -- jaxrpc compilation exception
; requested operation cannot be completed
D:\Sun_workspace\NetBean\GoogleWebService\nbproject\build-impl.xml:439: Deployment error:
The module has not been deployed.
See the server log for details.
BUILD FAILED (total time: 38 seconds)

Do you have any comment or suggestion ??
I try to deploy by Admin console but it give the same result.
18 years ago
Thank you very much.
But why UDDI@SAP does not return me any result.
You will see the erroe page(404 Not Found) at http://uddi.sap.com/uddi/api/inquiry/.


That 's why I ask this question to ensure that someone get the same result like me.

Anyone who have experienced to get any data from the UDDI@SAP, if your code is still working with UDDI@SAP, please tell me how.
Could we still use UDDI@SAP to write JAXR code testesting to get business data ?
http://uddi.sap.com/
18 years ago
Could we still use UDDI@SAP to write JAXR code testesting to get business data ?
http://uddi.sap.com/
What more jar files do I use to run the JAXR code below?

I use NetBeans to create below code.
I add jaxr-api.jar and jaxr-impl.jar but they are not enough.

This is the result :

init:
deps-jar:
compile:
run:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/soap/SOAPException
at com.sun.xml.registry.uddi.UDDIMapper.<init>(Unknown Source)
at com.sun.xml.registry.uddi.RegistryServiceImpl.<init>(Unknown Source)
at com.sun.xml.registry.uddi.ConnectionImpl.<init>(Unknown Source)
at com.sun.xml.registry.uddi.ConnectionFactoryImpl.createConnection(Unknown Source)
at com.sun.xml.registry.common.ConnectionFactoryImpl.createConnection(Unknown Source)
at XMLQuery.inquire(XMLQuery.java:59)
at XMLQuery.main(XMLQuery.java:46)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)




import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.Properties;
import javax.xml.registry.BulkResponse;
import javax.xml.registry.BusinessQueryManager;
import javax.xml.registry.Connection;
import javax.xml.registry.ConnectionFactory;
import javax.xml.registry.FindQualifier;
import javax.xml.registry.JAXRException;
import javax.xml.registry.RegistryService;
import javax.xml.registry.infomodel.EmailAddress;
import javax.xml.registry.infomodel.Organization;
import javax.xml.registry.infomodel.PersonName;
import javax.xml.registry.infomodel.Service;
import javax.xml.registry.infomodel.ServiceBinding;
import javax.xml.registry.infomodel.TelephoneNumber;
import javax.xml.registry.infomodel.User;

/**
*
* @author administratro
*/
public class XMLQuery {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
String queryString = new String("%Microsoft%");
XMLQuery xmlQuery = new XMLQuery();
xmlQuery.inquire(queryString);
}

public void inquire(String queryString){
Connection con = null;
Properties prop = new Properties();
prop.setProperty("javax.xml.registry.queryManagerURL",
"http://uddi.microsoft.com/inquire");
prop.setProperty("javax.xml.registry.factoryClass",
"com.sun.xml.registry.uddi.ConnectionFactoryImpl");
try{
ConnectionFactory cf = ConnectionFactory.newInstance();
cf.setProperties(prop);
con = cf.createConnection();
RegistryService rs = con.getRegistryService();
BusinessQueryManager businessQueryManager = rs.getBusinessQueryManager();
Collection findQualifiers = new ArrayList();
findQualifiers.add(FindQualifier.CASE_SENSITIVE_MATCH);
Collection namePatterns = new ArrayList();
namePatterns.add(queryString);
BulkResponse bulkResponse = businessQueryManager.findOrganizations(
findQualifiers, namePatterns, null, null, null, null);
Iterator responseIterator = bulkResponse.getCollection().iterator();
while (responseIterator.hasNext()){
Organization org = (Organization)responseIterator.next();
System.out.println("Name: "+org.getName().getValue());
System.out.println("Desc: "+org.getDescription().getValue());
System.out.println("ID: "+org.getKey().getId());
User contactPerson = org.getPrimaryContact();
if (contactPerson!=null){
PersonName name = contactPerson.getPersonName();
System.out.println("Contact Person Name: "+name.getFullName());
Iterator contactNumbers = contactPerson.getTelephoneNumbers(
contactPerson.getType()).iterator();
while(contactNumbers.hasNext()){
TelephoneNumber tnumber = (TelephoneNumber)contactNumbers.next();
System.out.println("Telephone: "+tnumber.getNumber());
}
Iterator emails = contactPerson.getEmailAddresses().iterator();
while(emails.hasNext()){
System.out.println("Email: "+(EmailAddress)emails.next());
}
}
Iterator services = org.getServices().iterator();
while(services.hasNext()){
Service service = (Service)services.next();
System.out.println("Service: "+service.getName().getValue());
System.out.println("Service Description: "+
service.getDescription().getValue());
System.out.println("Service ID: "+service.getKey().getId());
Iterator serviceBindings = service.getServiceBindings().iterator();
while(serviceBindings.hasNext()){
ServiceBinding serviceBinding = (ServiceBinding)serviceBindings.next();
System.out.println("Binding: "+serviceBinding.getDescription());
System.out.println("URI: "+serviceBinding.getAccessURI());
}
}
}
}catch(Exception error){
System.out.println("Error: "+error.getMessage());
error.printStackTrace();
}finally{
if (con!=null){
try{
con.close();
}catch(JAXRException error){}//ignore
}
}
}
}
18 years ago
What jar files do I use to run the JAXR code below?

I add jaxr-api.jar and jaxr-impl.jar but they are not enough.

This is the result :

init:
deps-jar:
compile:
run:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/soap/SOAPException
at com.sun.xml.registry.uddi.UDDIMapper.<init>(Unknown Source)
at com.sun.xml.registry.uddi.RegistryServiceImpl.<init>(Unknown Source)
at com.sun.xml.registry.uddi.ConnectionImpl.<init>(Unknown Source)
at com.sun.xml.registry.uddi.ConnectionFactoryImpl.createConnection(Unknown Source)
at com.sun.xml.registry.common.ConnectionFactoryImpl.createConnection(Unknown Source)
at XMLQuery.inquire(XMLQuery.java:59)
at XMLQuery.main(XMLQuery.java:46)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)




import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.Properties;
import javax.xml.registry.BulkResponse;
import javax.xml.registry.BusinessQueryManager;
import javax.xml.registry.Connection;
import javax.xml.registry.ConnectionFactory;
import javax.xml.registry.FindQualifier;
import javax.xml.registry.JAXRException;
import javax.xml.registry.RegistryService;
import javax.xml.registry.infomodel.EmailAddress;
import javax.xml.registry.infomodel.Organization;
import javax.xml.registry.infomodel.PersonName;
import javax.xml.registry.infomodel.Service;
import javax.xml.registry.infomodel.ServiceBinding;
import javax.xml.registry.infomodel.TelephoneNumber;
import javax.xml.registry.infomodel.User;

/**
*
* @author administratro
*/
public class XMLQuery {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
String queryString = new String("%Microsoft%");
XMLQuery xmlQuery = new XMLQuery();
xmlQuery.inquire(queryString);
}

public void inquire(String queryString){
Connection con = null;
Properties prop = new Properties();
prop.setProperty("javax.xml.registry.queryManagerURL",
"http://uddi.microsoft.com/inquire");
prop.setProperty("javax.xml.registry.factoryClass",
"com.sun.xml.registry.uddi.ConnectionFactoryImpl");
try{
ConnectionFactory cf = ConnectionFactory.newInstance();
cf.setProperties(prop);
con = cf.createConnection();
RegistryService rs = con.getRegistryService();
BusinessQueryManager businessQueryManager = rs.getBusinessQueryManager();
Collection findQualifiers = new ArrayList();
findQualifiers.add(FindQualifier.CASE_SENSITIVE_MATCH);
Collection namePatterns = new ArrayList();
namePatterns.add(queryString);
BulkResponse bulkResponse = businessQueryManager.findOrganizations(
findQualifiers, namePatterns, null, null, null, null);
Iterator responseIterator = bulkResponse.getCollection().iterator();
while (responseIterator.hasNext()){
Organization org = (Organization)responseIterator.next();
System.out.println("Name: "+org.getName().getValue());
System.out.println("Desc: "+org.getDescription().getValue());
System.out.println("ID: "+org.getKey().getId());
User contactPerson = org.getPrimaryContact();
if (contactPerson!=null){
PersonName name = contactPerson.getPersonName();
System.out.println("Contact Person Name: "+name.getFullName());
Iterator contactNumbers = contactPerson.getTelephoneNumbers(
contactPerson.getType()).iterator();
while(contactNumbers.hasNext()){
TelephoneNumber tnumber = (TelephoneNumber)contactNumbers.next();
System.out.println("Telephone: "+tnumber.getNumber());
}
Iterator emails = contactPerson.getEmailAddresses().iterator();
while(emails.hasNext()){
System.out.println("Email: "+(EmailAddress)emails.next());
}
}
Iterator services = org.getServices().iterator();
while(services.hasNext()){
Service service = (Service)services.next();
System.out.println("Service: "+service.getName().getValue());
System.out.println("Service Description: "+
service.getDescription().getValue());
System.out.println("Service ID: "+service.getKey().getId());
Iterator serviceBindings = service.getServiceBindings().iterator();
while(serviceBindings.hasNext()){
ServiceBinding serviceBinding = (ServiceBinding)serviceBindings.next();
System.out.println("Binding: "+serviceBinding.getDescription());
System.out.println("URI: "+serviceBinding.getAccessURI());
}
}
}
}catch(Exception error){
System.out.println("Error: "+error.getMessage());
error.printStackTrace();
}finally{
if (con!=null){
try{
con.close();
}catch(JAXRException error){}//ignore
}
}
}
}
Continue qustion :

//code 3
SAXParserFactory spfactory = SAXParserFactory.newInstance();
SAXParser saxParser = spfactory.newSAXParser();
XMLReader reader = saxParser.getXMLReader();
reader.setContentHandler(this);
reader.parse(fileName);

I think that the result of code 3 and code 2 should be the same but it gives the result like code 1.

What happen ?
18 years ago
I use NetBeans to create the simple SAX code to parse the Train.xml below :

<?xml version="1.0" encoding="UTF-8"?>
<train xmlns:myPrefix="http://example.com">
<car type="Engine">
<color>Black</color>
<weight>512 tons</weight>
<length>60 feet</length>
<occupants>3</occupants>
</car>
<car type="Baggage">
<color>Green</color>
<weight>80 tons</weight>
<length>40 feet</length>
<occupants>0</occupants>
</car>
<car type="Dining">
<color>Green and Yellow</color>
<weight>50 tons</weight>
<length>50 feet</length>
<occupants>18</occupants>
</car>
<car type="Passenger">
<color>Green and Yellow </color>
<weight>40 tons</weight>
<length>60 feet</length>
<occupants>23</occupants>
</car>
<car type="Pullman">
<color>Green and Yellow</color>
<weight>50 tons</weight>
<length>60 feet</length>
<occupants>23</occupants>
</car>
<car type="Caboose">
<color>Red</color>
<weight>90 tons</weight>
<length>30 feet</length>
<occupants>4</occupants>
</car>
</train>


import java.io.File;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.parsers.SAXParser;
import org.xml.sax.*;
import org.xml.sax.helpers.*;

public class TrainReader extends DefaultHandler{

private boolean isColor;
private String trainCarType = "";
private StringBuffer trainCarColor = new StringBuffer();

/** Creates a new instance of TrainReader */
public TrainReader() {
}

public static void main(String[] args)throws Exception{
System.out.println("Running train reader...");
TrainReader readerObj = new TrainReader();
readerObj.read(args[0]);
}

public void read(String fileName)throws Exception{
//Code 1
SAXParserFactory spfactory = SAXParserFactory.newInstance();
SAXParser saxParser = spfactory.newSAXParser();
spfactory.setValidating(true);
spfactory.setNamespaceAware(true);
saxParser.parse(new File(fileName),this);

//Code 2
//XMLReader reader = XMLReaderFactory.createXMLReader();
//reader.setContentHandler(this);
//reader.parse(fileName);
}

public void startDocument() throws SAXException{
System.out.println("Start of the train");
}

public void endDocument() throws SAXException{
System.out.println("End of the train");
}

public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {

if (localName.equals("car")){
if (attributes != null){
trainCarType = attributes.getValue("type");
}
}

if (localName.equals("color")){
trainCarColor.setLength(0);
isColor = true;
}else{
isColor = false;
}

}

public void characters(char[] ch, int start, int length) throws SAXException {
if(isColor){
trainCarColor.append(ch,start,length);
}
}

public void endElement(String uri, String localName, String qName) throws SAXException {
if(isColor){
System.out.println("The color of the " + trainCarType + " car is" +
trainCarColor.toString());
}
isColor = false;
}

public void startPrefixMapping(String prefix, String uri) throws SAXException {
System.out.println("Start of Prefix Mapping");
System.out.println("The prefix is " + prefix);
System.out.println("The uri is " + uri);
}

public void endPrefixMapping(String prefix) throws SAXException {
System.out.println("End of Prefix Mapping");
System.out.println("The prefix is " + prefix);
}
}

The problem is why it give different result between Code 1 and Code 2 in read(String fileName) method.

When use code 1, the result is :
Running train reader...
Start of the train
End of the train


When use code 2, the result is :
Running train reader...
Start of the train
Start of Prefix Mapping
The prefix is myPrefix
The uri is http://example.com
The color of the Engine car isBlack
The color of the Baggage car isGreen
The color of the Dining car isGreen and Yellow
The color of the Passenger car isGreen and Yellow
The color of the Pullman car isGreen and Yellow
The color of the Caboose car isRed
End of Prefix Mapping
The prefix is myPrefix
End of the train

In code 1, the localName is always blank. I try to change the below value in all combination- true-true, true-false,flase-flase, flase-true.
spfactory.setValidating(true);
spfactory.setNamespaceAware(true);
I use NetBeans to create the simple SAX code to parse the Train.xml below :

<?xml version="1.0" encoding="UTF-8"?>
<train xmlns:myPrefix="http://example.com">
<car type="Engine">
<color>Black</color>
<weight>512 tons</weight>
<length>60 feet</length>
<occupants>3</occupants>
</car>
<car type="Baggage">
<color>Green</color>
<weight>80 tons</weight>
<length>40 feet</length>
<occupants>0</occupants>
</car>
<car type="Dining">
<color>Green and Yellow</color>
<weight>50 tons</weight>
<length>50 feet</length>
<occupants>18</occupants>
</car>
<car type="Passenger">
<color>Green and Yellow </color>
<weight>40 tons</weight>
<length>60 feet</length>
<occupants>23</occupants>
</car>
<car type="Pullman">
<color>Green and Yellow</color>
<weight>50 tons</weight>
<length>60 feet</length>
<occupants>23</occupants>
</car>
<car type="Caboose">
<color>Red</color>
<weight>90 tons</weight>
<length>30 feet</length>
<occupants>4</occupants>
</car>
</train>


import java.io.File;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.parsers.SAXParser;
import org.xml.sax.*;
import org.xml.sax.helpers.*;

public class TrainReader extends DefaultHandler{

private boolean isColor;
private String trainCarType = "";
private StringBuffer trainCarColor = new StringBuffer();

/** Creates a new instance of TrainReader */
public TrainReader() {
}

public static void main(String[] args)throws Exception{
System.out.println("Running train reader...");
TrainReader readerObj = new TrainReader();
readerObj.read(args[0]);
}

public void read(String fileName)throws Exception{
//Code 1
SAXParserFactory spfactory = SAXParserFactory.newInstance();
SAXParser saxParser = spfactory.newSAXParser();
spfactory.setValidating(true);
spfactory.setNamespaceAware(true);
saxParser.parse(new File(fileName),this);

//Code 2
//XMLReader reader = XMLReaderFactory.createXMLReader();
//reader.setContentHandler(this);
//reader.parse(fileName);
}

public void startDocument() throws SAXException{
System.out.println("Start of the train");
}

public void endDocument() throws SAXException{
System.out.println("End of the train");
}

public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {

if (localName.equals("car")){
if (attributes != null){
trainCarType = attributes.getValue("type");
}
}

if (localName.equals("color")){
trainCarColor.setLength(0);
isColor = true;
}else{
isColor = false;
}

}

public void characters(char[] ch, int start, int length) throws SAXException {
if(isColor){
trainCarColor.append(ch,start,length);
}
}

public void endElement(String uri, String localName, String qName) throws SAXException {
if(isColor){
System.out.println("The color of the " + trainCarType + " car is" +
trainCarColor.toString());
}
isColor = false;
}

public void startPrefixMapping(String prefix, String uri) throws SAXException {
System.out.println("Start of Prefix Mapping");
System.out.println("The prefix is " + prefix);
System.out.println("The uri is " + uri);
}

public void endPrefixMapping(String prefix) throws SAXException {
System.out.println("End of Prefix Mapping");
System.out.println("The prefix is " + prefix);
}
}

The problem is why it give different result between Code 1 and Code 2 in read(String fileName) method.

When use code 1, the result is :
Running train reader...
Start of the train
End of the train


When use code 2, the result is :
Running train reader...
Start of the train
Start of Prefix Mapping
The prefix is myPrefix
The uri is http://example.com
The color of the Engine car isBlack
The color of the Baggage car isGreen
The color of the Dining car isGreen and Yellow
The color of the Passenger car isGreen and Yellow
The color of the Pullman car isGreen and Yellow
The color of the Caboose car isRed
End of Prefix Mapping
The prefix is myPrefix
End of the train

In code 1, the localName is always blank. I try to change the below value in all combination- true-true, true-false,flase-flase, flase-true.
spfactory.setValidating(true);
spfactory.setNamespaceAware(true);
18 years ago