Quantcast
Channel: SCN : All Content - Process Integration (PI) & SOA Middleware
Viewing all articles
Browse latest Browse all 7030

PO AEX SOAP Client

$
0
0

Intro

I created a simple SOAP Client based on this blog post by Michal Krawczyk to post messages directly to the AEX.

 

http://scn.sap.com/community/pi-and-soa-middleware/blog/2014/02/20/michals-po-tips-how-to-send-messages-directly-to-aex-ico--adapter-independent--soapui-version

 

Rather than use SOAP UI, I reworked the JS in a web form based on an old HTTP Client that I received years ago.  Hence why it looks so ugly.

 

You still need to have an existing Sender Channel and ICO as described in Karsten Mohwald’s blog.

http://scn.sap.com/community/pi-and-soa-middleware/blog/2014/02/17/howto--send-test-messages-to-the-adapter-engine-to-an-integrated-configuration

 

Cross Object Requests (CORS)

To get around CORS for testing locally I needed to disable Web Security in the browser.  This can be achieved in the following browsers via the info in the referenced stack overflow posts:

 

BrowserGuide
Chromehttp://stackoverflow.com/questions/3102819/disable-same-origin-policy-in-chrome
IEhttp://stackoverflow.com/questions/3102819/disable-same-origin-policy-in-chrome

 

I have tested successfully in Chrome only, but assume IE should be fine after setting this as well. Firefox is a non starter and I've not tried Safari.

 

Alternatively to get around this, you could deploy this page locally on PI.  Although the only benefit over the RWB test tool, will be that you will not have to fill

out the URL each time you access the page.  It’s pretty much the same outcome otherwise.

 

Pro’s and Cons

It’s better than SOAP UI as you don’t have to create the SOAP Request, setup attachments and make sure to manually update the GUID (as PI will reject a message it has seen before). Random GUID’s are generated by the script. 

 

You’ll come away with a better understanding of how the PI Message is built by debugging via Chrome.

 

It is only to be used for testing, but so are all the alternatives.

 

Using the Tool

Complete values for all of the values in the Header section which are mandatory.   The dummy service and channel must be the ones you setup as described in Karsten’s blog.

 

Copy your XML into the text box labelled “Type in XML”.  The load file is currently not possible, but I’m working to add that in.

 

Image 1.png

 

Once done…hit “Send” and wait for your messages to appear in PO in the message monitor.   

 

Analysing Issues

Some of the best tools that helped me to work out what was going on here, were SOAP UI, Google Chrome and the XPI Inspector.  Ultimately I needed a way to replicate SOAP UI and compare what was being sent from my browser and received in PI. 

 

Most notably the Request Headers

Image 2.png

 

And the request body

Image 3.png

 

I spent too long working out that the boundary values in the body needed to be pre-fixed with “--”. But would not have discovered this without these tools and reading the standards on W3C.

 

Modifying the default values

You can edit the code and replace all the default values and hard code them with something specific to your system.  Look for comments that begin “<!-- Change” in the source.

 

Image 4.png


Where can I get a copy

You can access a copy from github here at

 

https://github.com/katansapdevelop/PO_SOAP_Client_AEX/tree/662eae81a37a6326e1201024326c8188bcf6438a

 

This is by far not something I have spent nearly enough time refining.  I’d appreciate any feedback or corrections on the source, hence why I hosted the source on github and also as a means for me to keep the most up to date version available.


Summary

I’ve tested this using BE, EO and EOIO (for JMS) and all worked perfectly.  So props to both Michal and Karsten for sharing this.


Have fun and use with care. 


Viewing all articles
Browse latest Browse all 7030

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>