Creating Web Services and Web Clients
Troubleshooting SOAP Problems in InterSystems IRIS
This chapter provides information to help you identify causes of SOAP problems in InterSystems IRIS. It discusses the following topics:
To identify the cause of a SOAP problem, you typically need the following information:
The WSDL and all external documents to which it refers.
(In the case of message-related problems) Some form of message logging or tracing. You have the following options:
||Usable with SSL/TLS?
||Shows HTTP headers?
|InterSystems IRIS SOAP log
||For security errors, this log shows more detail than is contained in the SOAP fault.
|Web Gateway trace
||For problems with SOAP messages that use MTOM (MIME attachment), it is crucial to see HTTP headers.
|Third-party tracing tools
||Depends on the tool
||Some tracing tools also show lower-level details such as the actual packets being sent, which can be critical when you are troubleshooting.
These options are discussed in the following subsections.
It is also extremely useful to handle faults correctly so that you receive the best possible information. See the chapter “SOAP Fault Handling
To log the SOAP calls made to or from an InterSystems IRIS namespace, set the following nodes of the ^ISCSOAP global in that namespace:
||Specifies kind of logging. Use one of the following values (case-sensitive):
You can also use a string that contains any combination of these values, for example: "iosh"
"i" Log inbound messages
"o" Log outbound messages
"s" Log security information. Note that this option provides more detail than is generally contained in the SOAP fault, which is intentionally vague to prevent follow-on security attacks.
"h" Headers only (no SOAP body). If you use "h" with "i" and/or "o", then the log includes only the SOAP Envelope element and SOAP headers (if any).
||Specifies the complete path and filename of the log file to create.
The log indicates the sender or the recipient as appropriate, so that you can see which web service or client participated in the exchange.
The following shows a partial example of a log file with line breaks added for readability:
01/05/2010 13:27:02 *********************
Output from web client with SOAP action = http://www.mysecureapp.org/GSOAP.AddComplexSecureWS.Add
<?xml version="1.0" encoding="UTF-8" ?>
01/05/2010 13:27:33 *********************
Input to web client with SOAP action = http://www.mysecureapp.org/GSOAP.AddComplexSecureWS.Add
ERROR #6059: Unable to open TCP/IP socket to server localhost:8080
Note the following points:
The CSP Web Gateway Management page enables you to trace HTTP requests and responses. See “Viewing HTTP Trace
” in the Web Gateway Configuration Guide
To test your web service, you can use tracing tools such as Wireshark, ProxyTrace, tcpTrace, XMLSpy, soapUI, or Web Service Studio Express. Some of these tools are free and others are licensed. Note that InterSystems does not make any specific recommendations about these tools; they are listed here for your general information.
Tracing tools enable you to see the actual method call, as well as the response. A tracing session listens on a certain port, shows you the messages it receives there, forwards those messages to a destination port, shows the responses, and forwards the responses to the listening port.
For example, suppose you have a web service at http://localhost:52773/csp/gsop/GSOP.Divide.CLS
And suppose you have a web client that you created to talk to that service. The web client has a LOCATION parameter equal to "http://localhost:52773/csp/gsop/GSOP.Divide.CLS"
To trace messages between the client and service, you need to do two things:
In the tracing tool, start a tracing session that listens on port 8080 (for example) and that uses the destination port 52773.
In the web client, edit the LOCATION parameter to use port 8080 instead of 52773. Then recompile.
Or, in your code that invokes the web client, change the Location property of the web client:
//reset location to port 8080 to enable tracing
Now when you use the web client, the tracing tool intercepts and displays messages between the client and the web service, as shown in the following example:
The top area shows the request sent by the client. The bottom area shows the response sent by the web service.
If you have a problem using the SOAP Wizard (or the %SOAP.WSDL.Reader
class, which the wizard uses), the problem is likely to be one of the following:
The WSDL is protected by SSL. In this case, the wizard issues the following error:
ERROR #6301: SAX XML Parser Error: invalid document structure
while processing Anonymous Stream at line 1 offset 1
You can specify an SSL configuration when using the wizard, but if you have done so, and you receive the preceding error, your SSL configuration is incorrect. You can try accessing the WSDL in another way, downloading it to a file, and using the file WSDL instead.
The WSDL is password protected. In this case, the wizard issues an error like the following (notice that the line and offset vary but are different from the previous scenario):
ERROR #6301: SAX XML Parser Error: Expected entity name for reference
while processing Anonymous Stream at line 10 offset 27
If you receive this error, check whether a password is required; see the comments in “Using the SOAP Wizard
,” earlier in this book.
The WSDL uses elements that are currently inaccessible. In this case, the wizard issues an error like the following:
ERROR #6416: Element 'wsdl:definitions' - unrecognized wsdl element 'porttype'
The key word is unrecognized; this indicates that the WSDL refers to an element that is currently inaccessible. Carefully check the WSDL for <import> and <include> directives.
An import directive might look like this:
In this case, the workaround is as follows:
Download the primary WSDL to a file.
Download the referenced WSDL to a file.
Edit the primary WSDL to refer to the new location of the referenced WSDL.
Similarly, it is possible for a WSDL to refer to other documents via a relative URL. For example:
If you have downloaded the WSDL to a file, this relative reference cannot work. In this case, you must also download the referenced document and edit the WSDL to use its new location.
The WSDL contains <message> elements with multiple parts and uses document-style binding. In this case, the wizard issues the following error:
ERROR #6425: Element 'wsdl:binding:operation:msg:input' - message 'AddSoapOut'
Message Style must be used for document style message with 2 or more parts.
In this case, select the Use unwrapped message format for document style web methods option when you use the wizard.
The WSDL is invalid. In such cases, the SOAP wizard issues an error to indicate the problem. The following shows one example:
ERROR #6419: Element 'wsdl:binding:operation' - inconsistent
soap:namespace for operation getWidgetInfo
This error message indicates a problem with an <operation> element. The following shows a partial example of the invalid WSDL that produced this error:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:part name="getWidgetInfoReturn" type="xsd:string"/>
<wsdl:input message="impl:getWidgetInfoRequest" name="getWidgetInfoRequest"/>
<wsdl:output message="impl:getWidgetInfoResponse" name="getWidgetInfoResponse"/>
<wsdl:binding name="VersionSoapBinding" type="impl:Version">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
In this case, the problem is that the <input> part of <operation> states that the request message (getVersionRequest) is in the namespace "http://acmesubsidiary.com", but the earlier part of the WSDL shows that this message is the target namespace of the web service: "http://acme.acmecorp.biz:9999/widget/services".
Note that an invalid WSDL document can be a valid XML document, so using a pure XML tool to validate the WSDL is not a sufficient test. Some third-party WSDL validation tools are available, and you can also examine the WSDL directly, using information returned by the SOAP wizard.
The WSDL contains features that are not supported in InterSystems IRIS. See the section “Consuming WSDLs
” in the first chapter.
If you have problems when sending SOAP messages to or from an InterSystems IRIS web service or client, consider this list of common scenarios:
The SOAP message might include an extremely long string or binary value, exceeding the string length limit
. In this case, InterSystems IRIS throws one of the following errors:
When the wizard reads a WSDL, it assumes that any string-type input or output can be represented in InterSystems IRIS as %String
. Similarly, it assumes that any input or output with XML type base64Binary can be represented in InterSystems IRIS as %xsd.base64Binary
). There is no information in a WSDL to inform the SOAP Wizard that this input or output could exceed the string length limit
The web service or client might receive WS-Security headers, but not yet be configured to recognize them. This can result in a generic error like the following:
An error like this can also have other causes. If you receive an error like this, first check whether the messages include WS-Security headers; if so, add the following to the web service or client and recompile it:
Also, if InterSystems IRIS generated a security policy (in a configuration class), you might need to edit that policy to provide missing details; see the section “Editing the Generated Policy
” in Securing Web Services
. If you do not do so, you can receive generic errors as given above.
The web service or client might require a more specific message form than should be required, according to the SOAP specifications. (This can occur for a service or client that is not in InterSystems IRIS.) InterSystems has encountered the following scenarios, listed here from (approximately) most common to least common:
The symptoms of these problems depend upon the third-party product in use.
The web service or client might not comply with the WSDL. This should not be possible for an InterSystems IRIS web service or client, but can occur in other scenarios. InterSystems has seen the following scenarios:
To determine whether the service or client complies with the WSDL, compare the messages to the WSDL.
Or, for a third-party web service, to determine whether the web service complies with the WSDL, it is useful to do the following:
Generate a web client using a third-party tool.
Send messages from that web client:
If this is successful, it is likely that the web service does expect and send messages that are consistent with its WSDL, and the cause of the problem is elsewhere. In this case, compare the messages sent by this client to the messages sent by the InterSystems IRIS client.
If this is not successful, it is likely that the web service does not expect or send messages that are consistent with its WSDL.
The web service or client might send messages of a form not supported in InterSystems IRIS. It is useful to examine the WSDL in use and make sure it is supported in InterSystems IRIS; see the section “Consuming WSDLs
” in the first chapter. Note that these details have changed in InterSystems IRIS over time.
Content Date/Time: 2019-10-18 05:16:51