I've written an ASMX web service, which has been running in production for years. Today, all of a sudden the Java clients are throwing errors when trying to parse the response. We tracked it down to a BOM (Byte Order Mark) appearing before the XML declaration:
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: text/xml; charset=utf-8
Content-Encoding: gzip
Expires: -1
Vary: Accept-Encoding
Server: Microsoft-IIS/7.0
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
MicrosoftSharePointTeamServices: 12.0.0.6300
Date: Wed, 22 Jun 2011 19:59:49 GMT
Content-Length: 3629
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap...
The code hasn't changed in over a year. The web service runs under the MOSS 2007 Site in IIS, as you can see from the HTTP header above, but has its own web.config.
There have not been any major changes to the configuration of the server, as far as we can tell, but it must have been something. Any ideas what may have caused this?
If we can't track down and revert the change, the next question is, can I fix this in my code?
It's a vanilla ASMX web service with the .asmx file which looks like this:
<%@ WebService Language="c#" Codebehind="MyStuff.asmx.cs" Class="MyStuff.MyService" %>
and .asmx.cs file which looks like this:
public class MyService : System.Web.Services.WebService {
...
[WebMethod(CacheDuration = 30, Description = "This does something", MessageName = "GetMyStuff")]
public XmlDocument GetMyStuff(string param) {
return doGetStuff(param)
}
private XmlDocument doGetStuff(string param) {
...
}
}
I've seen some posts which talk about the BOM issue, but since I'm just returning an XML document and the framework is taking care of streaming back to the client, I'm not sure if I can do anything about it.
Update: I found that the BOM issues does NOT exist on our stage server. What could be another clue is; when soapUI shows the raw response from prod, it has the BOM and the SOAP XML looks formatted (multi-line and indented). When I look on stage, there is no BOM and the whole response is on a single line. So other was also added with the BOM.
Tracked the problem down to the following entry in web.config:
<webServices>
<soapExtensionTypes>
<add type="Cognos.Portal.Services.SoapPatchExtension, Cognos.BI.WebPart, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cb3c72729d0875cd" priority="1" group="0" />
</soapExtensionTypes>
</webServices>
It was a configuration added as part of a Cognos Web Part rollout which was then commented out. For some reason, SharePoint decided to put it back in.
Further reading suggest that the fix is to "Upgrade to IBM Cognos Business Intelligence 10.1 Fix Pack 1."
Also, at the same time users reported that the Edit in Datasheet and Export to Excel features of SharePoint broke. It's the same root cause.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With