xmlwso2esbpayloadwso2-data-services-server

Getting Error " while building message, Unexpected close tag </body>; expected </HR> "in esb after building xml payload to pass in dss endpoint wso2


I am getting below error in esb after building xml payload to pass in dss endpoint wso2.

ERROR {org.apache.synapse.mediators.base.SequenceMediator} -  Error while building message {org.apache.synapse.mediators.base.SequenceMediator}
org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxParsingException: Unexpected close tag </body>; expected </HR>.
 at [row,col {unknown-source}]: [37,187]
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
    at org.apache.axiom.om.impl.llom.OMSerializableImpl.build(OMSerializableImpl.java:78)
    at org.apache.axiom.om.impl.llom.OMElementImpl.build(OMElementImpl.java:722)
    at org.apache.axiom.om.impl.llom.OMElementImpl.detach(OMElementImpl.java:700)
    at org.apache.axiom.om.impl.llom.OMNodeImpl.setParent(OMNodeImpl.java:105)
    at org.apache.axiom.om.impl.llom.OMElementImpl.addChild(OMElementImpl.java:296)
    at org.apache.axiom.om.impl.llom.OMElementImpl.addChild(OMElementImpl.java:212)
    at org.apache.axiom.soap.impl.llom.SOAPBodyImpl.addChild(SOAPBodyImpl.java:231)
    at org.apache.axis2.transport.TransportUtils.createSOAPEnvelope(TransportUtils.java:161)
    at org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:146)
    at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:100)
    at org.apache.synapse.mediators.AbstractListMediator.buildMessage(AbstractListMediator.java:140)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:83)
    at org.apache.synapse.mediators.eip.splitter.IterateMediator.mediate(IterateMediator.java:256)
    at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:267)
    at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.mediateFromContinuationStateStack(Axis2SynapseEnvironment.java:766)
    at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:282)
    at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:554)
    at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:188)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
    at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:261)
    at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:748)

My XML payload is

TID: [-1234] [] [2017-07-04 10:29:08,141]  INFO {org.apache.synapse.mediators.builtin.LogMediator} -  To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:4784a7be-95f8-4752-bdd2-e29fe8aedcaf, Direction: request, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><p:_getjacdevice_batch_req xmlns:p="http://ws.wso2.org/dataservice">
  <_getjacdevice xmlns="http://ws.wso2.org/dataservice">
    <xs:JACDeviceId xmlns:xs="http://ws.wso2.org/dataservice">215766</xs:JACDeviceId>
    <xs:Make xmlns:xs="http://ws.wso2.org/dataservice">HP</xs:Make>
    <xs:Model xmlns:xs="http://ws.wso2.org/dataservice">HP COLOR LASERJET CP4520 SERIES</xs:Model>
    <xs:SerialNumber xmlns:xs="http://ws.wso2.org/dataservice">JPDXG57J7Y</xs:SerialNumber>
    <xs:IPv4 xmlns:xs="http://ws.wso2.org/dataservice">xx</xs:IPv4>
    <xs:MAC xmlns:xs="http://ws.wso2.org/dataservice">C4346B197FBC</xs:MAC>
    <xs:Hostname xmlns:xs="http://ws.wso2.org/dataservice">xxx</xs:Hostname>
    <xs:FirstScanDate xmlns:xs="http://ws.wso2.org/dataservice">2017-07-04T04:16:16Z</xs:FirstScanDate>
    <xs:LastScanDate xmlns:xs="http://ws.wso2.org/dataservice">2017-07-04T04:16:16Z</xs:LastScanDate>
    <xs:Managed xmlns:xs="http://ws.wso2.org/dataservice">1</xs:Managed>
    <xs:LastAttemptedContactTime xmlns:xs="http://ws.wso2.org/dataservice">2017-07-04T04:16:16Z</xs:LastAttemptedContactTime>
    <xs:CredentialProfileStatus xmlns:xs="http://ws.wso2.org/dataservice">HP COLOR LASERJET CP4520 SERIES</xs:CredentialProfileStatus>
    <xs:JACCredentialProfileId xmlns:xs="http://ws.wso2.org/dataservice">11</xs:JACCredentialProfileId>
    <xs:FirmwareVersion xmlns:xs="http://ws.wso2.org/dataservice">HP COLOR LASERJET CP4520 SERIES</xs:FirmwareVersion>
    <xs:FirmwareDateCode xmlns:xs="http://ws.wso2.org/dataservice">HP COLOR LASERJET CP4520 SERIES</xs:FirmwareDateCode>
    <xs:JACAccountID xmlns:xs="http://ws.wso2.org/dataservice">3113</xs:JACAccountID>
  </_getjacdevice>
