web-servicessoapcxfjboss-eap-7

org.apache.cxf.transport.http.HTTPException: HTTP response '415: Unsupported Media Type'


I am trying to invoke o SOAP web service using an apache CXF client and the error above appears. I tried to fix this by using SOAP12HTTP_BINDING but then the following error occurs:

org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted

The outbound message is the folowing:

Address: myHostName
HttpMethod: POST
Content-Type: text/xml
ExchangeId: myExchangeId
ServiceName: myServiceName
PortName: myPortName
PortTypeName: DummyImpl
Headers: {SOAPAction="mySoapAction",
          Accept=*/*, Host=myHost, 
          Accept-Encoding=gzip,deflate, 
          Content-Type=application/soap+xml;
          charset=UTF-8;action="}
Payload: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:a="myNamespace">
<soapenv:Body>
    <a:operatioName>
        ...
    </a:operatioName>
</soapenv:Body>
</soapenv:Envelope>

Solution

  • Turns out the problem was the Content-Type header, i changed it to text/xml;charset=UTF-8 and it worked.