CodeOverLord
CodeOverLord

Reputation: 11

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

I am trying to call an external webservice running outside my machine and i have written the rout logic using camel framework

Routing Code:

from("direct:test1").process(new Processor() {                                       
    @Override
    public void process(Exchange arg0) throws Exception {
        arg0.getOut().setBody("testmessage");
    }
}).to("cxf://http://localhost:8085/FinEdge-General/xrmServices/2011/Organization.svc?serviceClass=com.hcl.flsl.integration.msdn.crmwcf.IOrganizationService&defaultOperationName=Retrieve")  

But when i execute the program i am getting the below error.

Error

org.apache.cxf.transport.http.HTTPException: HTTP response '415: Cannot process the message because the content type 'text/xml; charset=UTF-8' was not the expected type 'application/soap+xml; charset=utf-8'.' when communicating with \\http://localhost:port/FinEdge-General/xrmServices/2011/Organization.svc

Note: Webservice is developed in .NET(WCF) and SOAP 1.2.

Upvotes: 1

Views: 3060

Answers (2)

TSSK
TSSK

Reputation: 209

As @Willem Jiang mentioned, you have to change the SOAP version to 1.2 . I do it programmatically:

service = Service.create("your service name");
service.addPort("your port", SOAPBinding.SOAP12HTTP_BINDING, "your url");

Upvotes: 0

Willem Jiang
Willem Jiang

Reputation: 3291

It looks like the CXF is sending the message with SOAP 1.1, you need to let it switch to SOAP 1.2 by apply the WSDL file as the serviceClass you use is not has that information.

BTW, you can find difference between the SOAP 1.1 message and SOAP 1.2 message here.

Upvotes: 1

Related Questions