在本课中,将调用在上一课中创建的包装过程,它会向第一课中创建的 Web 服务器发送请求。有关本课所述的设置 Web 客户端以发送请求的详细信息,请参见第 2 课:设置用于发送 RAW 请求和接收 RAW 响应的 Web 客户端。
本课中包含对 localhost 的引用。如果 Web 客户端与 Web 服务器运行在不同的计算机上,则使用第 1 课中 Web 服务器的 IP 地址而不是 localhost。
如果在第二课中没有打开客户端数据库,则在 Interactive SQL 中连接它。
dbisql -c "UID=DBA;PWD=sql;SERVER=echo_client" |
调用该包装过程以发送请求并获得响应。
在 Interactive SQL 中执行以下 SQL 语句:
CALL setMIME('<hello>this is xml</hello>', 'text/xml', 'http://localhost:8082/EchoService' ); |
http://localhost:8082/EchoService 变量表示数据库服务器运行在 localhost 上并监听 8082 端口。所需的 SOAP Web 服务名为 EchoService。
以下结果集显示在 Interactive SQL 中:
Attribute | Value |
---|---|
Status | HTTP/1.1 200 OK |
Body | <hello>this is xml</hello> |
Date | Thu, 04 Feb 2010 13:37:23 GMT |
Connection | close |
Expires | Thu, 04 Feb 2010 13:37:23 GMT |
Content-Type | text/plain; charset=windows-1252 |
Server | SQLAnywhere/12.0.1.1234 |
以下是发送到 Web 服务器的 HTTP 包的代表示例:
POST /EchoService HTTP/1.0 Date: Thu, 04 Feb 2010 13:37:23 GMT Host: localhost Accept-Charset: windows-1252, UTF-8, * User-Agent: SQLAnywhere/12.0.1.1234 Content-Type: text/xml; charset=windows-1252 Content-Length: 49 ASA-Id: 1055532613:echo_client:echo:968000 Connection: close valueAsXML=<hello>this is xml</hello> |
以下是来自 Web 服务器的响应:
HTTP/1.1 200 OK Server: SQLAnywhere/12.0.1.1234 Date: Thu, 04 Feb 2010 13:37:23 GMT Expires: Thu, 04 Feb 2010 13:37:23 GMT Content-Type: text/plain; charset=windows-1252 Connection: close <hello>this is xml</hello> |
![]() |
使用DocCommentXchange讨论此页。
|
版权 © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |