Jump to content

SOAP Tutorial Question - The SOAP Example


Guest TMS

Recommended Posts

In the example shown here: SOAP Exampleand below: There is a request for a stock quote for IBMThe response comes back as 34.5But, what If I want to send a request for an IBM stock quote and a MSFT stock quote? There is nothing in the reply that ties it to the request. I realize that the example is simplified for the purpose of the tutorial, but can these be sent in batches? If so, is there a standard way of tying the SOAP reply with the SOAP request?Thanks in advance.TMSExample from SOAP ExampleThe SOAP request:

POST /InStock HTTP/1.1Host: www.example.orgContent-Type: application/soap+xml; charset=utf-8Content-Length: nnn<?xml version="1.0"?><soap:Envelopexmlns: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>

A SOAP response:

HTTP/1.1 200 OKContent-Type: application/soap+xml; charset=utf-8Content-Length: nnn<?xml version="1.0"?><soap:Envelopexmlns: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:GetStockPriceResponse>	  <m:Price>34.5</m:Price>	</m:GetStockPriceResponse>  </soap:Body></soap:Envelope>

Link to comment
Share on other sites

Well, I'm not sure, but I think that the both the requrest and response are extensible (in the spirit of XML). You could simply add another element and/or attribute to carry the additional data:Request

<soap:Envelopexmlns: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:StockName>MSFT</m:StockName>	</m:GetStockPrice>  </soap:Body></soap:Envelope>

Response

<soap:Envelopexmlns: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:GetStockPriceResponse>	  <m:Stock>		<m:Price>34.5</m:Price>	  </m:Stock>	  <m:Stock>		<m:Price>32.5</m:Price>	  </m:Stock>	</m:GetStockPriceResponse>  </soap:Body></soap:Envelope>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...