<_getjacdevice xmlns="http://ws.wso2.org/dataservice">
    <xs:JACDeviceId xmlns:xs="http://ws.wso2.org/dataservice">224986</xs:JACDeviceId>
    <xs:Make xmlns:xs="http://ws.wso2.org/dataservice">HP</xs:Make>
    <xs:Model xmlns:xs="http://ws.wso2.org/dataservice">HP PAGEWIDE PRO MFP 777HC</xs:Model>
    <xs:SerialNumber xmlns:xs="http://ws.wso2.org/dataservice">MY73H5E00H</xs:SerialNumber>
    <xs:IPv4 xmlns:xs="http://ws.wso2.org/dataservice">xxx</xs:IPv4>
    <xs:MAC xmlns:xs="http://ws.wso2.org/dataservice">30E171F53085</xs:MAC>
    <xs:Hostname xmlns:xs="http://ws.wso2.org/dataservice">xx</xs:Hostname>
    <xs:FirstScanDate xmlns:xs="http://ws.wso2.org/dataservice">2017-07-04T03:32:30Z</xs:FirstScanDate>
    <xs:LastScanDate xmlns:xs="http://ws.wso2.org/dataservice">2017-07-04T03:32:30Z</xs:LastScanDate>
    <xs:Managed xmlns:xs="http://ws.wso2.org/dataservice">1</xs:Managed>
    <xs:LastAttemptedContactTime xmlns:xs="http://ws.wso2.org/dataservice">2017-07-04T03:32:30Z</xs:LastAttemptedContactTime>
    <xs:CredentialProfileStatus xmlns:xs="http://ws.wso2.org/dataservice">HP PAGEWIDE PRO MFP 777HC</xs:CredentialProfileStatus>
    <xs:JACCredentialProfileId xmlns:xs="http://ws.wso2.org/dataservice">11</xs:JACCredentialProfileId>
    <xs:FirmwareVersion xmlns:xs="http://ws.wso2.org/dataservice">HP PAGEWIDE PRO MFP 777HC</xs:FirmwareVersion>
    <xs:FirmwareDateCode xmlns:xs="http://ws.wso2.org/dataservice">HP PAGEWIDE PRO MFP 777HC</xs:FirmwareDateCode>
    <xs:JACAccountID xmlns:xs="http://ws.wso2.org/dataservice">3113</xs:JACAccountID>
  </_getjacdevice>
</p:_getjacdevice_batch_req></soapenv:Body></soapenv:Envelope> {org.apache.synapse.mediators.builtin.LogMediator}

My DSS endpoint is expecting request as below

