Amazon Contextual Product Ads

Monday, 6 August 2012

Read response from invoking Siebel CRM “EAI HTTP Transport” business service

 

I wrote a post some time ago about how to call URL from Siebel CRM. This post will deal with processing the response from remote page.

So here you go, follow the instructions from my previous post and submit data to remote page. Many times you expect not only to send data, but also receive a response back.

To remind you , in order to send data you have to invoke

oService.InvokeMethod("SendReceive", oInputs, oOutputs);


Common sense tells you that response is probably located in object.


But if you try to run



oOutputs.GetValue();


You will get the following error message


PropertySet GetValue call failed. PropertySet Value is marked as binary data, starting with….


And this is because Siebel can process data only in UTF-16 encoding. If it is not, Siebel “thinks” that it is a binary data.


Bellow is very simple code to convert the HTTP output to a proper format


var oTransService = TheApplication().GetService("Transcode Service");
var oTransOutputs = TheApplication().NewPropertySet();
oOutputs.SetProperty(
"ConversionMode", "EncodingToString");
oOutputs.SetProperty(
"SourceEncoding", "CP1252");
oTransService.InvokeMethod(
"Convert", oOutputs, oTransOutputs);
var sResponse = oTransOutputs.GetValue();

 


After you execute it. You will fine HTTP response string in sResponse variable.


 


P.S. You can find more information in 536101.1 metalink note

1 comment:

  1. Oh! Thanks! This code has help me a lot! Thanks!!!

    ReplyDelete