cancel
Showing results for 
Search instead for 
Did you mean: 

Encoding Problems

Former Member
0 Kudos

Hi All,

I have an issue with encoding, i have a scenario that receive a POST call with a JSON file, and when B1if is converting the JSON file to B1if XML representation I get encoding problems with special characters that i receive in the JSON file, i think it should be something related with the Control Document, does anybody knows how to create a Control Document that forces the conversion to UFT-8 ?


Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi all, does anybody knows where B1if does the transformation an incoming payload in an HTTP call?

Thanks.

bastian_schaefer
Active Contributor
0 Kudos

Hi Silvio,

Within B1i processing everything is encoded in UTF-8 and isn't the default encoding of JSON UTF-8, too?

Is there a way to force your HTTP POST to encode in UTF-8 already?

Please check the B1i online help for "HTTP Inbound", maybe there is a way to predefine the encoding by the incoming HTTP POST call using additional information about the payload type in the following way to the address:

…/proc?bpm.pltype=<payload type>


A documentation about the usage of a "Format Control Document" can be found in B1i online help under search tag "file inbound".

But as I know, the "format control document" function is only active for FileInbound, so I'm not sure if it can be used for HTTP Inbound definition of B1i, too.


If you still have no chance to convert the encoding, please create a support message for this issue.

Best regards

Bastian

Former Member
0 Kudos

Hi Bastian, you are right, the issue was that the POST content was not encoded in UFT-8, now is working fine!

Thanks!


ltassi
Explorer
0 Kudos

Hi Bastian and Silvio,

  I'm tryng to do a similar thing launching with ajax a post with json payload and parse it with b1if.

My problem are:

1 the format of the xml coming from the json is completely different from the format that shows Silvio in the first post... Silvio shows object with subobject as strings ecc..

In my sample I've got onlly couples key name.

2 if i put the parameter  ?bpm.pltype=json

I've got an error from the server

I don't understand if i'm wrong when i call the rest from sap ui 5:

In the http inbound help i ddn't found anything that solvwes my problem.

bastian_schaefer
Active Contributor
0 Kudos

Hi Luca,

In "Monitoring -> Process Control -> Scenario Processes - Inbound section" you should be able to see the incoming message: the incoming message will be implicitly transformed from JSON into XML.

During the transformation "io" will probably the root tag.

Now please check your scenario step inbound channel definitions:

Which "identification method" did you choose?

In case you took "Root Tag" please try it with identifier = "io".

You could also change to Identification Method = "URL Parameter" and fill Identification Parameter with "urlpar(action)" with Identifier = "PlaceOrder"

Best regards

Bastian

ltassi
Explorer
0 Kudos

Hi Bastian,

I've followed your advice of checking :

"Monitoring -> Process Control -> Scenario Processes - Inbound section"


and this is what i view (even if I use inbound channel with identification with root tag even with "urlpar(action)" with Identifier = "PlaceOrder"



but this view doesn't tell me nothing new because the format is always the wrong :


<key name="HeaderData[Total]" value="60" xss_4ELE="60" xss_4ATT="60" xss_4JSC="60" xss_4CSS="60"/>

<key name="HeaderData[Discount]" value="0" xss_4ELE="0" xss_4ATT="0" xss_4JSC="0" xss_4CSS="0"/>

<key name="HeaderData[DiscountPercent]" value="0" xss_4ELE="0" xss_4ATT="0" xss_4JSC="0" xss_4CSS="0"/>

<key name="HeaderData[VatSum]" value="6" xss_4ELE="6" xss_4ATT="6" xss_4JSC="6" xss_4CSS="6"/>

<key name="HeaderData[DocTotal]" value="66" xss_4ELE="66" xss_4ATT="66" xss_4JSC="66" xss_4CSS="66"/>

At this time i guess that there is something wrong in the ajax call but i don't understand what..

restpath = "/B1iXcellerator/exec/ipo/vP.0010000117.in_HCSX/"

  +"com.sap.b1i.vplatform.runtime/INB_HT_CALL_SYNC_XPT/INB_HT_CALL_SYNC_XPT.ipo/proc";

  var myurl = myDomainAndPort + restpath;

  

  jQuery.sap.require("sap.ui.commons.MessageBox");

  var oThis = this;

  $.ajax(

  {

  type : "POST",

  url : myurl,

  dataType: "json",

  async: true,

  data: newDocModel.oData,

  //data : testJsonDocModel.oData,

  //data: JSON.stringify(testJsonDocModel),

  statusCode : {

  200 : function(data,textStatus,jqXHR ) {

  sap.ui.commons.MessageBox.show(

  "OOOK");

  }

  }

  }).error(function(jqXHR, textstatus, errorthrown) {

  sap.ui.commons.MessageBox.show(

  textstatus + " " + errorthrown + " " +

  jqXHR.responseText);

  });

0 Kudos

Hi Luca,

Be sure the content-type of your request is "application/json" and force the encoding to utf8

Like Bastian suggest I normally configure the Inbound like this

And then you could invoke the WS with a URL like this:

http://+"myDomainAndPort "+/B1iXcellerator/exec/ipo/vP.0010000101.in_HCSX/com.sap.b1i.vplatform.runt...

You could use a requester to prove your WS and be sure it's ok before concluding you have anything wrong on your ajax.

I use REST Console on Chrome.

Kind regards

Fernando

Answers (0)