?
Solved

Web Service Examples

Posted on 2011-02-28
8
Medium Priority
?
561 Views
Last Modified: 2012-05-11
Can you please point me to some thorough examples where I can see how web services work?

I just started to work on this area. So basic but very descriptive examples are really appreciated.

If you can give me step by step instructions for a basic example which I can reproduce on my machine , that would be great.

Thanks,
0
Comment
Question by:Tolgar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
8 Comments
 

Author Comment

by:Tolgar
ID: 35001413
By the way, I forgot to tell...I am going to use Perl for my implementation due to some internal restrictions.

If the example can be in Perl that would be really good.

Thanks,
0
 

Author Comment

by:Tolgar
ID: 35002764
A simple example would be fine.

The wsdl is ready in the format given below:

http://sbcd-00-hg.mywork.com/main/services/Example?wsdl

It uses soap.

Thanks,
0
 

Author Comment

by:Tolgar
ID: 35009395
In this wsdl, I need to get the ABCD field from the following part:

<?xml version="1.0" encoding="UTF-8" ?>
<wsdl:definitions targetNamespace= ' ......................................'
SOME CODE
...................
...........
................

- <wsdl:message name="getGeckRequest">
  <wsdl:part name="id" type="xsd:int" /> 
  <wsdl:part name="login" type="soapenc:string" /> 
  </wsdl:message>

SOME CODE
...................
...........
................

 </wsdl:definitions>

Open in new window



I checked it in SOAP UI, and getGeckRequest is the right one to use as I showed above. When I used SOAP UI and run the Request 1 under getGeck, the result has the solution field like that:

<solution>tolgar - SOME NUMBER

SOME TEXT </solution>

Open in new window


What I want to do is; I want to write something into this field using web services in PERL.


How can I make it?

Thanks,
0
Video: Liquid Web Managed WordPress Comparisons

If you run run a WordPress, you understand the potential headaches you may face when updating your plugins and themes. Do you choose to update on the fly and risk taking down your site; or do you set up a staging, keep it in sync with your live site and use that to test updates?

 
LVL 111

Expert Comment

by:Ray Paseur
ID: 35009436
I have only PHP examples.  Here is one.  It is a very simple web service using a RESTful interface.   You give the service a first name, and it returns the last name.  Of course you can extend this kind of design to do much more interesting things than just this, but it illustrates the principles of REST nicely.  You can experiment with it on my server here:
http://www.laprbass.com/RAY_REST_get_last_name.php?key=ABC&name=Ray&resp=XML

In the RESTful design pattern each request is atomic and each response is complete (this is the way the WWW works).  The calling program is not required to maintain stateful information or otherwise be concerned about how the service is preparing its response.  Security, if needed, is as simple as putting the service behind HTTPS.  If it looks amazingly simple, that is because it is amazingly simple.

More information than you will ever need is available here:
http://en.wikipedia.org/wiki/Representational_State_Transfer

Best of luck with your project, ~Ray

<?php // RAY_REST_get_last_name.php
error_reporting(E_ALL);



// DEMONSTRATE HOW A RESTFUL WEB SERVICE WORKS
// INPUT FIRST NAME, OUTPUT LAST NAME
// CALLING EXAMPLE:
// file_get_contents('http://laprbass.com/RAY_REST_get_last_name.php?key=ABC&resp=XML&name=Ray');



// OUR DATA MODEL CONTAINS ALL THE ANSWERS - THIS COULD BE A DATA BASE - AS SIMPLE OR COMPLEX AS NEEDED
$dataModel
= array
( 'Brian'   => 'Portlock'
, 'Ray'     => 'Paseur'
, 'Richard' => 'Quadling'
, 'Dave'    => 'Baldwin'
)
;


// SHOULD RESPONSE BE PLAIN TEXT OR XML FORMAT
$alpha = '';
$omega = '';
if ( (isset($_GET["resp"])) && ($_GET["resp"] == 'XML') )
{
    $alpha = '<response>';
    $omega = '</response>';
}



// TEST THE API KEY
$key = FALSE;
if (isset($_GET["key"])) $key = $_GET["key"];
if ($key !== 'ABC') die($alpha . 'BOGUS API KEY' . $omega);



// LOOK UP THE LAST NAME
$name="?";
if (isset($_GET["name"])) $name = $_GET["name"];

// IF THE URL NAME IS FOUND IN THE DATA MODEL
if (array_key_exists($name, $dataModel))
{
    // RETURNS THE LAST NAME FROM THE DATA MODEL
    die($alpha . "$dataModel[$name]" . $omega);
}

// RETURNS THE UNKNOWN NAME INDICATOR
else die($alpha . 'UNKNOWN' . $omega);

Open in new window

0
 

Author Comment

by:Tolgar
ID: 35010348
Thanks for your reply. But I specifically need SOAP application with Perl.

I would really appreciate if you could give me an example with SOAP Web services with Perl.


Thanks,

Artug
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 35011162
SOAP, eh.  Sorry to hear that.  Some of my colleagues believe that SOAP is the devil.  I don't go quite that far, but I can tell you for sure that the internet is littered with failed SOAP applications.  I have never found anyone who could not understand the REST examples.

Suggest you leave this Q open a while longer - perhaps one of the other experts can weigh in with some useful information.  Best of luck with it, ~Ray
0
 

Author Comment

by:Tolgar
ID: 35011197
Actually, it is not the matter of understanding REST. But on the server which I am working on, it only support SOAP web services. That's why there is this requirement. On the other hand, it has to be with Perl due to similar system requirements.

Thanks,

0
 
LVL 5

Accepted Solution

by:
group0 earned 2000 total points
ID: 35012349
Try http://guide.soaplite.com/ for some examples of getting started with SOAP under Perl
0

Featured Post

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
In order to have all security and back ups taken care of, WordPress users can sign up for services with WP Engine.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question