soap-errorscontent-typeauth

Content Type text/html; charset=utf-8 was not supported by service の正体

SOAPless Team3 min read

このエラーは SOAP パース失敗に見えますが、実際には SOAP response が返ってきていないことが多いです。

Content Type text/html; charset=utf-8 was not supported by service

クライアントは XML を期待していましたが、返ってきたのは HTML です。

HTML が返る典型例

  • ログインページ
  • 404 ページ
  • リバースプロキシの 502 / 503 ページ
  • SSO ゲートウェイの警告画面

最初にやること

クライアント例外ではなく、生の response body を見てください。

curl -i https://example.com/service.svc

<!DOCTYPE html><html> が見えたら、SOAP レイヤー以前の問題です。

よくある原因

1. URL が違う

WSDL URL に SOAP request を送っているケースです。

誤り:

https://example.com/service.svc?wsdl

正しいことが多い:

https://example.com/service.svc

WSDL の <soap:address location="..."> を確認してください。

2. ログイン画面へリダイレクトされている

curl -I https://example.com/service.svc

302 FoundLocation: /login が出るなら、認証やゲートウェイの問題です。

3. プロキシやロードバランサーが HTML を返している

upstream 障害時に HTML エラーページを返す構成は珍しくありません。

確認ポイント

  1. 最終的な endpoint URL
  2. redirect の有無
  3. Basic Auth や custom header
  4. クライアント証明書の要否
  5. SOAP 1.1 / 1.2 の違い
curl -vk https://example.com/service.svc \
  -H 'Content-Type: text/xml; charset=utf-8' \
  -H 'SOAPAction: "http://tempuri.org/GetUser"' \
  --data @request.xml

-v を付けると redirect や gateway が見えやすくなります。

title タグを見る

HTML が返っているなら、<title> の一行で原因が見えることがあります。

  • Sign in
  • Access denied
  • 404 Not Found
  • Bad Gateway

SOAP クライアントの抽象化を追うより、HTML の正体を先に確定した方が早いです。