0% found this document useful (0 votes)
94 views3 pages

XML Ex1

The document provides examples of SOAP requests and responses for getting a phone number and quotation. The phone number SOAP request includes a getPhoneNumber element containing a name, and the response includes a phone number element. The quotation SOAP request includes a GetQuotation element containing a QuotationName, and the response includes a Quotation element containing the quotation text.

Uploaded by

Suganya Selvaraj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
94 views3 pages

XML Ex1

The document provides examples of SOAP requests and responses for getting a phone number and quotation. The phone number SOAP request includes a getPhoneNumber element containing a name, and the response includes a phone number element. The quotation SOAP request includes a GetQuotation element containing a QuotationName, and the response includes a Quotation element containing the quotation text.

Uploaded by

Suganya Selvaraj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Create a simple SOAP message for the following Java interface

public interface PhoneNumber


{
public string getPhoneNumber(String name);
}
SOAP Request
POST /mypath HTTP/1.1
Host: 123.45.67.89
Content-Type: text/xml
Content-Length: 300
SOAPMethodName: urn:mysite-com:PhoneNumber#getPhoneNumber
<SOAP-ENV:Envelope
xmlns:SOAP-ENV=”http://schemas.xmlsoap.org/soap/envelope/”
SOAP-ENV:encodingStyle=”http://schemas.xmlsoap.org/soap/encoding/”>
<SOAP-ENV:Body>
<ns:getPhoneNumber xmlns:ns=”PhoneNumber”>
<name>John Doe</name>
</ns:getPhoneNumber>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

SOAP Response
POST /mypath HTTP/1.1
Host: 123.45.67.89
Content-Type: text/xml
Content-Length: 300
SOAPMethodName: urn:mysite-com:PhoneNumber#getPhoneNumber
<SOAP-ENV:Envelope
xmlns:SOAP-ENV=”http://schemas.xmlsoap.org/soap/envelope/”
SOAP-ENV:encodingStyle=”http://schemas.xmlsoap.org/soap/encoding/”>
<SOAP-ENV:Body>
<ns:PhoneNumberResponse xmlns:ns=”PhoneNumber”>
<phno>9123456789</phno>
</ns: PhoneNumberResponse >
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Consider a scenario where a GetQuotation request is sent to a SOAP Server over


HTTP. The request has a QuotationName parameter, and a Quotation will be returned
in the response.The namespace for the function is defined in
http://www.xyz.org/quotation address.Construct a SOAP request and response for the
above scenario.
SOAP REQUEST
POST /Quotation HTTP/1.0
Host: www.xyz.org
Content-Type: text/xml; charset = utf-8
Content-Length: nnn

<?xml version = "1.0"?>


<SOAP-ENV:Envelope
xmlns:SOAP-ENV = "http://www.w3.org/2001/12/soap-envelope"
SOAP-ENV:encodingStyle = "http://www.w3.org/2001/12/soap-encoding">

<SOAP-ENV:Body xmlns:m = "http://www.xyz.org/quotations">


<m:GetQuotation>
<m:QuotationsName>MiscroSoft</m:QuotationsName>
</m:GetQuotation>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

SOAP response
HTTP/1.0 200 OK
Content-Type: text/xml; charset = utf-8
Content-Length: nnn

<?xml version = "1.0"?>


<SOAP-ENV:Envelope
xmlns:SOAP-ENV = "http://www.w3.org/2001/12/soap-envelope"
SOAP-ENV:encodingStyle = "http://www.w3.org/2001/12/soap-encoding">

<SOAP-ENV:Body xmlns:m = "http://www.xyz.org/quotation">


<m:GetQuotationResponse>
<m:Quotation>Here is the quotation</m:Quotation>
</m:GetQuotationResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

You might also like