You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Christian Koch (JIRA)" <ji...@apache.org> on 2015/06/01 10:48:18 UTC
[jira] [Created] (CXF-6430) SwA: Wrong Content-Type of root part
Christian Koch created CXF-6430:
-----------------------------------
Summary: SwA: Wrong Content-Type of root part
Key: CXF-6430
URL: https://issues.apache.org/jira/browse/CXF-6430
Project: CXF
Issue Type: Bug
Components: Transports
Affects Versions: 3.0.1
Reporter: Christian Koch
we are implementing an ebMS3 solution using cxf 3. The profile to be implemented has the following requirements:
- SwA (no MTOM)
- SOAP 1.2
- Due to the design of ebMS3 there is no WSDL
As there is no WSDL we use the javax.xml.ws.Dispatch API with SOAPBinding.SOAP12HTTP_BINDING as binding. The message ebMS3 expects, according to its specification looks as follows:
Content-Type: Multipart/Related; boundary=MIME_boundary;
type=application/soap+xml;
start="<ca...@cars.example.com>"
--MIME_boundary
Content-Type: application/soap+xml; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-ID: <ca...@cars.example.com>
<?xml version='1.0' ?>
<S12:Envelope xmlns:S12="http://www.w3.org/2003/05/soap-envelope"
.
.
.
</S12:Envelope>
--MIME_boundary
Content-Type: image/tiff
Content-Transfer-Encoding: binary
Content-ID: <ca...@cars.example.com>
...binary TIFF image of the car...
--MIME_boundary--
However, what we produce is as follows:
Content-Type:multipart/related; type="application/soap+xml"; boundary="MIME_boundary"; start="<ca...@cars.example.com>"; start-info="application/soap+xml"
Accept:*/*
User-Agent:Apache CXF 3.0.1
Cache-Control:no-cache
Pragma:no-cache
Host:127.0.0.1:8080
Connection:keep-alive
--MIME_boundary
Content-Type: text/xml; charset=UTF-8; type="application/soap+xml"
Content-Transfer-Encoding: binary
Content-ID: <ca...@cars.example.com>
<?xml version='1.0' ?>
<S12:Envelope xmlns:S12="http://www.w3.org/2003/05/soap-envelope"
.
.
.
</S12:Envelope>
--MIME_boundary
Content-Type: image/tiff
Content-Transfer-Encoding: binary
Content-ID: <ca...@cars.example.com>
...binary TIFF image of the car...
-- MIME_boundary--
The difference lies in the Content-Type of the root part, which is expected as application/soap+xml but set to text/xml. When testing against an Axis driven implementation we get the following error:
Error while executing the transport Method RuntimeException: Invalid Content-Type: text/xml; charset=UTF-8; type="application/soap+xml"
Our dispatch method looks like this:
public SOAPMessage dispatch(final SOAPMessage soapMessage) {
final QName serviceName = new QName("http://example.com", "msh-dispatch-service");
final QName portName = new QName("http://example.com", "msh-dispatch");
final javax.xml.ws.Service service = javax.xml.ws.Service.create(serviceName);
service.addPort(portName, SOAPBinding.SOAP12HTTP_BINDING, "127.0.0.1:8080");
Dispatch<SOAPMessage> dispatch = service.createDispatch(portName, SOAPMessage.class, javax.xml.ws.Service.Mode.MESSAGE);
Policy policy = policyFactory.parsePolicy("mypolicy.xml");
dispatch.getRequestContext().put(PolicyConstants.POLICY_OVERRIDE, policy);
SOAPMessage result = dispatch.invoke(soapMessage);
return result;
}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)