Skip to Content

SOAP framework accessing XML element attributes

Hi,

I have looked around and spent considerable time in the ABAP debugger without cracking this. Hope someone here can help me.

I have generated an ABAP SOAP proxy for consuming a web service. All works well.

This web service uses a generic method to retrieve data for any entity. To achieve this the response has the data stored in the XML element attributes rather than in the element content.

So instead of seeing something like this....

<Object>
  <Name>Fred</Name>
  <Address>1 Plane Street</Address>
  <City>Sydney</City>
</Object>

...I need to handle something like this...

<Object name="Fred" address="1 Plane Street" city="Sydney">
</Object>

I can't figure out how to do this from the generated proxy class. Has anyone come across this before?

Thanks

Graham Robbo

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Dec 11, 2015 at 06:33 AM

    So the web service can be called and returns the correct data - you just can't access the top-level nodes attributes?

    If that is the case you could get them via the PAYLOAD protocol (IF_WS_PAYLOAD).

    i.e.

    payload_handler = cl_proxy_access=>get_payload_handler(

    proxy_name = 'CO_...'

    proxy_method = 'EXECUTE_SYNCHRONOUS' ).

    Then use "GET_PAYLOAD_FROM_RESPONSE_DATA()".

    * Show payload for test purposes

    lo_pointer = lo_payload->get_xml_pointer( ).

    cl_proxy_service=>show_xml_document( lo_pointer-> ).

    Querying the Payload - ABAP Web Services - SAP Library??

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.