虽然清单13中的代码看起来似乎不错,但是还有一个问题——如果服务器响应请求并完成了处理但是报告了一个错误怎么办?
Despite the apparent success of the code in Listing 13, there's still a problem — what if the server responds to your request and finishes processing, but reports an error?
例如,可能服务器获取了该消息并且正确地进行了处理,但是在试图处理响应消息的时候发生了一些错误。
As an example, perhaps the server receives the message and processes it correctly, but something goes wrong while trying to process the response message.
当接收到响应的时候,错误检查机制能够保证服务器方面成功执行了任务。
When the response is received, error checking ensures that the server succeeded.
如果一个SOAP消息中有错误,您将会从Web服务服务器得到一个HTTP响应码:500。
If something is wrong in a SOAP message, you will receive a HTTP response code: 500 from a Web Service server.
如果没有提供回调函数,那么send函数阻塞,一直等到服务器响应到达,或者引发HTTP错误。
If there was no callback function provided, the send function blocks and waits until the server response arrives, or else it raises HTTP errors.
这个Web服务服务器可能发现不了这个拼写错误的标准,而在SOAP响应消息中返回给您一个默认值,如公司A股票价格。
The Web Services server could disregard the misspelled tags and provide you with a default value such as the stock quote of company a in a SOAP response message.
另一个CXF错误也出现在使用addBook 操作时,但这次是在请求失败时,返回的应用程序错误响应应该使用加密,但是 CXF 服务器发送它时不使用加密,而且客户端也毫无异议地接受了。
The other CXF error was the same as Axis2, not using encryption for the application fault response.
这几行代码确保来自服务器的结果和错误被路由回响应器——在这种情形下,给命令类。
These lines ensure that the results and faults from the server are routed back to the responder-in this case to the Command class.
服务器从多个客户端接收请求并且向X客户端返回请求信息的响应,用户输入或错误。
The X server accepts requests from multiple clients and returns to the X client replies for information requests, user input and errors.
除非响应的是一个HEAD请求,否则服务器就应该返回一个解释当前错误状况的实体,以及这是临时的还是永久性的状况。 这些状态码适用于任何请求方法。
Except when responding to a HEAD request, the server shouldinclude an entity containing an explanation of the error situation, and whether it is a temporary or permanent condition.
如果客户端发布异常,那么错误的响应从服务器到客户端。
If the client issued the exception, then the error was in the response from the server to the client.
当服务器响应一个错误。
由于软错误不能由服务器实例直接检测到,因此,可能导致服务器实例不确定地等待某个响应。
Because soft errors are not detectable directly by a server instance, a soft error could potentially cause a server instance to wait indefinitely.
由于软错误不能由服务器实例直接检测到,因此,可能导致服务器实例不确定地等待某个响应。
Because soft errors are not detectable directly by a server instance, a soft error could potentially cause a server instance to wait indefinitely.
应用推荐