Problem Statement
While invoking any third-party or internal web services which have a soap version either 1.1 or 1.2, then you might face the below error and will not be able to fetch any response back. Although, one might see that the desired invocation has worked end to end successfully still the invoke activity is displaying as failed.
Error observed:
oracle.fabric.common.FabricInvocationException: Unable to invoke endpoint URI “http://hostname:portnumber/desiredEndPointURL ” successfully due to: javax.xml.soap.SOAPException: javax.xml.soap.SOAPException: Not a valid SOAP Content-Type: text/plain; charset=utf-8
Solution
One should observe that in the request and response message the header should contain a Content-Type element having values:
- For SOAP 1.1 the value is text/xml
- For SOAP 1.2 the value is application/soap+xml
Tips on how to change or modify it –
Consider a scenario that SOA composite is invoking an OSB SOAP web service.
Option 1:
If the request message has incorrect Content-Type values, then in your Jdeveloper you can make the below change in the .bpel file.
- Create a global variable with the name Content-Type having data type as string
- Just above the invoke activity, use an Assign activity to assign either ‘text/xml’ or ‘application/soap+xml’ value, depending on your soap version, in Content-Type variable
- In the invoke activity (that is invoking soap 1.1/1.2 version), go to Headers tab and choose the above variable “Content-Type” against Input Header Variable
Option 2:
If the response message has incorrect Content-Type values, then in your OSB console you can make the below change in the proxy service.
- Go to the route or publish stage and in the response action use Set Transport Headers activity
- In the above Set Transport Headers, for the Inbound Response (which is the response to the SOA service) and under Transport Headers choose Content-Type to have value xs:string(“text/xml”) or xs:string(“application/soap+xml”), depending on your soap version
Food for thought – Different third-party can request one to set the Content-Type value to something specific and above are the steps that need to be followed.
