xml


Mule soap proxy flow removes/deletes xml declaration


I try to adapt mule "Proxy a SOAP Api Example" to proxing my .NET ASMX Service, so i create a flow like this:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" version="EE-3.7.0"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/current/mule-cxf.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd">
<http:listener-config doc:name="HTTP Listener Configuration" host="127.0.0.1" name="HTTP_Proxy_Listener_Configuration" port="8077"/>
<http:request-config doc:name="HTTP Request Configuration" host="concert.ru" name="HTTP_Request_Configuration" port="80"/>
<flow name="main">
<http:listener config-ref="HTTP_Proxy_Listener_Configuration" doc:name="Receive HTTP Requests From Apps" path="/"/>
<cxf:proxy-service doc:name="Check WSDL" namespace="http://concert.ru/InteropWS/" payload="envelope" port="MobileSoap" service="Mobile" wsdlLocation="http://concert.ru/InteropWS/v2/Mobile.asmx?WSDL" enableMuleSoapHeaders="false"/>
<flow-ref doc:name="Copy HTTP Headers" name="copy-headers"/>
<cxf:proxy-client doc:name="Proxy Client" enableMuleSoapHeaders="false" payload="envelope"/>
<flow-ref name="restore-soapaction" doc:name="restore-soapaction" doc:description="it's important! soap client proxy clear soapaction header"/>
<http:request config-ref="HTTP_Request_Configuration" doc:name="Send Requests to API" method="POST" path="InteropWS/v2/Mobile.asmx"/>
<flow-ref doc:name="Copy HTTP Headers" name="copy-headers"/>
<logger message="#[message.payloadAs(java.lang.String)]" level="INFO" doc:name="Logger"/>
<catch-exception-strategy doc:name="Catch Exception Strategy">
<logger message="new String(#[payload])" level="INFO" doc:name="Logger"/>
</catch-exception-strategy>
</flow>
<sub-flow name="copy-headers">
<copy-properties doc:name="Copy HTTP headers" propertyName="*"/>
<remove-property doc:name="Remove host property" propertyName="Host"/>
<remove-property doc:name="Remove Content Length Header" propertyName="Content-Length"/>
<remove-property doc:name="Remove HTTP synthetic properties" propertyName="http.*"/>
<remove-property doc:name="Remove MULE properties" propertyName="MULE_*"/>
<remove-property doc:name="Remove Connection Header" propertyName="Connection"/>
<remove-property doc:name="Remove Transfer-encoding Header" propertyName="transfer-encoding"/>
</sub-flow>
<sub-flow name="restore-soapaction">
<set-property propertyName="soapaction" value="#[message.inboundProperties["soapaction"]]" doc:name="Property"/>
</sub-flow>
</mule>
So it works and proxing SOAP Envelop but everytime removes the xml declaration from response message body. For example when I send
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetActionInfo xmlns="http://concert.ru/InteropWS/">
<actionId>53463</actionId>
</GetActionInfo>
</soap:Body>
</soap:Envelope>
with Headers SOAPAction: "http://concert.ru/InteropWS/GetActionInfo" to http://localhost:8077 I have
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetActionInfoResponse xmlns="http://concert.ru/InteropWS/">
<GetActionInfoResult>
<RowNum>0</RowNum>
<Id>53463</Id>
<Artist>PIRATE STATION LOVE MOSCOW</Artist>
<Visible>true</Visible>
<Canceled>0</Canceled>
<AllowPrint>true</AllowPrint>
<ETicketEnabled>1</ETicketEnabled>
<TETicketEnabled>1</TETicketEnabled>
<AgeRestrictionsId>5</AgeRestrictionsId>
<ActionPlaceID>1321</ActionPlaceID>
<ActionPlaceName>Stadium-live</ActionPlaceName>
<CounterAgentId>1515</CounterAgentId>
<CounterAgentName>Росдэнс ООО</CounterAgentName>
<ActionTypeID>7</ActionTypeID>
<DateList>
<dateTime>2015-10-17T22:00:00</dateTime>
</DateList>
<DescriptionFull>Пиратская Станция "Love". Москва<br/>17 октября, 22:00<br/>Stadium Live<br/>Москва, Ленинградский пр-т, д.80 корп.17<br/>18+<br/><br/>Крупнейший drum&bass-фестиваль планеты от Радио Рекорд — Пиратская Станция — представит в Москве свою 13-ю постановку под названием "Love".<br/><br/>Вслед за грандиозной премьерой в Санкт-Петербурге постановка "Love" расскажет трагическую историю любви по мотивам произведения "Ромео и Джульетта" Уильяма Шекспира под сеты ведущих drum&bass-диджеев планеты.<br/><br/>Пиратская Станция "Love" — это потрясающее размахом театрально-цирковое шоу на земле и в воздухе, завораживающие спецэффекты, удивительные костюмы, внушительные декорации и фирменный череп в наушниках в центре постановки — неизменный символ фестиваля.<br/><br/><b>Категории билетов:<br/>Dancefloor</b> — доступ на танцпол, в Вашем распоряжении будут все бары на арене, ресторан и гардероб, а если Вы придете раньше, то займете место перед сценой ближе всех к необыкновенному шоу<br/><b>Deluxe</b> — все привилегии Dancefloor, отдельный вход и гардероб, вход на эксклюзивный VIP-балкон с замечательным видом на сцену, отдельные бары<br/><b>Gold</b> — все привилегии Gold, место за столиком на одном из ярусов каскадной части VIP-балкона с премиальным видом на сцену и индивидуальным обслуживанием официантами, отдельный вход и гардероб<br/><b>Ложа</b> — персональный вход и сопровождение хостесс, панорамный вид на сцену и мероприятие в целом, персональное обслуживание официантами, алкогольные и безалкогольные напитки, фрукты и снэки, одно парковочное место<br/></DescriptionFull>
<Description>Пиратская Станция "Love". Москва<br/>17 октября, 22:00<br/>Stadium Live<br/>Москва, Ленинградский</Description>
<Coordinates>м.Сокол, Ленинградский проспект д.80 стр.17</Coordinates>
<ActionTypeName>Клубы</ActionTypeName>
<GenreTypeName>Электронная музыка</GenreTypeName>
<CityName>Москва</CityName>
<Latitude>55.808025</Latitude>
<Longitude>37.510773</Longitude>
</GetActionInfoResult>
</GetActionInfoResponse></soap:Body></soap:Envelope>
However in the log message(last in the flow) I can see xml declaration in the payload.
How can I configure mule not to remove the xml declaration from response?
You can add the missing data to the header using the following tag
<set-payload value="#['<?xml version="1.0" encoding="utf-8"?>']#[payload]" doc:name="Set Payload"/>
This works for me and I have tested this using the below code.
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8082" doc:name="HTTP Listener Configuration"/>
<flow name="testFlow1" >
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
<byte-array-to-string-transformer doc:name="Byte Array to String"/>
<set-payload value="#['<?xml version="1.0" encoding="utf-8"?>']#[payload]" doc:name="Set Payload"/>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
</flow>
Let me know if this helps

