Java HTTP adapter in PI 7.3?
Hi Experts,
Anyone adivse me how to implement the java HTTP to File scenario via PI?especially explain me the HTTP sender side and how to test as well.
thanks in advance.
HTTP adapter now comes in AAE in Pi 7.3. Except that there is no big difference between PI 7.3 and lower versions. You can go to component monitoring --> adapter engine --> test message and paste your payload and test. You are going to test in adapter engine level instead of abap stack (integration engine).
Similar Messages
-
Java HTTP adapter - without Authentication
Hello Experts,
is it possible to set Java HTTP adapter on sender CC to request no login and password?
I tried to look at documentation but didnt found any setting for that.
Standard case is - when I create sender HTTP channel it requires Basic Http authorization/authentification using popup window to enter login/password.
I`m on SAP PO 7.4
Thank you
vbalkoHi Vladimir -
There is one blog which talks about how to disable basic authentication on soap adapter.
I assume you can follow the same approach if you want to disable for HTTP adapter. But please note that it disables the authentication for all the channels.
Please refer to William's reply in the below therad for more details.
User Names and Passwords in SOAP adapter
Path for HTTP Adapter WEB-Inf file is :
/usr/sap/<<SID>>/DVEBMGS<<SYS_NO>>/j2ee/cluster/apps/sap.com/com.sap.aii.adapter.http.app/servlet_jsp/HttpAdapter/root/WEB-INF -
Http-adapter: Convert html-post to JAVA-post?
Hello everybody,
unfortunately I am not a java programmer. But I am testing the http adapter.
Is it possible to convert the following html-post into JAVA code?
<html><head>
<body>
<form action="http://myserver" method="post">
<p>Interface Namespace<br>
<input name="namespace" value="http://mum.mappings" size="40"></p>
<p>(Sender-) Service:<br>
<input name="service" value="MUMHTTP" size="40"></p>
<p>Interface Name:<br>
<input name="interface" value="MI_Merge_1" size="40"></p>
<p>Text:<br>
<textarea name="Text" rows="5" cols="50"></textarea></p>
<p><input type="submit" value="Send"></p>
</form>
</form>
</body>
</head>
</html>
For me it is important to send the values of the <input> values.
How has the code look like?
Many regards, marioHi Mario,
I Have once used this code snippet to send a payload to XI engine. Please change the parameters like XI server URL,
Namespace,senderservice etc..
Please let me know if you need any further help.
Regards,
Ananth
public static void main(String[] args) throws Exception {
try {
URL sapURL = null;
String urlString = "http://"+serverHost+":"+serverPort+"/sap/xi/adapter_plain?namespace="+senderNamespace+"&interface="
+senderInterface+"&service="+senderservice+"&party=&agency=&scheme=&QOS="+QOS+"&sap-user="+sapUser+"&sap-password="+
sapPWD+"&sap-client="+client+"&sap-language=E";
sapURL= new URL(urlString);
HttpURLConnection xi = (HttpURLConnection)sapURL.openConnection();
xi.setRequestMethod("POST");
xi.setRequestProperty("Content-Type","text/xml");
xi.setDoOutput(true);
generateXML(xi.getOutputStream());
System.out.println(urlString);
System.out.println("Resp Msg:"+xi.getResponseMessage()+" -- Resp Msg:"+xi.getResponseCode());
xi= null;
} catch (Exception e) {
e.printStackTrace();
public static void generateXML(OutputStream out){
try {
PrintWriter prt = new PrintWriter(out,false);
//Create XML tags
prt.println("<?xml version= "1.0"?>");
prt.print("<"+resp_MsgType+" xmlns:ns=""+resp_NameSpace+"">");
prt.print("<"+xml_tag1+">");
prt.print(xml_tagValue1);
prt.print("</"+xml_tag1+">");
prt.print("<"+xml_tag2+">");
prt.print(xml_tagValue2);
prt.print("</"+xml_tag2+">");
prt.print("</"+resp_MsgType+">");
prt.flush();
prt.close();
out.close();
prt=null;
out=null;
}catch(Exception e){
e.printStackTrace(); -
Hi Team,
I need to access Java web service which is simple service and accepts and returns XML over HTTP. No credentials are needed to access the service. We need to pass following two HTTP headers (Content-Type and Authorization) along with XML request message:
<GetStatus> message is being constructed in the orchestration and URI is constant to access.
Which adapter shall I use to get the response back? I tried using WCF-WSHttp with Security Mode = Transport, and different options of client credential types but every time, error returned stating:
System.Net.WebException:
The HTTP request is unauthorized with client authentication scheme 'Basic'. The
authentication header received from the server was 'Basic realm='.
Authentication failed for principal Basic. Message payload is of type:
String
In Fiddler, request looks line following
POST <https://URL/GetServiceReopnse HTTP/1.1
Content-Type: application/xml
Authorization: Basic cmVmU3RhdHN2Y19kgeRfsdfs=
Host: <Server name>
<GetStatus XMLNS="http://server.com/.....">
<OrgId>232323</OrgId>
<HubId>3232342323</HubId>
</GetStatus>
MMK-007First, you should not use the HTTP Adapter because it's been deprecated and replaced by WCF.
Start with the WCF-Custom Adapter and select the customBinding.
You should start with the textMessageEncoder and httpTransport and go from there. -
Convert XML payload to HTML form data in Receiver HTTP Adapter
Hi,
I want to make a HTTP request ( Receiver HTTP Adapter ) to a servlet where I need to send the payload in HTML form format ( name=value ). As per the help document:
A typical HTML form comprises named fields. When transferring a completed form to the server or a CGI program, the data must be transferred in such a way that the CGI script can recognize the fields that make up the form, and which data was entered in which field.
The plain HTTP adapter constructs this format using a prolog and an epilog
Has anyone done this before? I looked through all help documents and forums but in vain. I can resort to Java Mapping to do this but I do not want to re-invent the wheel if I can do it easily using HTTP Adapter Configuration. Please help.The parameters available in HTTP adapter for message header are:
HeaderFieldFive http://sap.com/xi/XI/System/HTTP
HeaderFieldFour http://sap.com/xi/XI/System/HTTP
HeaderFieldOne http://sap.com/xi/XI/System/HTTP
HeaderFieldSix http://sap.com/xi/XI/System/HTTP
HeaderFieldThree http://sap.com/xi/XI/System/HTTP
HeaderFieldTwo http://sap.com/xi/XI/System/HTTP
HTTPDest http://sap.com/xi/XI/System/HTTP
TargetURL http://sap.com/xi/XI/System/HTTP
URLParamFive http://sap.com/xi/XI/System/HTTP
URLParamFour http://sap.com/xi/XI/System/HTTP
URLParamOne http://sap.com/xi/XI/System/HTTP
URLParamSix http://sap.com/xi/XI/System/HTTP
URLParamThree http://sap.com/xi/XI/System/HTTP
URLParamTwo http://sap.com/xi/XI/System/HTTP -
PI 7.1 HTTP Adapter - overwritte Prolog dynamically
I use a HTTP Adapter to send XML Data via HTTP as form field. Therefore i use the prolog constant. Example: xmlfile=.... Now i need two new parameter (user and password) as post parameters. I can change to prolog like user=...&password=....&xmlfile=.. But in this case the prolog with the user is hard coded. in my scenaria the user and password should dynamically load from Message Mapping. The solution with the dynamic URL Parameter 1-6 could not be used, because this values are GET Parameters which are visible in der URI!
Is there a solution for post parameters dynamically via HTTP Adapter?The operation mapping aka Interface mapping's need not only use 1 single mapping.
In the interface mapping you can add multiple message mappings and / or other mapping programs.
The mappings get executed sequentially and the output of first mapping is input to second mapping and so on.
In this case, write a java mapping that will take the input as the output of your graphical mapping; add the prolog to this and make it the output of your Java Mapping and this is the final output of your Operation mapping!
Regards
Bhavesh -
HTTP adapter bug in XMLFromAOConverter
Hello,
I got ClassCastException while my HTTP adapter sending message to an external application.
I tried it with versions 10.1.2 and 9.0.4. Both of them produced the exactly same exception (only the line numbers were different in stack trace).
The adapter was correctly subscribed in iStudio using DTD file and CopyFields transformation.
The message was received from HUB and successfully converted from MSG doctype. BUT when it is converted into output XML format, the following error has occured (details from logfile):
---- start details (as in 10.1.2 HTTP adapter logfile)
"date": Received a message from hub queue oai_hub_queue.
<?xml version = '1.0' encoding = 'UTF-8'?>
<!DOCTYPE MSG>
<MSG>
"date": Inbound Transform Engine: done transforming messag
e. Message will now be given to the Bridge.
Main_Events.EVEMT_NAME:OAI/V1,OAI/V1,false,0
hub-test
HEADER
MESSAGE_ID: 13
SERIAL: 13
COMMAND: COMMAND
BODY
ID: 1
PASSWORD: PASSWORD
PHONE: 2040780
"date": Agent: ** Error ** Bridge had an error processing the received message.
Main_Events.EVENT_NAME:OAI/V1,OAI/V1,false,0
java.lang.ClassCastException
at oracle.oai.agent.client.XMLFromAOConverter.addObjectAttribute(XMLFromAOConverter.java:347)
at oracle.oai.agent.client.XMLFromAOConverter.addObjectAttribute(XMLFromAOConverter.java:400)
at oracle.oai.agent.client.XMLFromAOConverter.addObjectAttribute(XMLFromAOConverter.java:343)
at oracle.oai.agent.client.XMLFromAOConverter.addObjectAttribute(XMLFromAOConverter.java:255)
at oracle.oai.agent.client.XMLFromAOConverter.toXML(XMLFromAOConverter.java:146)
at oracle.oai.agent.client.XMLFromAOConverter.getXMLData(XMLFromAOConverter.java:92)
at oracle.oai.agent.client.AgentImpl.convertMessageObjectToXML(AgentImpl.java:257)
at oracle.oai.agent.adapter.technology.TechBridge.messageReceived(TechBridge.java:929)
at oracle.oai.agent.client.SmartQueueDispatcher.run(SmartQueueDispatcher.java:489)
---- end details ----
When I tried DTDs which "depth" is only 1, eg.:
hub-test
field1: abc
field2: efg
the adapter works fine.
Has somebody any idea to solve this critical problem?
Thanks in advance, Janasounds strange as ie works fine for me. try to change encodeURL()
to encodeRedirectURL()... -
Message setup for HTTP adapter
If the http plain adapter is used, you use the URL to post the XML file to. What I was wondering is what the complete string looks like that is send, so URL including the XML message itself? In other words, what's between the http URL (http://...&language=EN) and the XML message itself (<?xml%20...).
Alexander
If I understand your question right, you are wondering what is in between the URL and the XML message. If yes, you need to understand how data exchange happens using HTTP.
When data need to be exchanged between systems (Client and Server), there are various protocols. For e.g., FTP is used for transferring data as OS files between systems. Similarly HTTP is a protocol that is use for exchanged data between systems in the form of 'Request;Response' cycle. As with any protocol there are certain rules and structure.
In case of HTTP, you should note the following
1. There is a URL which is used for identifying where the request should be sent, which port it should hit and other related information. You can pass some information in the URL (In case of XI HTTP adapter, maximum of 200 characters long) as well and in case of XI it will contain information specific to interface.
2. Then there is HTTP header which will give information to the server (the system receiving the request) about various attributes like mime type of the data etc.
3. Then there is HTTP body that actually has the data that needs to be sent to the system. In your case the body contains the XML message. Note that the body can also contain form elements instead of XML in which case you need ABAP or Java mapping in XI to parse the data.
To come back to your question, what is in between the URL and XML? answer is nothing, because these are two different entities within HTTP. And no, you cannot embed the XML within the URL. An analogy in real world would be when you sending mails using post. The envelope you use is like a HTTP header, the address you write on the envelope is the URL and the actual letter inside the envelope is the HTTP body.
Please refer http://en.wikipedia.org/wiki/HTTP to understand more on what HTTP is about.
Thanks
KK -
I am using an HTTP adapter to send a message from XI to a url http://www.ustreas.gov/offices/enforcement/ofac/sdn/sdn.xml
When I make a request to this url, my response should be a string of xml data. This is a list of people / nations to whom my company cannot sell its products.
The problem is that an HTTP adapter always sends a request method (GET or POST), but this website cannot accept a method. (The error is HTTP 405 method not allowed) The only way to retrieve the data is just to make a connection and then read the response stream.
If you know java then you know exactly what I am talking about.
I wrote a small java program that gets the data from this website, but I cannot find a way to do this with the HTTP adapter.
Here is my code
public static void main(String[] args)
try
String CompleteUrl = "http://www.ustreas.gov/offices/enforcement/ofac/sdn/sdn.xml";
URL url = new URL(CompleteUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setUseCaches(false);
connection.setDoOutput(true);
connection.connect();
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
catch (Exception ex) {System.out.println(ex.getMessage());}
So all I am doing here is making a connection and reading the response stream.
The HTTP adapter always sends a GET or POST and that is not accepted by this website
Thanks
Vad VayntrubHi Vad,
Have you considered implement/import your Java function into XI as internal mapping or imported archive? That way you can easily retrieve the information you need (directly from the URL you mention here) and further process it in XI.
Thanks,
Rob.
Message was edited by: Rob Viana -
HTTP Adapter - Error While Starting
Hi all,
I get the following error message when i start my HTTP Adapter.
Initializing the Bridge oracle.oai.agent.adapter.technology.TechBridge..
Bridge started in XML mode.
java.lang.NoClassDefFoundError: HTTPClient/ModuleException
at oracle.oai.agent.adapter.transport.basic.TransportSenderFactory.createTransportSender(TransportSenderFactory.java:73)
at oracle.oai.agent.adapter.technology.TechBridge.registerTransportSender(TechBridge.java:1531)
at oracle.oai.agent.adapter.technology.TechBridge.init(TechBridge.java:402)
at oracle.oai.agent.proxy.AgentProxy.go(AgentProxy.java:600)
at oracle.oai.agent.proxy.AgentProxy.start(AgentProxy.java:639)
at oracle.oai.agent.proxy.AgentProxy.<init>(AgentProxy.java:363)
at oracle.oai.agent.service.AgentService.run(AgentService.java:41)
at java.lang.Thread.run(Unknown Source)
The adapter is configured at the target side (Subscriber). Message type used is XML. The requirement is : Subscribe the XML message and post it to an URL. I get the above error when i start the adapter.
Any idea why iam getting this error message? Has anyone succeeded using the HTTP adapter.
Thanks,
ShahThe library http_client.jar is probably missing in your adapter classpath.
The problem is that this jar is not delivered by the adapter installation . You will find this library either in the Hub directories nor int the java OC4J product librairies
regards -
XI Http adapter receiver issue, how to change the target payload format
Dear all,
In my project, I need to call a servlet program using Http/xml.
The message format accepted by the server program is like this:
request:
<?xml version="1.0" encoding="GBK"?>
<PACKET type="REQUEST" version="1.0" >
<HEAD>
<REQUEST_TYPE>01</REQUEST_TYPE>
</HEAD>
<BODY>
<BASE_PART>
<QUERY_SEQUENCE_NO></QUERY_SEQUENCE_NO>
</BASE_PART>
</BODY>
</PACKET>
response:
<?xml version="1.0" encoding="GB2312"?>
<PACKET type="RESPONSE" version="1.0" >
<HEAD>
<REQUEST_TYPE>01</REQUEST_TYPE>
<RESPONSE_CODE>1</RESPONSE_CODE>
<ERROR_CODE>0000</ERROR_CODE>
<ERROR_MESSAGE>xxx</ERROR_MESSAGE>
</HEAD>
<BODY>
<BASE_PART>
<QUERY_SEQUENCE_NO>01PICC057106001156421487812453</QUERY_SEQUENCE_NO>
</BASE_PART.
</BODY>
<PACKET>
My first question is if I can use the servie by SAP PI http adapter?
If yes, and how to design the data type? The <HEAD> <BODY> are on the same level...
Commonly, I only can set the data type like this:
<?xml version="1.0" encoding="UTF-8"?>
<MT_HTTP_IN>
<HEAD>
<REQUEST_TYPE>1</REQUEST_TYPE>
</HEAD>
<BODY>
<BASE_PART>
<QUERY_SEQUENCE_NO>123</QUERY_SEQUENCE_NO>
</BASE_PART>
</BODY>
</MT_HTTP_IN>
The problem is how to remove the <MT_HTTP_IN> then insert the tab <PACKET type="REQUEST" version="1.0" >? I wonder if I need use JAVA mapping? and could u give me a related samples?
Thanks a lot!Dear Xun Liu,
If you need <PACKET type="REQUEST" version="1.0" >, then you need to create attributes 'type' and 'version' under node <PACKET>. At mapping level you can pass constant values for those attibutes.
Regards,
JP. -
Configure plain http adapter for receiving message from an external system
Hi,
we use Pi/700.
Now I have an external system and I have to use HTTP (plain) to send messages to XI (via plain http adapter).
I have no experiences with HTTP!
In the external system I can only configure "URL, Username, Password" for sending messages - that's all!
What do I have to configure in XI (communication channel, abap-stack, java-stack,...)?
I don't know the URL of my XI-system. Is there an transaction code to get this information?
Why do I need a Username/Pasword?
For testing I can use a "http-post test tool" I found here in this forum.
Thank you all for any help!
Regards
WolfgangHi Hummel,
In Exteranl System u have to use these values
name="myhost" value="xiserver"
name="myport" value="8000"
name="mysystem" value="XY_BSservice"
name="myinterface" value="Order_out"
name="mynamespace" value="urn:xi:hcl:powebapp"
name="myqos" value="BE"
name="myclient" value="300"
name="myuser" value="XYZCLNT"
name="mypass" value="xiuser"
Here My system is the Business service created in Integration directory of XI, Interface is the one created in Integration Repository (This is Outbaound from external sys to XI)
In XI U have to create
Data Types : 1) Source Structure data type(from extenal sys)
2) Target structure (where u want to send from XI)
Message Types : 2 with above DT's
Message Interface: 1) Outbound, Async (Order_out)
2) Inbound , Async (for the target sys)
Then Message mapping and Interface mapping as usual..
And in ID u have to create 2 services one is XY_BSservice for sending system and the other is for receiving system...
For sending system no communication channel required...
Hope u will get idea from the above..
Need any further u r welcome..
Regards
Sridhar -
Sender http adapter - decoding (URL unescape)
PI 7.0
Incoming http request in XI is URL decoded. Currently I am using java mapping to decode it. Is there a way to set any adapter specific properties in sender http adater so that I can avoid the java mapping for decoding. Or any settings in SICF? In other words, how can XI handle encoded http requests?
When XI makes a external http request, I can set a property "Mask Special Charcters (URL Escaping)" in the receiver http adapter. XI will make a encoded http request, meaning the xml will encoded in UT-8.Hi Ted,
I'm currently trying to do something like that, but not yet totally successed with a base64 encoded payload.
Here two documents that I really find interresting:
How to Configure Message Level Security in SAP Exchange Infrastructure 7.0
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d024ca8e-e76e-2910-c183-8ea4ba681c51
How to handle unstructured source contents for Adapters (with Java mapping or with Module)
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/482aae19-0301-0010-3485-8efd618818d0
if you find others... I'm ok to know it also
Cheers.
Mickael -
Hi - Hopefully this is a straight-forward question. I need to fetch a file from an external source (vendor) using a url that they provided us. Secondly, the url and file change each run. Here is the scenario:
#1.
- our side (PI 7.11) calls their webservice A to tell them to generate a report, and a report handle id is passed back to us (this part works)
- our side (PI 7.11) calls their webservice B with that report id to get a https url string (this part works). E.g. return url is https://pvab70barp.companyb.com/reports/ODbsPPSBIQxPs/u1/u1_1307128013471215.csv
- our side (PI 7.11) then needs to go fetch the contents of that file... again, the file is over at their site
#2.
The next time we run this we would get an entirely different url string
So to solve #1, it seems to me that the HTTP adapter can be used (can it be used though given the url is https?). I don't think FILE adapter can be used as I believe it needs the file to reside on the local file system.
To solve #2, it appears some dynamic configuration of the url is needed. Is their an easy way?
If anyone has thoughts on these then I would appreciate hearing back from you with your comments. I have not worked with either of these adapters yet.
Thanks,
Keith1) You can use http or https connection to connect remote server. HTTPS is not an issue. You create RFC destination of type H and there provide login credentials such as client certificates. Use that destination name in the http receiver adapter to use https. Looks like to read the file that is on the http server, you might want to use Java proxy to achieve this. Simple HTTPS communication would not read the file. Or request the client to share it in the network shared drive. so that we can use File adapter to pulll the file.
2) Yes you can use dynamic configuration in the mapping for the dynamic HTTPS URL. -
Busine Process Monitoring: define alert in XI for HTTP adapter
Hi Experts,
Iu2019m working with SAP XI 7.0 and solution manager 701. Iu2019m configuring BPM.
I want to monitor the error in XI. I have three systems:
Legacy System --> SAP PI --> ECC
The legacy System, communicate whit SAP PI with HTTP request so the adapter sender in PI is an HTTP Adapter.
I want to monitor the errors in the http adapter so I created the alert category HTTP_ERROR_ADAPTER in the abap stack (transaction alrtcatdef).
When I try to configure the alert in the Runtime WorkBanch I canu2019t find u201CHTTP Adapteru201D in the field u201CAdapter Engineu201D . I can see only jdbc, rfc, mail u2026. Adapters.
I think that I canu2019t see the http adapter because the HTTP Adapter is not a java adapter.
So, how can I monitor the errors in the HTTP adapter sender in SAP PI? Can I monitor the http adapter sender errors using the field u201CIntegration Engineu201D (u201Cerror categoryu201D = * and u201Cerror codeu201D = * )?
Thank you a lot in advance for collaboration.
Best regards
Giou2019how can I monitor the errors in the HTTP adapter sender in SAP PI?
Alert category option you are trying won't work. The only thing you may check in PI perspective is whether http service is running in smicm. I am not sure but CCMS monitoring could take care of this specific category. Other way without thinking about alerts could be using manual TCPGateway procedure to trace http calls.
Can I monitor the http adapter sender errors using the field u201CIntegration Engineu201D (u201Cerror categoryu201D = * and u201Cerror codeu201D = * )?
Integration Engine category here won't be actually the http related error, it would be pipeline steps related error.
Regards,
Prateek
Maybe you are looking for
-
Can't access files with names too long
I have some files on a Windows formatted external hard drive that have filenames that seem to be too long for OS X to handle. I can't open them, nor can I delete them. I can't even seem to "rm" them from the command line. I know they're there, and no
-
How to, login into the yahoo groups/clubs,....
Hi, I would like to write a offline browser utility to follow up my yahoo groups and clubs. I took several attempts before I wrote this mail and I discoverd that it are the redirections and cookies that cause the problems. Does anyone know a class ca
-
How to find the line no.
I am parsing an xml document and doing its custom validation (i.e putting in my own constraints).so can i notify on which line no. of the xml document is the error present?if yes how?
-
What number should I use to contact Apple?
I tried using their 1800 number for support, I forgot my security questions and I don't have a reset option, and all the automated voice did was tell me to visit the website. Is there any way I get get ahold of someone specifically for iTunes?
-
How to extract OPENING DATE information in /SAPAPO/RRP3 to BW?
Hi All, I would like to extract OPENING DATE information in transaction code /SAPAPO/RRP3 to BW. Has anyone tried doing this before? Thank you. Regards, Joy