В настоящее время я изучаю веб-службы и после выполнения примера практики в файле .asmx, я заметил, что под страницей вывода примера метода есть много связанных с SOAP сообщений, таких как приведенные ниже, может кто-нибудь сказать мне, для чего эти сообщения?Спасибо.
SOAP 1.1 Ниже приведен пример запроса и ответа SOAP 1.1.Показанные заполнители необходимо заменить фактическими значениями.
POST /SecurityWebService/Service.asmx HTTP/1.1 Host: localhost Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://tempuri.org/GetSecurityInfo" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <GetSecurityInfo xmlns="http://tempuri.org/"> <Code>string</Code> </GetSecurityInfo> </soap:Body> </soap:Envelope> HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <GetSecurityInfoResponse xmlns="http://tempuri.org/"> <GetSecurityInfoResult> <Code>string</Code> <CompanyName>string</CompanyName> <Price>double</Price> </GetSecurityInfoResult> </GetSecurityInfoResponse> </soap:Body> </soap:Envelope>
SOAP 1.2 Ниже приведен пример запроса и ответа SOAP 1.2.Показанные заполнители необходимо заменить фактическими значениями.
POST /SecurityWebService/Service.asmx HTTP/1.1 Host: localhost Content-Type: application/soap+xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"> <soap12:Body> <GetSecurityInfo xmlns="http://tempuri.org/"> <Code>string</Code> </GetSecurityInfo> </soap12:Body> </soap12:Envelope> HTTP/1.1 200 OK Content-Type: application/soap+xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"> <soap12:Body> <GetSecurityInfoResponse xmlns="http://tempuri.org/"> <GetSecurityInfoResult> <Code>string</Code> <CompanyName>string</CompanyName> <Price>double</Price> </GetSecurityInfoResult> </GetSecurityInfoResponse> </soap12:Body> </soap12:Envelope>
Это сообщения, закодированные в протоколе SOAP ..NET вроде помещает это в «черный ящик», который вам нужен, чтобы вам не приходилось самим создавать и анализировать SOAP-сообщения.