roast_soul
roast_soul

Reputation: 3650

Technically,to create soap message, WSDL file is a must?

I'm using the SoapUI to generate the soap request. It hints me to input the wsdl file. I do it, and it create the soap-style message. Everything is OK.

But I have a doubt. If I have webservice without any WSDL file, can I still generate the soap-style message by hand? If it can, how to?

Or if I know the webservice need to input two int paramaters and return one string value, can I speculate the soap message only by these limited information?

Upvotes: 2

Views: 1162

Answers (3)

John Saunders
John Saunders

Reputation: 161821

The purpose of the WSDL is to describe the service.

This machine-readable description allows computer programs to create clients that know how to call the service and process the responses.

Upvotes: 0

herry
herry

Reputation: 1738

In Java: If you have webservice (annotated class etc.), the your server create one WSDL file when you deployed it. This WSDL you can use for soapUi.


If you have any structure (endpoint, class, XSD etc.), you can create soap message by hand.

If you weren't use WSDL for soap message, it wouldn't call/send this message. So the wsdl document is a required element according to the protocol. WSDL describes of how the service can be called, what parameters it expects, and what data structures it returns.

From Wikipedia:

WSDL is often used in combination with SOAP and an XML Schema to provide Web services over the Internet. A client program connecting to a Web service can read the WSDL file to determine what operations are available on the server. Any special datatypes used are embedded in the WSDL file in the form of XML Schema. The client can then use SOAP to actually call one of the operations listed in the WSDL file using for example XML over HTTP.


Here is in example for invoking web service dynamically. In this case the author doesn't know the description of the WSDL.

Upvotes: 0

fede.evol
fede.evol

Reputation: 191

If you are just doing -requests- then you don't need to have the WSDL file if you know the specific service you're asking and the parameters as you say. You can even do it by hand by creating the request and then sending it over HTTP (for example you could create it with your editor in a file and then send it via wget or curl).

As for an example I'll cite wikipedia:

<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
  <soap:Header>
  </soap:Header>
  <soap:Body>
    <m:GetStockPrice xmlns:m="http://www.example.org/stock">
      <m:StockName>IBM</m:StockName>
    </m:GetStockPrice>
  </soap:Body>
</soap:Envelope>

What you need to change is the parts in the soap:Body: of course the GetStockPrice (which is the service you're accessing) and StockName which is the parameter (in your case you may have more than one).

If in doubt you can put something to listen on a socket (for example netcat) and make your application with WSDL do a query to it and see the exact informations, then remove WSDL and work "by hand".

Upvotes: 3

Related Questions