Reputation: 143
I'm trying to send SOAP envelope with standard mule HTTP Request and I'm having trouble with setting Media-Type of an outbound request. The webservice expects "application/soap+xml", but setting 'Content-Type: application/soap+xml' header in POST Request or setting mime-type to payload doesn't seem to work. I keep getting error 415 - unsupported media type. Does anybody have any idea what can I do to resolve this issue? My XML code so far (I've changed names and addresses, the idea stays the same):
<flow name="get-report">
<http:listener config-ref="asdf-httpListenerConfig" path="/" doc:name="HTTP"/>
<custom-transformer encoding="UTF-8" mimeType="application/soap+xml" class="Authorization" doc:name="Java"/>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
<http:request config-ref="HTTP_Request_Configuration" path="path.svc" method="POST" doc:name="HTTP">
<http:request-builder>
<http:header headerName="Content-Type" value="application/soap+xml"/>
<http:header headerName="action" value="someAction"/>
<http:header headerName="host" value="someHost"/>
</http:request-builder>
</http:request>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
</flow>
The 'Authorization' transformer isn't really relevant, right now I just hardcode entire envelope and return it. Also, POST'ing an envelope via soapUI with the same addresses, content type and media-type works fine.
Upvotes: 0
Views: 806
Reputation: 81
Setting the header in the http:request should definitely set the Content-Type header, so i would suggest this is not the issue. Though it is dependant on the API implementation, 415 Unsupported Media Type can be caused by the requests Content-Type, Content-Encoding or by inspecting the data directly. Perhaps it could be caused by the XML structure.
Upvotes: 0