Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

Web Service Examples

Posted on 2011-02-28
8
Medium Priority
?
562 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
Threat Trends for MSPs to Watch

See the findings.
Despite its humble beginnings, phishing has come a long way since those first crudely constructed emails. Today, phishing sites can appear and disappear in the length of a coffee break, and it takes more than a little know-how to keep your clients secure.

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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…

647 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