Sending XML data to BC using HTTP

Hi to all,

I’m trying to send XML data to a Business Connector 4.6 using HTTP POST to a flow service that only has a documentToRecord step. The call is working ok (I get a 200 response from BC) but the service is not decoding the XML data. Using a HTTP sniffer I can see what I am sending (and looks ok…):

POST /invoke/RemoteServices:GetXMLData HTTP/1.1
Authorization: Basic aGVycnNlZXM6VVAyZ3VuZw==
Content-Type: text/xml
Accept: text/xml
User-Agent: Java1.3.1
Host: bbmags8.bbmag.bbraun.com:6666
Connection: keep-alive
Content-length: 11220

<?xml version=“1.0” encoding=“UTF-8”?>
<root table=“ZSHG.IDOCPALE”>
<segment>
<segnam>E1EDL20</segnam>
<mandt>110</mandt>
<docnum>0000000000431101</docnum>
<segnum>000001</segnum>
<psgnum>000000</psgnum>
<hlevel />
<sdata>0076501029ES3D2240 Almacén CIFRubi 010.025 0.024 KGM2.134 DMQ00000</sdata>
</segment>
<segment>
<segnam>Z1EDL20</segnam>
<mandt>110</mandt>
<docnum>0000000000431101</docnum>
<segnum>000002</segnum>
<psgnum>000001</psgnum>
<hlevel />
<sdata>ZMM00_THIRD_PARTY 00</sdata>
</segment>
</root>

Any help will be greatly appreciated!

Thanks in advance
Sebastià

Sebastia,

Is the documentToRecord step is not parsing the XML?
Did you provided the necessary inputs as expected like (node,recordName(fully qualified recordname),makeArrays=false (if the xml has complex arrays then set this to true and fill the Arrays param) and the output will be boundNode(map this to a recordReference which is the actual xml structure that you are trying to parse).

For debugging put a savePipelineToFile and later restore it and step thru the flow.

let use know the result.

HTH,
RMG.

Hi again and thanks for your response!

I’ve added a savePipelineToFile to the flow, and I have found that the node variable is empty. So it seems that BC is not receiving the data correctly.

I am sending the data from a Java program using a HttpURLConnection to make the connection and then sending the XML using a PrintWriter connected to the output stream.

Perhaps I must configure something in BC?

Thanks in advance

Sebastià

Sebastia,

I am not so familiar to BC/IS environment,and i think there is nothing need to configure for http process,but the way you are http posing the XML with content-type:“text/xml” will definetly work and you should see the node object with value and downstream parsing will work.

For testing purpose you can do is try using (pub.client.http) service and do the same process which you are doing using Java stub and make sure http post works internally in your BC.

HTH,
RMG

Hi RMG,

It’s solved! :slight_smile:
The problem was that I was sending special chars (Like in Almacén) with an UTF-8 encoding. I changed the encoding to “ISO-8859-1”, and now it’s working.

I found the error when I tested the flow in the Business Connector Developer, and using Test->Send XML File. It showed a XML malformed error.

Thanks for all

Sebastià

great,you found it,always debugging helps a lot.