0

We need to send a combination of XML and a string to a JMS server by concatenating, the payload which we constructed is not xml and ended up being a plain string in mixed format(obviously, ESB will not allow, but is there a way to deal).

Added sample request below,

Data1 = <?PCM LEID_POOLNAME="HOST" HOST_LEID_POOL_NAME="S1PMAPPM" ONE_OFF="no" TransactionName="RESPNRBLDQ" Timeout="30" OnError_getMessage="yes"?>

and

Data2 =

<PLAINUDI>
      <LREC DID="D7E3" DataLength="102">NMM2LXFPAWMJ</LREC>
      <LREC DID="D9D3" DataLength="200">NMM2LXFPAWMJ</LREC>
   </PLAINUDI>

the expected request to be sent to endpoint is like

     **<?PCM LEID_POOLNAME="HOST" 
HOST_LEID_POOL_NAME="S1PMAPPM" ONE_OFF="no" 
TransactionName="RESPNRBLDQ" Timeout="30" OnError_getMessage="yes"?>

    <PLAINUDI>
              <LREC DID="D7E3" DataLength="102">NMM2LXFPAWMJ</LREC>
              <LREC DID="D9D3" DataLength="200">NMM2LXFPAWMJ</LREC>
           </PLAINUDI>**

I tried setting the Content-Type and messageType as text/plain,text/csv but while concatenating the two data (Data1&Data2), the ESB is unable to recognize the format.

Is it achievable?

Please comment if question needs clarification. Thanks in advance.

Community
  • 1
  • 1
  • 1
    The 'expected request' is a well-formed XML (except that the [processing instruction](https://en.wikipedia.org/wiki/Processing_Instruction) node has `?` missing from the end, which I assumed a typo). So you may want to try to send it as XML instead of string (I know nothing about WSO2 ESB though) – har07 Dec 10 '15 at 13:45
  • @har07 please see the edited "expected request". Now this is not a constructed xml as per wso2 standard It needs a root node to process any xml based content. Any help will be much appreciated. – Prabakaran Thodithot Sembiyan Dec 11 '15 at 04:18
  • 1
    As I said, that's well-formed XML. **Processing instruction** (not just arbitrary kind of node) allowed to be placed outside the root element (think of XML comment node if you're more familiar with it) – har07 Dec 11 '15 at 06:15

1 Answers1

0

When you want to send text content with WSO2 ESB, you must create a SOAP Message with the text content as the value for a node <text xmlns="http://ws.apache.org/commons/ns/payload"> in your soap body

Define the messageType so that the ESB choose the appropriate message formatter :

<property name="messageType" value="text/plain" scope="axis2"/>

If there is xml content in your text, you must use a CDATA section

Jean-Michel
  • 5,926
  • 1
  • 13
  • 19
  • Here the problem is, I don't want to send "XML"request to the backend. It expects a payload, as I mentioned. I believe, WSO2 ESB won't allow any XML without a root node, please validate the same. Here the request needs to be like ` some declaration?> ` instead of ` some declaration?> ` – Prabakaran Thodithot Sembiyan Dec 11 '15 at 04:22
  • in text/plain, only the string inside the text node will be send and it can be anything you want : i send flat data in fixed length or csv this way – Jean-Michel Dec 11 '15 at 07:51
  • Yeah it works. Thanks. Will update if I face any other issues. – Prabakaran Thodithot Sembiyan Dec 11 '15 at 08:36