The namespace URI specifies the XML namespace used to compose the SOAP request envelope for the given SOAP operation. The domain component from URL clause is used when the namespace URI is not defined.
The server-side SOAP processor uses this URI to understand the names of the various entities in the message body of the request. The NAMESPACE clause of the CREATE PROCEDURE and CREATE FUNCTION statements specifies the namespace URI.
You may be required to specify a namespace URI before procedure calls succeed. This information is usually explained the public web server documentation, but you can obtain the required namespace URI from the WSDL available from the web server. You can generate a WSDL by accessing the DISH service if you are trying to communicate with a SQL Anywhere web server.
Generally, the NAMESPACE can be copied from the targetNamespace attribute specified at the beginning of the WSDL document within the wsdl:definition element. Be careful when including any trailing '/', as they are significant. Secondly, check for a soapAction attribute for the given SOAP operation. It should correspond to the SOAPAction HTTP header that would be generated as explained in the following paragraphs.
The NAMESPACE clause fulfills two functions. It specifies the namespace for the body of the SOAP envelope, and, if the procedure has TYPE 'SOAP:DOC' specified, it is used as the domain component of the SOAPAction HTTP header.
The following example illustrates the use of the NAMESPACE clause:
CREATE FUNCTION an_operation(a_parameter LONG VARCHAR) RETURNS LONG VARCHAR URL 'http://wsdl.domain.com/fictitious.asmx' TYPE 'SOAP:DOC' NAMESPACE 'http://wsdl.domain.com/' |
Execute the following SQL statement in Interactive SQL:
SELECT an_operation('a_value'); |
The statement generates a SOAP request similar to the following output:
POST /fictitious.asmx HTTP/1.0 SOAPAction: "http://wsdl.domain.com/an_operation" Host: wsdl.domain.com Content-Type: text/xml Content-Length: 387 Connection: close <?xml version="1.0"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://wsdl.domain.com/"> <SOAP-ENV:Body> <m:an_operation> <m:a_parameter>a_value</m:a_parameter> </m:an_operation> </SOAP-ENV:Body> </SOAP-ENV:Envelope> |
The namespace for the prefix 'm' is set to http://wsdl.domain.com/ and the SOAPAction HTTP header specifies a fully qualified URL for the SOAP operation.
The trailing slash is not a requirement for correct operation of SQL Anywhere but it can cause a response failure that is difficult to diagnose. The SOAPAction HTTP header is correctly generated regardless of the trailing slash.
When a NAMESPACE is not specified, the domain component from the URL clause is used as the namespace for the SOAP body, and if the procedure is of TYPE 'SOAP:DOC', it is used to generate the HTTP SOAPAction HTTP header. If in the above example the NAMESPACE clause is omitted, then http://wsdl.domain.com is used as the namespace. The subtle difference is that a trailing slash '/' is not present. Every other aspect of the SOAP request, including the SOAPAction HTTP header would be identical to the above example.
The NAMESPACE clause is used to specify the namespace for the SOAP body as described for the SOAP:DOC case above. However, the SOAPAction HTTP header is generated with an empty value: SOAPAction: ""
When using the SOAP:DOC request type, the namespace is also used to compose the SOAPAction HTTP header.
Discuss this page in DocCommentXchange.
|
Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |