java web development tutorials

java web development tutorial

Introduction to Web Services With PHP

Note that both Google’s service and PEAR::SOAP are technically still in beta, so you might encounter the odd bug from time to time. There are other SOAP client libraries available, including the PHP5 SOAP extension and NuSOAP, and while implementation details are different the basic theory is the same as presented here.

Setting up the PEAR SOAP module

Before we can start using SOAP, we had better make sure both PEAR itself and the SOAP module are available. The PEAR package manager is installed by default with PHP 4.3.0 and later, but if you are using an earlier version or it is missing on your system check out the PEAR manual for instructions.

Once you have the package manager installed, you will need to download the SOAP package. On most systems, you can just enter pear install SOAP into a console window. At least, that’s the theory. Unless there is a stable release of SOAP available, you will get the message No release with state equal to: ‘stable’ found for ‘SOAP’. Try pear install SOAP-beta to get the most current version of the package at the time of writing, even though it is in beta, or tell PEAR to accept beta versions without complaint by typing pear config-set preferred_state beta.

You may also get one or more messages starting with requires package, followed by Dependencies failed. In this case, try the pear install command again but add the dependencies on the command line. For example, if PEAR complained that the Net_DIME package is missing, try using pear install Net_DIME SOAP instead.

Getting a license key

Once you have installed the SOAP module, the next step is to download the Google Web APIs developers’ kit and register to get a license key. This key allows you to make up to 1000 SOAP queries a day free of charge. Visit Google Web APIs (http://www.google.co.uk/apis/) and follow the instructions on the site.

Unzip the developers’ kit and put it in a convenient place. It only contains samples for accessing the service with .NET and Java, but most of the documentation applies equally to calling Google from PHP.

Decoding the WSDL file

In the developer’s kit main directory you will find a WSDL file called GoogleSearch.wsdl, which you can open in a text editor or XML browser. This file defines exactly what services we can call using SOAP, though the Google documentation is probably easier to read!

However, we can also see what the SOAP module makes of this file. Create a new PHP page and enter the following.

generateProxyCode();

?>

Place it somewhere on your server along with GoogleSearch.wsdl and access it through your web browser. Assuming everything is working right, you should get a lot of PHP code output. This code is the result of the SOAP_WSDL client class parsing the WSDL file and converting it into PHP functions. This tells us what functions we can call in a rather more readable form than the WSDL document, and is handy particularly if you are using a poorly documented WSDL service.

So how does the code work? Let’s go through it step by step:

1. First, we load the SOAP client file. If this gives an error, it probably means SOAP isn’t installed properly and you should read the instructions above or the PEAR manual.

2. We then create an instance of the SOAP_WSDL class, based on the GoogleSearch.wsdl file. This is one of the main classes we are going to use throughout this tutorial: it parses the WSDL file and represents it as PHP.

3. Finally, we output the proxy code as plain text. (As you can see from the output, in SOAP the proxy is a class that represents the WSDL calls available as PHP functions.)

Spell-checking with Google

If you’ve been using Google for a while (and type as erratically as me), you have probably noticed the “Did you mean…” line that appears if you misspell a word in a search. Thanks to the Google web service, we can add this spelling checker to our PHP applications (though to be honest, it would probably be better to use pspell in an actual application). Enter the following code, with your own license key as the first string.

gettProxy();
echo $googleProxy->doSpellingSuggestion($key, ‘diktionary’);

?>

Simple, isn’t it? The first line is trivial and the next two are the same as the previous example. The fourth line creates the proxy object based on the code we looked at earlier, so we can make SOAP requests by calling its methods. Finally, we call doSpellingSuggestion and output the result. Access this page in your web browser, and you should see the word ‘dictionary’ on its own.

You might see ‘Object’ instead, in which case SOAP has encountered a problem and returned a SOAP_Fault object. We will look into dealing with these faults sometime in the future, but for now check if you have entered your license key correctly and not managed to exhaust your 1000 query per day limit (!).

About the Author

Joeri Cornelissens is the author of this article. For more information about the subject please visit http://www.phphacks.com

Tutorial “creating web services” with NetBeans part1


Spring MVC and WebFlow Video based training for PC or Mac by Virtualpairprogrammers.com


Spring MVC and WebFlow Video based training for PC or Mac by Virtualpairprogrammers.com


$119.00


Spring MVC and WebFlow is a video based training course containing everything you need to be able to work on professional standard Spring MVC projects. Starting from a basic Spring system with just a console and test harness, we build up a web application front end and demonstrate the major concepts in Spring-MVC. The final three chapters cover the related topic of WebFlow. We explain when it shou…

JavaScript: The Definitive Guide: Activate Your Web Pages (Definitive Guides)


JavaScript: The Definitive Guide: Activate Your Web Pages (Definitive Guides)


$27.00


Since 1996, JavaScript: The Definitive Guide has been the bible for JavaScript programmers—a programmer’s guide and comprehensive reference to the core language and to the client-side JavaScript APIs defined by web browsers.The 6th edition covers HTML5 and ECMAScript 5. Many chapters have been completely rewritten to bring them in line with today’s best web development practices. New chapters in…

Head First Java, 2nd Edition


Head First Java, 2nd Edition


$22.00


Learning a complex new language is no easy task especially when it s an object-oriented computer programming language like Java. You might think the problem is your brain. It seems to have a mind of its own, a mind that doesn’t always want to take in the dry, technical stuff you’re forced to study. The fact is your brain craves novelty. It’s constantly searching, scanning, waiting for something u…

Processing: A Programming Handbook for Visual Designers and Artists


Processing: A Programming Handbook for Visual Designers and Artists


$33.88


An introduction to the ideas of computer programming within the context of the visual arts that also serves as a reference and text for Processing, an open-source programming language designed for creating images, animation, and interactivity….

Learning To Program in Java - Training DVD - Tutorial Video


Learning To Program in Java – Training DVD – Tutorial Video


$99.95


Number of Videos: 112 Lessons – 9.75 Hours Duration
Ships on: DVD-ROM
User Level: Beginners
Works On: Windows 7,Vista,XP- Mac OS X

In this video training course on Programming with Java for Beginners, expert author and professor Mike McMillan starts you along the path to enlightenment with Java, by introducing you to the basic concepts, tools and functions that you will need to build fully funct…


Java J2EE Complete: 16-level Instructor-based Video Training Set


Java J2EE Complete: 16-level Instructor-based Video Training Set


$799.99


Interactive Instructor-Based Java J2EE Complete Video Training Course on DVD-ROM. Computer Based Training (CBT) and Video Based Training (VBT) have emerged as the premier training tools in recent years. KeyStone Self-Paced CBT/VBT courses are known for their high quality in-depth content. Compared to traditional training methods, KeyStone courses cost less and users can learn faster while taking …


Java Web Services in a Nutshell (Paperback)


Java Web Services in a Nutshell (Paperback)


$27.14


Provides both a tutorial and a quick reference guide to the Java APIs for Web services development, with a study of the different types of Web services, an explanation of JWSDP, and other documentation and supplementary material.


Java Web Services in a Nutshell (Paperback)


Java Web Services in a Nutshell (Paperback)


$23.66


Provides both a tutorial and a quick reference guide to the Java APIs for Web services development, with a study of the different types of Web services, an explanation of JWSDP, and other documentation and supplementary material.

The Java Ee 6 Tutorial (Paperback)


The Java Ee 6 Tutorial (Paperback)


$29.02


Sun's definitive, example-rich tutorial/references for JavaTM enterprise development have now been completely updated to reflect Java EE 6's most powerful new innovations and best-practice programming techniques. In this, the second of two volumes, Sun experts bring together dozens of advanced solutions designed to make the most of Java EE 6's improved technologies, APIs, and programming model. The authors provide a comprehensive knowledge base that any Java developer can rely on in building complex, large-scale applications that perform better, get to market faster, and can be more easily managed and upgraded. Volume II covers all these areas of enterprise development: " Advanced programming with Servlet 3.0, JSF 2.0, Facelets, JSP, and JSTL " Advanced Web services development with both JAX-WS and JAX-RS (RESTful) " Advanced Enterprise Beans: EJB interceptors, bean-managed transactions, and more, including Enterprise Beans as Web Service endpoints " Advanced Contexts and Dependency Injection " Advanced Java Persistence: derived identities, lock and cache modes, and bean validation " Advanced enterprise application security via Deployment Descriptors " Connector Architecture, Java Message Service, and more The book concludes with a comprehensive case study section presenting a realistic enterprise application project, "Duke's Bank," thoroughly revised to reflect today's advanced Java EE features and enterprise development best practices.

Art of Java Web Development


Art of Java Web Development


$51.52


A guide to the topics required for state of the art Web development, this book covers wide-ranging topics, including a variety of web development frameworks and best practices. Beginning with coverage of the history of the architecture of Web applications, highlighting the uses of the standard web API to create applications with increasingly sophisticated architectures, developers are led through a discussion on the development of industry accepted best practices for architecture. Described is the history and evolution towards this architecture and the reasons that it is superior to previous efforts. Also provided is an overview of the most popular Web application frameworks, covering their architecture and use. Numerous frameworks exist, but trying to evaluate them is difficult because their documentation stresses their advantages but hides their deficiencies. Here, the same application is built in six different frameworks, providing a way to perform an informed comparison. Also provided is an evaluation of the pros and cons of each framework to assist in making a decision or evaluating a framework on your own. Finally, best practices are covered, including sophisticated user interface techniques, intelligent caching and resource management, performance tuning, debugging, testing, and Web services.

Guide to Web Development With Java (Hardcover)


Guide to Web Development With Java (Hardcover)


$73.91


This comprehensive textbook introduces readers to the three-tiered, Model-View-Controller (MVC) architecture by using Hibernate, JSPs, and Java Servlets. These three technologies all use Java, so that a student with a background in programming will be able to master them with ease, with the end result of being able to create web applications that use MVC, validate user input and save data to a database. Features: presents the many topics of web development in small steps, in an accessible, easy-to-follow style; uses powerful technologies that are freely available on the web to speed up web development, such as JSP, JavaBeans, annotations, JSTL, Java 1.5, Hibernate and Tomcat; discusses HTML, HTML Forms, Cascading Style Sheets and XML; introduces core technologies from the outset, such as the MVC architecture; contains questions and exercises at the end of each chapter, detailed illustrations, chapter summaries, and a glossary; includes examples for accessing common web services.

The Java Tutorial (Mixed media product)


The Java Tutorial (Mixed media product)


$31.95


A hands-on guide to the Java programming language, The Java™ Tutorial, Fourth Edition is perfect for any developer looking for a proven path to proficiency with Java SE. This popular tutorial "from the Source" has been completely revised and updated to cover Version 6 of the Java Platform, Standard Edition.Written by members of the Java Software team at Sun Microsystems, this book uses a tested, interactive approach and features real-world problems that help you learn the Java platform by example.New to this edition are chapters on generics, collections, Java Web Start, the platform environment, and regular expressions. Key sections, including the Threads, I/O, Object-Oriented Programming Concepts, and Language Basics chapters have been completely rewritten to reflect reader feedback and to cover new features added to the Java SE 6 platform. A new appendix contains information on how to prepare for the Java Programming Language Certification exam.As with the previous editions, you will find clear explanations of the fundamentals of objects, classes, and data structures, as well as detailed coverage of exceptions, I/O, and threads. All of the popular features that made this book a classic have been retained, including convenient summaries at the end of each section and Questions and Exercises segments to help you practice what you learn.The accompanying CD-ROM is filled with valuable resources including the latest Java SE software (the JRE, JDK, Java API spec, and the guide documentation), the code samples from this book, and solutions to the questions and exercises.The Java™ Series is supported, endorsed, and authored by the creators of the Java technology at Sun Microsystems, Inc. It is the official place to go for complete, expert, and definitive information on Java technology. The books in this series provide the inside information you need to build effective, robust, and portable applications and ap

Web Development With Java


Web Development With Java


$56.95


This book is in New – Excellent condition

Java Web Development Illuminated, by Qian


Java Web Development Illuminated, by Qian


$102.95


This book is in Used condition

Android Application Development for Java Programmers (Paperback)


Android Application Development for Java Programmers (Paperback)


$22.86


If you`re looking for a fast, user-friendly guide to developing mobile apps in Java for Android, look no further: ANDROID APPLICATION DEVELOPMENT FOR JAVA PROGRAMMERS is the ideal first step. Offering quick-start, hands-on lessons, this book explains and illustrates, by careful example, the essential components of the development process. You`ll learn, through the book`s simple tutorial-based style, how to create useful and marketable mobile apps for this popular platform. Written in a conversational style, ANDROID APPLICATION DEVELOPMENT FOR JAVA PROGRAMMERS is concise, complete, and gives you just the information you need to excel in mobile app development. After completing the lessons and following the examples here, you`ll be inspired and ready to join the ranks of developers creating apps for Android.


Filed under Uncategorized by on . Comment#