Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Client Proxy and Extended XML Handling

Former Member
0 Likes
2,201

Hi guys,

Have any of you worked with a client proxy generated by a WSDL?

I am encountering the following problemu2026 when I generate the proxy, everything is fine; but when trying to consume a WebService, calling the method through my program, I receive this exception, CX_AI_SYSTEM_FAULT, with the following message:

SOAP:1.001 CX_ST_GROUP_MISSING_CASE:XSLT exception. Falta elemento PurchaseNumber

I have directly executed the proxy customer by making an test (F8) and the same mistake results, but when I activate the u201CExtended XML Handlingu201D checkbox, the client proxy works well and I obtained answers from the WebService. I have been looking for some info about Extended XML Handling and I have done what is suggested in the examples codes but the same mistake has come out. However, when executing the proxy in test and activating Extended XML Handling, it works out. I have tried to fill in the CONTROLLER tables and it didnu2019t work either.

I have debugged the proxy test and the Extended XML Handling parameter is sent, but not from my program, although I set it with u2018Xu2019 with method u201Cset_extended_xml_handlingu201D.

Has someone consume an external service by activating the Extended XML Handling from the program?

Thanks for the help!

This is my WSDL:

http://194.224.215.78/eb2bcESB/purchaseProxy?wsdl

This is my code:

v_proxy TYPE REF TO zpx_co_orderws, u201CThis is my proxy client generated with the WSDL

v_server_context = cl_proxy_access=>get_server_context( ).

v_payload_protocol ?= v_server_context->get_protocol( if_wsprotocol=>payload ).

CALL METHOD v_payload_protocol->set_extended_xml_handling( extended_xml_handling = 'X' ).

TRY.

CALL METHOD v_proxy->delete_purchases

EXPORTING

input = purchases_request

IMPORTING

output = purchases_response.

CATCH cx_ai_system_fault INTO sys_fault.

IF sys_fault IS NOT INITIAL.

v_text = sys_fault->get_text( ).

v_error = 'X'.

ELSE.

v_error = ' '.

ENDIF.

CATCH cx_ai_application_fault INTO appl_fault.

IF appl_fault IS NOT INITIAL.

v_text = sys_fault->get_text( ).

v_error = 'X'.

ELSE.

v_error = ' '.

ENDIF.

ENDTRY.

Hi guys,

Have any of you worked with a client proxy generated by a WSDL?

I am encountering the following problemu2026 when I generate the proxy, everything is fine; but when trying to consume a WebService, calling the method through my program, I receive this exception, CX_AI_SYSTEM_FAULT, with the following message:

SOAP:1.001 CX_ST_GROUP_MISSING_CASE:XSLT exception. Falta elemento PurchaseNumber

I have directly executed the proxy customer by making an test (F8) and the same mistake results, but when I activate the u201CExtended XML Handlingu201D checkbox, the client proxy works well and I obtained answers from the WebService. I have been looking for some info about Extended XML Handling and I have done what is suggested in the examples codes but the same mistake has come out. However, when executing the proxy in test and activating Extended XML Handling, it works out. I have tried to fill in the CONTROLLER tables and it didnu2019t work either.

I have debugged the proxy test and the Extended XML Handling parameter is sent, but not from my program, although I set it with u2018Xu2019 with method u201Cset_extended_xml_handlingu201D.

Has someone consume an external service by activating the Extended XML Handling from the program?

Thanks for the help!

This is my WSDL:

http://194.224.215.78/eb2bcESB/purchaseProxy?wsdl

This is my code:

v_proxy TYPE REF TO zpx_co_orderws, u201CThis is my proxy client generated with the WSDL

v_server_context = cl_proxy_access=>get_server_context( ).

v_payload_protocol ?= v_server_context->get_protocol( if_wsprotocol=>payload ).

CALL METHOD v_payload_protocol->set_extended_xml_handling( extended_xml_handling = 'X' ).

TRY.

CALL METHOD v_proxy->delete_purchases

EXPORTING

input = purchases_request

IMPORTING

output = purchases_response.

CATCH cx_ai_system_fault INTO sys_fault.

IF sys_fault IS NOT INITIAL.

v_text = sys_fault->get_text( ).

v_error = 'X'.

ELSE.

v_error = ' '.

ENDIF.

CATCH cx_ai_application_fault INTO appl_fault.

