Currently Being Moderated

Many web applications we are asked to integrate with may not be XML-based or webservice-enabled. They are existing web applications using the HTTP/HTML protocol, requiring us to post data to them. The HTTP adapter can be used for this situation. However, using it can sometimes lead to uncertainty as to what exactly are being sent or posted to these 3rd-party web application. The url element contains the value of the URL to be used when posting to the 3rd-party application. It will override whatever has been hardcoded in the HTTP receiver communication channel.

 

 

 

The parmValue contains all the parameter values in the URL. In another word, they are the values to be posted. The key values for the URL parameters are configured in the HTTP receiver communication channel (see below). </p><p>The HTTP receiver communication channel configuration for the URL parameter key values: (the order of the parameter values in the source XML correspond to the order of the Parameter configuration below)<br/>!https://weblogs.sdn.sap.com/weblogs/images/4172/HPT1.jpg|height=400|alt=image|width=507|src=https://weblogs.sdn.sap.com/weblogs/images/4172/HPT1.jpg|border=0! <br/>Also, please note below that the "Target Host", "Service Number" and "Path" are irrelevant. They will be replaced by the URL in the source XML.<br/>!https://weblogs.sdn.sap.com/weblogs/images/4172/HPT2.jpg|height=400|alt=image|width=513|src=https://weblogs.sdn.sap.com/weblogs/images/4172/HPT2.jpg|border=0! </p><p>The Message Mapping: <br/>!https://weblogs.sdn.sap.com/weblogs/images/4172/HPT3.jpg|height=382|alt=image|width=600|src=https://weblogs.sdn.sap.com/weblogs/images/4172/HPT3.jpg|border=0! </p><p>The User-Defined Function, "AssignURLValue": <br/><textarea cols="65" rows="20">public void AssignURLValues(String[] url,String[] urlParm,ResultList result,Container container){      DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);      DynamicConfigurationKey parmValue;      // TargetURL      parmValue = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/HTTP", "TargetURL");      conf.put(parmValue, url[0]);      // URL Parameters      switch(urlParm.length) {      case 6:        parmValue = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/HTTP", "UrlParamSix");        conf.put(parmValue, urlParm[5]);      case 5:        parmValue = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/HTTP", "UrlParamFive");        conf.put(parmValue, urlParm[4]);      case 4:        parmValue = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/HTTP", "UrlParamFour");        conf.put(parmValue, urlParm[3]);      case 3:        parmValue = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/HTTP", "UrlParamThree");        conf.put(parmValue, urlParm[2]);      case 2:        parmValue = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/HTTP", "UrlParamTwo");        conf.put(parmValue, urlParm[1]);      case 1:        parmValue = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/HTTP", "UrlParamOne");        conf.put(parmValue, urlParm[0]);      } } </textarea> <br/>As you can see, we do not map anything to the target XML. The only thing we are interested is to populate the URL and URL parameters. Therefore, the user-defined function does no mapping, instead its only purpose is to assign values dynamically from the source XML to the communication channel configuration. </p>h4. 2. Verifying What Has Been Posted Now we have, supposely, configured the URL and the URL parameters to be posted. But, how can we be sure. Will all the parameters be sent? One way to find out is just to send it and hope that everything works out. But, if it doesn't, how do we determine where is the problem? Was it because we did not post the parmaeters correctly, or the receiving application doesn't work as expected? <p>In order to determine what has been sent, I developed a simple .asp application which returns all the URL information, including the following: query parameter, header information, payload, etc. The reason .asp was used is because most of us has a Windows system, where IIS can easily be installed or already installed. The .asp application can simply be copied to the "wwwroot" directory. The filename must be "displayPostData1.asp". You can change the filename, but, at the same time, you must also change the URL in this example. </p><p>Below is the displayPostData1.asp program: <br/><textarea cols="65" rows="30"><% 'dim fs,f 'set fs=Server.CreateObject("Scripting.FileSystemObject") 'set f=fs.GetFile("C:\data\HTTP\foo.txt") 'f.Attributes=32 'Response.Write("The attributes of the file are: ") 'Response.Write(f.Attributes) 'set f=nothing 'set fs=nothing 'Adjust this depending on the size of the files you'll 'be expecting; longer timeout for larger files! Server.ScriptTimeout = 5400 'Yank the file (and anything else) that was posted PostData = "" PostData = "Query String " & Chr(13) & Chr(10) PostData = PostData & "=============" & Chr(13) & Chr(10) PostData = PostData & Request.QueryString & Chr(13) & Chr(10) PostData = PostData & Chr(13) & Chr(10) PostData = PostData & "Header Fields" & Chr(13) & Chr(10) PostData = PostData & "=============" & Chr(13) & Chr(10) for each header in Request.ServerVariables      PostData = PostData & header & "=" & Request.ServerVariables(header) & Chr(13) & Chr(10) next PostData = PostData & Chr(13) & Chr(10) PostData = PostData & "Payload Data " & Chr(13) & Chr(10) PostData = PostData & "=============" & Chr(13) & Chr(10) Dim biData biData = Request.BinaryRead(Request.TotalBytes) 'Careful! It's binary! So, let's change it into 'something a bit more manageable. For nIndex = 1 to LenB(biData)      PostData = PostData & Chr(AscB(MidB(biData,nIndex,1))) Next 'IIS may hang if you don't explicitly return SOMETHING. 'So, redirect to another page or provide some kind of 'feedback below... %> <%response.write(PostData)%> </textarea> <br/>The above .asp program displays everything about the URL, not just the URL parameters, so you can use it to examine every piece of information sent by your HTTP communication channel. </p><p>To use it, the interface needs to be synchronous, and you can use the test tool in the Runtime Workbench. </p><p>For our example, after executing it, we can go to the SXI_MONITOR and look at the response document, which contains the content of the URL information sent by the HTTP receiver communication channel. </p><p>The content is of the URL is: <br/>!https://weblogs.sdn.sap.com/weblogs/images/4172/HPT4.jpg|height=400|alt=image|width=595|src=https://weblogs.sdn.sap.com/weblogs/images/4172/HPT4.jpg|border=0!</body>

Comments

Actions

Filter Blog

By date:
By tag: