Hi,
I believe cxf already set correct contentType as "text/xml", and per
the discussion here[1], as you use cxf with mule, isn't text/plain
added by MuleConduit later on?
Anyway, you can set contentType from cxf client proxy, code like
Client client = org.apache.cxf.frontend.ClientProxy.getClient(port);
HTTPConduit http = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setContentType("text/xml");
http.setClient(httpClientPolicy);
Not sure if later on mule code would change the contentType to
something else, you can give it a try.
[1]http://cxf.547215.n5.nabble.com/Calling-a-NET-Service-with-CXF-client-td3273931.html
Freeman
On 2010-12-15, at 上午7:46, Suneet Shah wrote:
Hello,
I am trying to call a remote service that was implemented
using .NET. It was complaining that the content type being sent to
it was "text/plain" as opposed to "text/xml"
I used Wireshark to troubleshoot this and can confirm that the
content type is infact - text/plain.
How can I resolve this? I am using CXF in Mule 3.01
My client code is pasted below.
QName SERVICE_NAME = new QName(connector.getServiceUrl());
QName PORT_NAME = new
QName(connector.getServiceNameSpace(),connector.getServicePort());
Service service = Service.create(SERVICE_NAME);
service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING,
connector.getServiceUrl());
ConnectorService port = service.getPort(new
QName(connector.getServiceNameSpace(),
connector.getServicePort()),
ConnectorService.class);
return port;
Log from Wireshark:
POST /ServiceHost/ActiveDirectoryConnector.svc HTTP/1.1\r\n
Expert Info (Chat/Sequence): POST /ServiceHost/
ActiveDirectoryConnector.svc HTTP/1.1\r\n
Message: POST /ServiceHost/ActiveDirectoryConnector.svc HTTP/1.1\r\n
Severity level: Chat
Group: Sequence
Request Method: POST
Request URI: /ServiceHost/ActiveDirectoryConnector.svc
Request Version: HTTP/1.1
X-MULE_ENDPOINT: http://win2003.iamdev.local/ServiceHost/ActiveDirectoryConnector.svc
\r\n
http.disable.status.code.exception.check: true\r\n
User-Agent: Jakarta Commons-HttpClient/3.1\r\n
Host: win2003.iamdev.local\r\n
[truncated] Cookie: $Version=0;
MULE_SESSION
=
rO0ABXNyACNvcmcubXVsZS5zZXNzaW9uLkRlZmF1bHRNdWxlU2Vzc2lvbi7rdtEW7GGKAwAEWgAFdmFsaWRMAAJpZHQAEkxqYXZhL2xhbmcvU3RyaW5nO0wACnByb3BlcnRpZXN0AA9MamF2YS91dGlsL01hcDtMAA9zZWN1cml0eUNvbnRleHR0ACdMb3JnL2
Transfer-Encoding: chunked\r\n
Content-Type: text/plain\r\n
thank you for your help
suneet
--
Freeman Fang
------------------------
FuseSource: http://fusesource.com
blog: http://freemanfang.blogspot.com
twitter: http://twitter.com/freemanfang
Apache Servicemix:http://servicemix.apache.org
Apache Cxf: http://cxf.apache.org
Apache Karaf: http://karaf.apache.org
Apache Felix: http://felix.apache.org