IF appl_fault IS NOT INITIAL.

v_text = sys_fault->get_text( ).

v_error = 'X'.

ELSE.

v_error = ' '.

ENDIF.

ENDTRY.

5 REPLIES 5
Read only

Former Member
0 Likes
1,321

Another characteristic I have observed in my client Proxy is that the method execute is implemented in the class IF_PROXY_CLIENT but when I execute the test mode, the method execute used is the one in the class CL_PROXY_ADAPTER_TEST. I have compared the method execute in both classes and Iu2019ve observe the following:

IF_PROXY_CLIENT uses cl_proxy_metadata=>get_outbound_proxy_data which does not have the extended_xml_handling parameter

CL_PROXY_ADAPTER_TEST uses cl_proxy_adapter_test=>outbound_test which has the extended_xml_handling parameter.

Then, what does it mean? Is it that my WSDL doesnu2019t generate the Proxy in the correct class? Should I call CL_PROXY_ADAPTER_TEST from my program and send the request with that class?

Thanks!

Read only

Former Member
0 Likes
1,321

Hi,

Any idea?

Someone knows about this?.

Thanks.

Read only

Former Member
0 Likes
1,321

I found the solution to enable XML Handling using my Client Proxy (Without using code of Proxy Test).

This is the code:

DATA v_prot_payload TYPE REF TO if_wsprotocol_payload.
.....
.....
    v_prot_payload ?= v_proxy->get_protocol( if_wsprotocol=>payload ).
    IF v_prot_payload IS BOUND.
      v_prot_payload->announce_payload_consumption( ).
      v_prot_payload->set_extended_xml_handling( extended_xml_handling = abap_true ).
    ENDIF.

Additionally, I needed to modify the XML header to include security parameters, which was driving me crazy because it did not work well. Now I have it and it works perfect, if anyone needs to do something similar, try this:

DATA: v_header_protocol TYPE REF TO if_wsprotocol_ws_header,
            v_string      TYPE string,
            xml_document  TYPE REF TO if_ixml_document,
            xml_root      TYPE REF TO if_ixml_element,
            xml_element   TYPE REF TO if_ixml_element,
            v_xstring     TYPE xstring,
            name          TYPE string,
            namespace     TYPE string.


    *Get the protocol header
    CLEAR v_header_protocol.
    v_header_protocol ?= your_client_proxy->get_protocol( 'IF_WSPROTOCOL_WS_HEADER' ).

    *Set the header with security (Username and Password)
    CLEAR v_string.
    CONCATENATE
    '<n0:Header>'
      '<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">'
        '<wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-'
           '1.0.xsd">'
          '<wsse:Username>' 'Here_your_web_service_user' '</wsse:Username>'
          '<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile'
          '1.0#PasswordText">' 'Here_your_web_service_password' '</wsse:Password>'
          '</wsse:UsernameToken>'
      '</wsse:Security>'
    '</n0:Header>'
    INTO v_string.

    CLEAR v_xstring.
    v_xstring = cl_proxy_service=>cstring2xstring( v_string ).

    CLEAR xml_document.
    CALL FUNCTION 'SDIXML_XML_TO_DOM'
      EXPORTING
        xml           = v_xstring
      IMPORTING
        document      = xml_document
      EXCEPTIONS
        invalid_input = 1
        OTHERS        = 2.
    IF sy-subrc EQ 0 AND xml_document IS NOT INITIAL.
      CLEAR: xml_root, xml_element.
      xml_root = xml_document->get_root_element( ).
      xml_element ?= xml_root->get_first_child( ).
      WHILE xml_element IS NOT INITIAL.
        CLEAR: name, namespace.
        name = xml_element->get_name( ).
        namespace = xml_element->get_namespace_uri( ).
        
        *Set the security header
        v_header_protocol->set_request_header( name = name namespace = namespace dom = xml_element ).
        
        xml_element ?= xml_element->get_next( ).
      ENDWHILE.
    ENDIF.

After this code, you can consume a webservice using User and Password.

Read only

0 Likes
1,321

Hello Angelo,

Where you have used your generated Class in GUI in the above example.

Thanks,

Mukul

Read only

0 Likes
1,321

Hello Angelo,

had encountered the same problem. After the implementation of the extended xml handling as described above it's working like a charm.

Thanks a lot, Erik