on 04-13-2016 2:11 PM
Hi All,
we are using PI 7.0 SP 25.
Recently I have got the task to consume a REST web-service that accepts a json payload. In addition, an 1K long OAuth2 bearer token should be sent in the packet in order to authenticate the PI system.
I have tried following variants:
1. I am able to send a JSON payload by using the SOAP adapter (by specifying "Do not use the SOAP envelop") but I cannot insert the bearer token into the corresponding mime header as it is longer than 200 characters that is the limit for ASMA.
2. I could use an Axis handler to specify such long bearer token but I think that there is no way to force Axis to use the JSON payload. The Axis framework fails once I try to create a message that does not contain the soap envelope. And there are no methods of the SOAPBody interface in order to "set" a JSON payload for the body.
So it seems that both SOAP adapter and SOAP with Axis won't help here.
Any ideas what can be done here to complete the task?
Best regards,
Maxim
1. I am able to send a JSON payload by using the SOAP adapter (by specifying "Do not use the SOAP envelop") but I cannot insert the bearer token into the corresponding mime header as it is longer than 200 characters that is the limit for ASMA.
Which ASMA Parameter are you using for this purpose?
What I am thinking is - The SOAP Adapter in the Do not use SOAP Envelope is nothing but a plain HTTP Adapter.
So, instead of using the SOAP Adapter you may as well use the HTTP Adapter and set the HTTP Headers in your HTTP Adapter. I am not sure if this can solve the problem but this could be one more alternate to consider.
Regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Might be worth doing a quick check with the HTTP Adapter -> Header Fields.
https://help.sap.com/saphelp_nw73ehp1/helpdata/en/6d/c2b39dae45482e90d3352345cbf427/content.htm
I am not sure if these also have the 200 character restriction but worth a quick shot!
Regards,
Bhavesh
Hello Bhavesh,
We are on PI 7.0 and there is no Java HTTP adapter. There is only an HTTP adapter in ABAP stack.
I've tried to use it as follows:
I have got the very same error as with SOAP adapter.
com.sap.aii.mapping.api.StreamTransformationException: class java.lang.IllegalArgumentException: Value is too long (984/200):
The problem is that I cannot insert the long bearer token into DynamicConfiguration where ASMA are actually stored.
Best regards,
Maxim
Just looked up SAP Help and looks like there seems to be no way around this
The length of the attribute value is defined by the XI message protocol. Values can be a maximum of 200 characters long. If, for example, you assign longer values in the mapping or adapter modules then this can lead to processing errors at runtime or the values are shortened to 200 characters. This shortening can also lead to a processing error. The processing error that occurs depends on the components that access the attributes.
Regards
Bhavesh
The only other options I can think of -
- Write a Java Server Proxy that performs the actual call
- Write this as a custom call within a Java UDF / Java Mapping
Both of these are ugly and something I would hate to do, but considering you are on PI 7.0 and REST Adapters arent supported, they seem to be the only way forward until you upgrade to the latest and greatest!
Regards,
Bhavesh
Yes, I have already tried this. I've used the HttpURLConnection class in the Java Server Proxy but it did not work with the https protocol. I know it is working for http calls since we are using this approach to populate web forms. But this time it throwed an exception when I've tried to connect to an http destination.
So I am not sure whether the java virtual machine of PI supports https. Do you know whether this should be generally possible?
Regards,
M
Definitely should be possible. Do you know the error when you try a HTTPS protocol?
Is it a SSL Handshake error? if that is the case you would need to load the TrustedCAs into the SAP JVM Keystore rather than the SAP PI Keystore in NWA.
If my memory serves me right, the SAP JVM keystore password will be the default JVM Password - "changeit"..
Regards,
Bhavesh
I am getting NullPointerException and it is not yet clear for me where it comes from. The stack trace is not very explanatory.
null:-1:org.w3c.www.protocol.http.HttpURLConnection:connect
MIOrdersToSubscriptionsASYNCINB_PortTypeImpl.java:36
So my proxy calls HttpUrlConnection:connect and this throws an null pointer exception.
I have tried to use the xpi_inspector to see the SSL handshake result and according to it everything went ok.
Still searching for the reason of the error...
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.