<body>
   <p:_getjacdevice_batch_req xmlns:p="http://ws.wso2.org/dataservice">
      <!--1 or more occurrences-->
      <_getjacdevice xmlns="http://ws.wso2.org/dataservice">
         <!--Exactly 1 occurrence-->
         <xs:JACDeviceId xmlns:xs="http://ws.wso2.org/dataservice">1</xs:JACDeviceId>
         <!--Exactly 1 occurrence-->
         <xs:Make xmlns:xs="http://ws.wso2.org/dataservice">HP</xs:Make>
         <!--Exactly 1 occurrence-->
         <xs:Model xmlns:xs="http://ws.wso2.org/dataservice">HP CM8060 Color MFP</xs:Model>
         <!--Exactly 1 occurrence-->
         <xs:SerialNumber xmlns:xs="http://ws.wso2.org/dataservice">SerialNumberZ</xs:SerialNumber>
         <!--Exactly 1 occurrence-->
         <xs:IPv4 xmlns:xs="http://ws.wso2.org/dataservice">IPV4z</xs:IPv4>
         <!--Exactly 1 occurrence-->
         <xs:MAC xmlns:xs="http://ws.wso2.org/dataservice">MACZZ</xs:MAC>
         <!--Exactly 1 occurrence-->
         <xs:Hostname xmlns:xs="http://ws.wso2.org/dataservice">HOST NAMEZ</xs:Hostname>
         <!--Exactly 1 occurrence-->
         <xs:FirstScanDate xmlns:xs="http://ws.wso2.org/dataservice">2017-06-06 10:33:42.773</xs:FirstScanDate>
         <!--Exactly 1 occurrence-->
         <xs:LastScanDate xmlns:xs="http://ws.wso2.org/dataservice">2017-06-06 10:33:42.773</xs:LastScanDate>
         <!--Exactly 1 occurrence-->
         <xs:Managed xmlns:xs="http://ws.wso2.org/dataservice">1</xs:Managed>
         <!--Exactly 1 occurrence-->
         <xs:LastAttemptedContactTime xmlns:xs="http://ws.wso2.org/dataservice">2017-06-06 10:33:42.773</xs:LastAttemptedContactTime>
         <!--Exactly 1 occurrence-->
         <xs:CredentialProfileStatus xmlns:xs="http://ws.wso2.org/dataservice">aa</xs:CredentialProfileStatus>
         <!--Exactly 1 occurrence-->
         <xs:JACCredentialProfileId xmlns:xs="http://ws.wso2.org/dataservice">1</xs:JACCredentialProfileId>
         <!--Exactly 1 occurrence-->
         <xs:FirmwareVersion xmlns:xs="http://ws.wso2.org/dataservice">bb</xs:FirmwareVersion>
         <!--Exactly 1 occurrence-->
         <xs:FirmwareDateCode xmlns:xs="http://ws.wso2.org/dataservice">cc</xs:FirmwareDateCode>
         <!--Exactly 1 occurrence-->
         <xs:JACAccountID xmlns:xs="http://ws.wso2.org/dataservice">3113</xs:JACAccountID>
      </_getjacdevice>
      <_getjacdevice xmlns="http://ws.wso2.org/dataservice">
         <xs:JACDeviceId xmlns:xs="http://ws.wso2.org/dataservice">9</xs:JACDeviceId>
         <!--Exactly 1 occurrence-->
         <xs:Make xmlns:xs="http://ws.wso2.org/dataservice">HPjj</xs:Make>
         <!--Exactly 1 occurrence-->
         <xs:Model xmlns:xs="http://ws.wso2.org/dataservice">HP CM8060 Color MFP20000</xs:Model>
         <!--Exactly 1 occurrence-->
         <xs:SerialNumber xmlns:xs="http://ws.wso2.org/dataservice">SerialNumberkkZ</xs:SerialNumber>
         <!--Exactly 1 occurrence-->
         <xs:IPv4 xmlns:xs="http://ws.wso2.org/dataservice">IPV4zjj</xs:IPv4>
         <!--Exactly 1 occurrence-->
         <xs:MAC xmlns:xs="http://ws.wso2.org/dataservice">MACZZjj</xs:MAC>
         <!--Exactly 1 occurrence-->
         <xs:Hostname xmlns:xs="http://ws.wso2.org/dataservice">HOST NAMEjjZ</xs:Hostname>
         <!--Exactly 1 occurrence-->
         <xs:FirstScanDate xmlns:xs="http://ws.wso2.org/dataservice">2017-06-06 10:33:42.773</xs:FirstScanDate>
         <!--Exactly 1 occurrence-->
         <xs:LastScanDate xmlns:xs="http://ws.wso2.org/dataservice">2017-06-06 10:33:42.773</xs:LastScanDate>
         <!--Exactly 1 occurrence-->
         <xs:Managed xmlns:xs="http://ws.wso2.org/dataservice">1</xs:Managed>
         <!--Exactly 1 occurrence-->
         <xs:LastAttemptedContactTime xmlns:xs="http://ws.wso2.org/dataservice">2017-06-06 10:33:42.773</xs:LastAttemptedContactTime>
         <!--Exactly 1 occurrence-->
         <xs:CredentialProfileStatus xmlns:xs="http://ws.wso2.org/dataservice">aa</xs:CredentialProfileStatus>
         <!--Exactly 1 occurrence-->
         <xs:JACCredentialProfileId xmlns:xs="http://ws.wso2.org/dataservice">1</xs:JACCredentialProfileId>
         <!--Exactly 1 occurrence-->
         <xs:FirmwareVersion xmlns:xs="http://ws.wso2.org/dataservice">bb</xs:FirmwareVersion>
         <!--Exactly 1 occurrence-->
         <xs:FirmwareDateCode xmlns:xs="http://ws.wso2.org/dataservice">cc</xs:FirmwareDateCode>
         <!--Exactly 1 occurrence-->
         <xs:JACAccountID xmlns:xs="http://ws.wso2.org/dataservice">3113</xs:JACAccountID>
      </_getjacdevice>
   </p:_getjacdevice_batch_req>
</body>

Solution

  • I got it working by adding below line before calling my endpoint.

    <property name="messageType" scope="axis2" type="STRING" value="application/xml"/>