在本课中,将调用前面课程所创建的包装过程,它会向第一课中创建的 Web 服务器数据库发送请求。有关本课所述的设置客户端数据库以发送请求的信息,请参见第 2 课:设置用于发送 RAW 请求和接收 RAW 响应的 Web 客户端数据库。
本课中包含对 localhost 的引用。如果 Web 客户端与服务器数据库运行在不同的计算机上,则使用第 1 课中服务器数据库的 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 中:
属性 | 值 |
---|---|
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.0.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.0.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.0.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 讨论此页。
|
版权 © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0 |