soap interview questions
Top soap frequently asked interview questions
So, I was looking through some articles on creating REST API's.
And some of them suggest using all types of HTTP requests: like PUT
DELETE
POST
GET
.
We would create for example index.php and write API this way:
$method = $_SERVER['REQUEST_METHOD'];
$request = split("/", substr(@$_SERVER['PATH_INFO'], 1));
switch ($method) {
case 'PUT':
....some put action....
break;
case 'POST':
....some post action....
break;
case 'GET':
....some get action....
break;
case 'DELETE':
....some delete action....
break;
}
OK, granted - I don't know much about web services (yet).
But, wouldn't it be easier to just accept JSON object through regular POST
or GET
(that would contain method name and all parameters) and then respond in JSON as well. We can easily serialize/deserialize via PHP's json_encode()
and json_decode()
and do whatever we want with that data without having to deal with different HTTP request methods.
Am I missing something?
UPDATE 1:
Ok - after digging through various API's and learning a lot about XML-RPC, JSON-RPC, SOAP, REST I came to a conclusion that this type of API is sound. Actually stack exchange is pretty much using this approach on their sites and I do think that these people know what they are doing Stack Exchange API.
Source: (StackOverflow)
I want to use a WSDL SOAP based web service in Python. I have looked at the Dive Into Python code but the SOAPpy module does not work under Python 2.5.
I have tried using suds which works partly, but breaks with certain types (suds.TypeNotFound: Type not found: 'item').
I have also looked at Client but this does not appear to support WSDL.
And I have looked at ZSI but it looks very complex. Does anyone have any sample code for it?
The WSDL is https://ws.pingdom.com/soap/PingdomAPI.wsdl and works fine with the PHP 5 SOAP client.
Source: (StackOverflow)
Currently doing some exams and I'm struggling through some concepts. These have all been 'mentioned' in my notes really but I didn't really understand how they all linked together. As far as my understanding is:
SOA - a solution to make service consumers/providers communicate. (as far as I understand this is the umbrella term for everything else)
WSDL - A language that describes the provider service.
SOAP - A XML protocol 'wrapper' used by the services to send messages. Works in conjunction with WSDL as to provide parameters?
REST - A design pattern that is similar to SOAP in function but avoids the XML? (really not sure about this one)
JSON - An alternative to XML that uses javascript? (not sure about this one either)
Looking around in the internet there doesn't seem to be a clear definition of what all of these are and how they interlink.
Source: (StackOverflow)
A client of mine has asked me to integrate a 3rd party API into their Rails app. The only problem is that the API uses SOAP. Ruby has basically dropped SOAP in favor of REST. They provide a Java adapter that apparently works with the Java-Ruby bridge, but we'd like to keep it all in Ruby, if possible. I looked into soap4r, but it seems to have a slightly bad reputation.
So what's the best way to integrate SOAP calls into a Rails app?
Source: (StackOverflow)
This question already has an answer here:
I currently figure out the similar is both using internet protocol (HTTP) to exchange data between consumer and provider.
The difference is:
- SOAP is a XML-based message protocol, while REST is an architectural style
- SOAP uses WSDL for communication between consumer and provider, whereas REST just uses XML or JSON to send and receive data
- SOAP invokes services by calling RPC method, REST just simply calls services via URL path
- SOAP doesn't return human readable result, whilst REST result is readable with is just plain XML or JSON
- SOAP is not just over HTTP, it also uses other protocols such as SMTP, FTP, etc, REST is over only HTTP
That's everything I know as the differences between them. Could anyone correct me and add more.
Source: (StackOverflow)
I'm going to learn RESTful web services (it's better to say that I'll have to do this because it's a part of CS master degree program).
I've read some info in Wikipedia and I've also read an article about REST at Sun Developer Network and I see that it's not easy technology, there are special frameworks for building RESTful apps, and it's often being compared to SOAP web services and programmer should understand when to use SOAP and when REST could be nice approach.
I remember that several years ago SOAP was very popular (fashionable?) and item 'SOAP' had to be present in every good CV. But in practice it was used very rarely and for achieving very simple purposes.
It seems to me that REST is another 'last word of fashion' (or I can be totally wrong because I haven't ever seen REST in practice).
Can you give me some examples were REST should be used and why we can't do the same without REST (or why we should spend much more time to do the same without REST)?
UPD: Unfortunatelly I can't see any concrete arguments which can blow my mind in first comments. Make me think that REST is awesome technology!
I'd like to see answers like this:
I was developing another complex
HelloWorld application and we need to
transfer lots of / tiny data and I
proposed REST solution to my workmate:
– Oh, damn! Jonny, we should
certainly use REST for implementing
this app!
– Yes, Billy, we
can use REST, but we would better use
SOAP. Trust me 'cause I know something
about developing HelloWorld
applications.
– But SOAP is
old-fashioned technology from the last
century and we can use better
one.
– Billy, are you ready
to spent 3 days for experimenting with
REST? We can do this with SOAP in 2
hours..
– Yes, I'm sure
that we'll spent even more time to
achieve the same security/performance/
/scalability/whatever else with SOAP.
I'm sure that HelloWorld applications
should be developed only with REST
from now.
Source: (StackOverflow)
I'm relative new to the webservices world and my research seems to have confused me more than enlighten me, my problem is that I was given a library(jar) which I have to extend with some webservice functionality.
This library will be shared to other developers, and among the classes in the jar will be classes that have a method which calls a webservice (that essentially sets an attribute of the class, does some business logic, like storing the object in a db, etc and sends back the object with those modifications). I want to make the call to this service as simple as possible, hopefully as simple so that the developer using the class only need to do.
Car c = new Car("Blue");
c.webmethod();
I have been studying JAX-WS to use on the server but seems to me that I don't need to create a wsimport
in the server nor the wsimport
on the client, since I know that both have the classes, I just need some interaction between classes shared in both the server and the client. How do you think makes sense to do the webservice and the call in the class?
Source: (StackOverflow)
What is the most recommended free/public API for accessing financial market stats and stock quotes (preferrably real-time quotes)? I'm not too picky about how it's exposed (SOAP, REST, some proprietary XML setup, etc.), as long as it's got some decent documentation.
I'm planning to build a simple web dashboard in PHP with some basic data (basically a quick-n-dirty homepage), but may want to grow it into a full blown web app eventually. Any thoughts?
As I find some, I'll post a list here (feel free to comment if you've used any of them before):
Free
Not Free
Source: (StackOverflow)
Trying to create a C# client (will be developed as a Windows service) that sends SOAP requests to a web service (and gets the results).
From this question I saw this code:
protected virtual WebRequest CreateRequest(ISoapMessage soapMessage)
{
var wr = WebRequest.Create(soapMessage.Uri);
wr.ContentType = "text/xml;charset=utf-8";
wr.ContentLength = soapMessage.ContentXml.Length;
wr.Headers.Add("SOAPAction", soapMessage.SoapAction);
wr.Credentials = soapMessage.Credentials;
wr.Method = "POST";
wr.GetRequestStream().Write(Encoding.UTF8.GetBytes(soapMessage.ContentXml), 0, soapMessage.ContentXml.Length);
return wr;
}
public interface ISoapMessage
{
string Uri { get; }
string ContentXml { get; }
string SoapAction { get; }
ICredentials Credentials { get; }
}
Looks nice, anyone knows how to use it and if it is the best practice?
Source: (StackOverflow)
I am confused about how SOAP messages and WSDL fit together? I have started looking into SOAP messages such as:
POST /InStock HTTP/1.1
Host: www.example.org
Content-Type: application/soap+xml; charset=utf-8
Content-Length: nnn
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Body xmlns:m="http://www.example.org/stock">
<m:GetStockPrice>
<m:StockName>IBM</m:StockName>
</m:GetStockPrice>
</soap:Body>
</soap:Envelope>
Are all SOAP messages WSDL's? Is SOAP a protocol that accepts its own 'SOAP messages' or 'WSDL's? If they are different, then when should I use SOAP messages and when should I use WSDL's?
Some clarification around this would be awesome.
Source: (StackOverflow)
I'm trying to trouble shoot a web service client in my current project. I'm not sure of the platform of the Service Server (Most likely LAMP). I believe there is a fault on their side of the fence as i have eliminated the potential issues with my client. The client is a standard ASMX type web reference proxy auto generated from the service WSDL.
What I need to get to is the RAW SOAP Messages (Request and Responses)
What is the best way to go about this?
Source: (StackOverflow)
I'm trying to find a simple (ha) SOAP example in JAVA with a working service any I seem to be finding are not working.
I have tried this one from this example but it's just not working, it's asking me to put a forward slash in but it's in there and nothing happening.
So does anyone know any SOAP example links, I can download/request and mess with?
Thanks for your help.
Source: (StackOverflow)
I've used JAXWS-RI 2.1 to create an interface for my web service, based on a WSDL. I can interact with the web service no problems, but haven't been able to specify a timeout for sending requests to the web service. If for some reason it does not respond the client just seems to spin it's wheels forever.
Hunting around has revealed that I should probably be trying to do something like this:
((BindingProvider)myInterface).getRequestContext().put("com.sun.xml.ws.request.timeout", 10000);
((BindingProvider)myInterface).getRequestContext().put("com.sun.xml.ws.connect.timeout", 10000);
I also discovered that, depending on which version of JAXWS-RI you have, you may need to set these properties instead:
((BindingProvider)myInterface).getRequestContext().put("com.sun.xml.internal.ws.request.timeout", 10000);
((BindingProvider)myInterface).getRequestContext().put("com.sun.xml.internal.ws.connect.timeout", 10000);
The problem I have is that, regardless of which of the above is correct, I don't know where I can do this. All I've got is a Service
subclass that implements the auto-generated interface to the webservice and at the point that this is getting instanciated, if the WSDL is non-responsive then it's already too late to set the properties:
MyWebServiceSoap soap;
MyWebService service = new MyWebService("http://www.google.com");
soap = service.getMyWebServiceSoap();
soap.sendRequestToMyWebService();
Can anyone point me in the right direction?!
Source: (StackOverflow)
I am trying a simple web service example and i get this error even though I uncommented "extension=php_soap.dll
" in php.ini
file. Can you help me out?
Error:
Fatal error: Class 'SoapClient' not found in C:\Program Files (x86)\EasyPHP-5.3.9\www\server.php on line 2
Source: (StackOverflow)