cancel
Showing results for 
Search instead for 
Did you mean: 

How to use this parameter “Pass through XML data” from ABAP code ?

Former Member

Dear all,

This is my first time asking you! I hope this doubt could be answered ASAP!!

In this case we need use this parameter “Pass through XML data” from ABAP code in the execution of the ABAP proxy.

anyone knows how to use it?

the problem is the following:

We are calling the ABAP proxy on custom report “Z report” and from the receiver side the XML structure is not the same. Testing the webservice from the Test Service Consumer Tool (Image attached) we use the parameter "Pass through XML data" and the XML is Ok.

Accepted Solutions (0)

Answers (3)

Answers (3)

surajprakash_singh
Participant
0 Kudos

Hi All,

I have also faced the same issue and was able to pass data in XML in proxy like this.

FUNCTION zmvn_asset_fm_filenet.

*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(IV_DOC_CONTENT) TYPE STRING OPTIONAL
*" VALUE(IV_FILENAME) TYPE STRING OPTIONAL
*" EXPORTING
*" VALUE(EV_OBJECT_ID) TYPE STRING
*"----------------------------------------------------------------------




DATA : cl_proxy TYPE REF TO zmvn_assetco_filenet_intf.
DATA lv_buffer TYPE xstring.
DATA : req TYPE zmvn_assetpush_to_filenet_requ,
res TYPE zmvn_assetpush_to_filenet_resp,
filecontent TYPE TABLE OF zmvn_assetfile_contents_bo,
wa_filecontent LIKE LINE OF filecontent,
file TYPE TABLE OF zmvn_assetfile_content_bo,
wa_file LIKE LINE OF file.

DATA: lo_attachments TYPE REF TO if_wsprotocol_attachments.
DATA: g_attachment TYPE REF TO if_ai_attachment,
g_attachments TYPE prx_attach, "Internal table for attachment
str TYPE string, "variable of xstring type.
g_attach_xstring TYPE xstring. "variable of xstring type.

DATA : ls_param TYPE abap_parmbind,
lt_param TYPE abap_parmbind_tab.

DATA lv_str TYPE string.
DATA lv_strx TYPE xstring.
DATA lv_strx2 TYPE xstring.
DATA lv_strxre_x TYPE xstring.
DATA lv_strxres TYPE REF TO data.
DATA lo_sys_exception TYPE REF TO cx_ai_system_fault.
DATA lo_sys_exception2 TYPE REF TO zmvn_assetcx_push_to_filenet_f.

CREATE OBJECT cl_proxy EXPORTING logical_port_name = 'DEFAULT_PORT'.

FIELD-SYMBOLS:
<sproxsig> TYPE sproxsig,
<parmbind> LIKE LINE OF lt_param.

* CALL FUNCTION 'ZMVN_STRING_TO_HEXA'
* EXPORTING
* iv_input = iv_doc_content
* IMPORTING
* ev_output = wa_file-content.

CALL FUNCTION 'ZMVN_BASE64_TO_HEXA'
EXPORTING
iv_input = iv_doc_content
IMPORTING
ev_output = wa_file-content.

str = wa_file-content.


TRY.

//making xml


CONCATENATE
'<n0:PushToFilenet xmlns:n0="ur path">'
'<Input>'
'<EncryptionRequired>false</EncryptionRequired>'
'<PasswordProtection>false</PasswordProtection>'
'<RepositoryInfo>'
'<Username>P00997003</Username>'
'<Password>MOI1eizF</Password>'
'<Objectstore>sdsd</Objectstore>'
'<RootFolder>path</RootFolder>'
'<HasSubFolder>false</HasSubFolder>'
'<FolderName>sdsd</FolderName>'
'</RepositoryInfo>'
'<FileContents>'
'<FileContent><Content>' str
'</Content>'
'<RetrievalFileName>'iv_filename'</RetrievalFileName>'
'</FileContent>'
'<DocumentTitle>'iv_filename'</DocumentTitle>'
'<MetadataAdded>false</MetadataAdded>'
'</FileContents>'
'</Input>'
'</n0:PushToFilenet>' INTO lv_str.


CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = lv_str
IMPORTING
buffer = lv_strx.

ls_param-name = 'PUSH_TO_FILENET_REQUEST'..
GET REFERENCE OF lv_strx INTO ls_param-value.
INSERT ls_param INTO TABLE lt_param.

ls_param-name = 'PUSH_TO_FILENET_RESPONSE'..
GET REFERENCE OF lv_strx2 INTO ls_param-value.
INSERT ls_param INTO TABLE lt_param.


CALL METHOD cl_proxy->if_proxy_client~execute
EXPORTING
method_name = 'PUSH_TO_FILENET' " Class Name
use_xml = sprx_true " ABAP Proxies: Boolean Value ('X' = True, Space = False)
CHANGING
parmbind_tab = lt_param.


FIELD-SYMBOLS: <dref> TYPE any.
DATA lv_res TYPE string.
DATA lv_res1 TYPE string.
DATA lv_res2 TYPE string.
LOOP AT lt_param ASSIGNING <parmbind> WHERE name = 'PUSH_TO_FILENET_RESPONSE'.
lv_strxres = <parmbind>-value.
* GET REFERENCE OF lv_strxres INTO lv_strxre_x.
ASSIGN lv_strxres->* TO <dref>.
lv_strxre_x = <dref>.

CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'
EXPORTING
im_xstring = lv_strxre_x
* IM_ENCODING = 'UTF-8'
IMPORTING
ex_string = lv_res.
SPLIT lv_res AT '<ObjectID>' INTO lv_res lv_res1.
SPLIT lv_res1 AT '</ObjectID>' INTO lv_res2 lv_res1.
ev_object_id = lv_res2.
ENDLOOP.
CATCH cx_ai_system_fault INTO lo_sys_exception..

WRITE:/ 'System fault occurred:', lo_sys_exception->code, lo_sys_exception->errortext.
"returtn msg
RETURN.
CATCH zmvn_assetcx_push_to_filenet_f INTO lo_sys_exception2...
BREAK-POINT.
RETURN.
"returtn msg
ENDTRY.

* WRITE : res-output-msg TO msg.

ENDFUNCTION.
Sandra_Rossi
Active Contributor
0 Kudos

beware the password in your post...

Former Member
0 Kudos

Hi Patricio,

Did you get the resolution for this , Could you please share ?

Anil

former_member191434
Participant
0 Kudos

Hi Patricio,
If this your 1st time at ABAP proxy then this link may help you

Loading and Testing XML file using SPROXY transaction

Regards

Saifur Rahaman