You are on page 1of 6

Bài tập cá nhân phần WSDL.

Xây dựng WSDL cho SOAP tương ứng:


1. Tính phí qua thẻ tín dụng đặt chuyến du lịch.
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://example.com/travel"
targetNamespace="http://example.com/travel">
<message name="PaymentRequest">
<part name="cardholderName" type="xsd:string" />
<part name="cardType" type="xsd:string" />
<part name="cardNumber" type="xsd:string" />
<part name="cvcNumber" type="xsd:int" />
<part name="expirationMonth" type="xsd:int" />
<part name="expirationYear" type="xsd:int" />
<part name="amount" type="xsd:float" />
<part name="currency" type="xsd:string" />
</message>
<message name="PaymentResponse">
<part name="status" type="xsd:string" />
<part name="message" type="xsd:string" />
</message>
<portType name="PaymentService">
<operation name="processPayment">
<input message="tns:PaymentRequest" />
<output message="tns:PaymentResponse" />
</operation>
</portType>
<binding name="PaymentServiceSoap" type="tns:PaymentService">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="processPayment">
<soap:operation
soapAction="http://example.com/travel/processPayment" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>
<service name="PaymentService">
<port name="PaymentServiceSoap" binding="tns:PaymentServiceSoap">
<soap:address location="http://example.com/travel/paymentService" />
</port>
</service>
</definitions>
2. Kiểm tra trạng thái đơn hàng.
<definitions name="OrderStatusCheckService"
targetNamespace="http://example.com/orderstatusservice"
xmlns:tns="http://example.com/orderstatusservice"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<xsd:schema targetNamespace="http://example.com/orderstatusservice">
<xsd:element name="OrderNumber" type="xsd:string"/>
<xsd:element name="CompanyID" type="xsd:string"/>
<xsd:element name="OrderStatus" type="xsd:string"/>
</xsd:schema>
</types>
<message name="CheckOrderStatusRequest">
<part name="OrderNumber" type="tns:OrderNumber"/>
<part name="CompanyID" type="tns:CompanyID"/>
</message>
<message name="CheckOrderStatusResponse">
<part name="OrderStatus" type="tns:OrderStatus"/>
</message>
<portType name="OrderStatusCheckPortType">
<operation name="CheckOrderStatus">
<input message="tns:CheckOrderStatusRequest"/>
<output message="tns:CheckOrderStatusResponse"/>
</operation>
</portType>
<binding name="OrderStatusCheckBinding"
type="tns:OrderStatusCheckPortType">
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="CheckOrderStatus">
<soap:operation
soapAction="http://example.com/orderstatusservice/CheckOrderStatus"/>
<input>
<soap:body use="encoded"
namespace="http://example.com/orderstatusservice"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded"
namespace="http://example.com/orderstatusservice"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="OrderStatusCheckService">
<port name="OrderStatusCheckPort"
binding="tns:OrderStatusCheckBinding">
<soap:address location="http://example.com/orderstatusservice"/>
</port>
</service>
</definitions>
3. Kiểm tra tồn kho của một đơn hàng cụ thể.
<definitions name="InventoryCheckService"
targetNamespace="http://example.com/inventoryservice"
xmlns:tns="http://example.com/inventoryservice"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<xsd:schema targetNamespace="http://example.com/inventoryservice">
<xsd:element name="ProductID" type="xsd:string"/>
<xsd:element name="Quantity" type="xsd:int"/>
<xsd:element name="InventoryStatus" type="xsd:string"/>
</xsd:schema>
</types>
<message name="CheckInventoryRequest">
<part name="ProductID" type="tns:ProductID"/>
<part name="Quantity" type="tns:Quantity"/>
</message>
<message name="CheckInventoryResponse">
<part name="InventoryStatus" type="tns:InventoryStatus"/>
</message>
<portType name="InventoryCheckPortType">
<operation name="CheckInventory">
<input message="tns:CheckInventoryRequest"/>
<output message="tns:CheckInventoryResponse"/>
</operation>
</portType>
<binding name="InventoryCheckBinding"
type="tns:InventoryCheckPortType">
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="CheckInventory">
<soap:operation
soapAction="http://example.com/inventoryservice/CheckInventory"/>
<input>
<soap:body use="encoded"
namespace="http://example.com/inventoryservice"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded"
namespace="http://example.com/inventoryservice"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="InventoryCheckService">
<port name="InventoryCheckPort" binding="tns:InventoryCheckBinding">
<soap:address location="http://example.com/inventoryservice"/>
</port>
</service>
</definitions>

You might also like