on 02-01-2008 9:25 PM
Hi,
I am tring to call a .net WS from ABAP.
I know how to call a WS when i have to pass normal parameters. But my problem is the WS service is expecting a string as input which should be valid XML. The XSD is not simple it contains complex structure. That is somethign like header data and under that we have address data nodes which will occur multimple time and phone data nodes which will also occur multiple times.
I dont know how to create this input string inside ABAP.
Any help please.
Hi,
There are ABAP classes and interfaces to work with XML data:
cl_ixml -> Allows to create XML documents
if_ixml_document -> Interface to work with XML documents
if_ixml_element -> Interface to work with an element within a XML doc
Main steps:
1. Get a reference to IF_IXML
l_xml = cl_ixml=>create( ).
2. Create a XML document
l_xml_doc = l_xml->create_document( ).
3a. Transform ABAP structure into XML with function module SDIXML_DATA_TO_DOM (Best option)
l_xml_doc = l_xml->create_document( ).
NOTE: You can create ABAP structures with fields and other structures to get the desired XML
3b. Create XML dinamically by creating elements and adding these elements to the XML document
l_root = l_xml_doc->create_element( name = 'root' ).
l_child = l_xml_doc->create_element( name = 'child' ).
l_root->append_child( new_child = l_child ).
4. Use function module SDIXML_DOM_TO_XML to get the desired string. This FM returns a XSTRING and a table with the XML. You can convert the XSTRING to STRING or use the table.
I hope this can be useful,
Best regards,
Jorge Linares
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes Jorge you are correct. That is a generic WS.
Anyway finally i created my XML stirng using the following blog...
/people/r.eijpe/blog/2005/11/10/xml-dom-processing-in-abap-part-i--convert-an-abap-table-into-xml-file-using-sap-dom-approach
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Daniel,
I agree with you.
However, I don't know what this .NET WS is doing. Maybe it cannot be re-designed or it really needs an XML as a parameter.
Regards,
Jorge
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Wouldn't it be easier to wrap the WS with a simpler one, which uses simple input parameters? Who will ever call a WS wich uses a XML File as input? WS call should be as simple as possible, or not?
Regards,
Daniel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
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.