tailieunhanh - Programming Web Services with SOAPn phần 5

Ví dụ 4-5. Tiện ích chức năng gói Nhà xuất bản, sử dụng POSIX QW (strftime) - Nhà xuất bản:: ISA = QW (SOAP:: Server:: Tham số), sử dụng Digest:: MD5 QW (md5), $ của tôi calculateAuthInfo = sub {return md5 (tham gia '',' duy nhất (chưa liên tục) string ', @ _);}; của tôi $ checkAuthInfo = sub {$ authInfo của tôi thay đổi | Programming Web Services with SOAP Example 5-11. WSDL binding to HTTP-GET wsdl binding name HelloWorldBinding type tns HelloWorldInterface http binding verb GET wsdl operation name sayHello http operation location sayHello wsdl input http urlEncoded wsdl input wsdl output mime content type text plain wsdl output wsdl operation wsdl binding Each of the http and mime prefixed elements specify exactly how the port type is to be implemented. For example the http urlEncoded element indicates that all of the parts of the input message will appear as query string extensions to the service URL. An instance of this binding would appear as http sayHello name John With the response message represented as nothing more than a stream of data with a MIME content type of text plain. HTTP 200 OK Server Microsoft-IIS Content-Type text plain Content-Length 11 Hello James Describing the Location of a Web Service The final piece of information that a WSDL service implementation description must provide is the network location where the web service is implemented. This is done by linking a specific protocol binding to a specific network address in the WSDL service and port elements as shown in Example 5-12. Example 5-12. Linking a binding to a network address wsdl service name HelloWorldService wsdl port name HelloWorldPort binding tns HelloWorldBinding soap address location http localhost 8080 wsdl port wsdl service In this example we see that the Hello World service can be invoked through the use of SOAP messages as defined by the HelloWorldBinding implemented at http localhost 8080. One interesting aspect of WSDL is that a service may define multiple ports each of which may implement a different binding at a different network location. It is possible for example page 89 Programming Web Services with SOAP to create a single WSDL service description for our three Hello World services written in Perl Java and .NET as shown in Example 5-13. Example 5-13. .