Related Links

What is iOS mobile config equivalent in android, Do we have a config utility
xml file changes its characters when copying from excel
how to create XML file using visual basic
How to get SOAP XML request / response documents in Spring WS?
Split XML file using XSLT 1.0 based on Number of Nodes as counter a value
XMLParser has problems reading UTF8 characters
Using XSLT to create DITA to XML output multiple same element comes under child element to a parent element
Getting “This XML file does not appear to have any style information associated with it” on basic convert
Angular2: Work correctly with XML REST response
how to show archived task in many2many tree view on another model in Odoo9?
how to add pdf file to xslt as html
How to copy child element n times in XML file using XSLT
Generating Flat file output in specific order using XSLT
Passing list of key-value elements to custom JMS Appender
Google Script Export Spreadsheet to XML File
How to get rid of attribute when it has no value, while transforming my XML using XSLT

Categories

HOME
forms
phpmyadmin
zend-framework
fftw
pclxl
appcelerator
ms-access-2016
newrelic
maxscript
google-admin-sdk
odoo-8
categorical-data
keytool
esoteric-languages
vuejs
template-engine
foreign-keys
sse
microsoft-ocr
imagemap
jquery-callback
itunes
nstimer
android-maps
uitapgesturerecognizer
alm
userdefaults
dst
code-snippets
jwplayer6
servicestack-text
engine.io
swagger-php
reason
dcmtk
ssrs-2014
apache-directory
uiimage
linter
automapper-5
manova
android-testing
cup
cmp
gets
flex-monkey
resourcemanager
http-status-code-401
cfchart
mobiledoc-kit
iokit
wiredep
fuelcms
opserver
page.js
coda
eoferror
sql-server-data-tools
dnssec
actionfilterattribute
mass-assignment
viewer
machine-instruction
cbind
rmysql
mobility
angular-carousel
named-parameters
ss7
ora-00904
live555
winginx
wxformbuilder
ios8-extension
spring-3
inputmismatchexception
windows-phone-8-sdk
mongohq
poker
dolby-audio-api
cascadingdropdown
argouml
infobright
webdev.webserver
silent
drupal-fivestar
ajax-polling
skype4java
feasibility
interop-domino
software-lifecycle
application-planning
sqlobject

Resources

Encrypt Message