Hi.. I was getting same error. I was configuring binding via user/pass, in security tab, and the password was incorrect. Basis assign a new one, I configure the new one user/pass and the binding was created ACTIVE.
Regards!
Hi.. I was getting same error. I was configuring binding via user/pass, in security tab, and the password was incorrect. Basis assign a new one, I configure the new one user/pass and the binding was created ACTIVE.
Regards!
Hi Aravind,
I have tried to use the code which worked for you, but still get error for Invalid session id in SOAMANAGER. Could you check my code and see if you could help me:
DATA: v_session_id TYPE string,
v_session_url TYPE string.
DATA: e_output TYPE zsfdcupdate_response.
DATA: i_input TYPE zsfdcupdate_request.
DATA: update_quote_no TYPE REF TO zsfdcco_soap.
CLEAR v_session_id.
CALL FUNCTION 'ZSFDC_GET_SESSION_ID'
IMPORTING
e_session_id = v_session_id
e_session_url = v_session_url.
DATA: ixml TYPE REF TO if_ixml,
xml_document TYPE REF TO if_ixml_document,
xml_root TYPE REF TO if_ixml_element,
xml_element TYPE REF TO if_ixml_element,
xml_node TYPE REF TO if_ixml_node.
DATA: l_xstring TYPE xstring,
lv_xstring TYPE xstring,
lv_string TYPE string,
lr_xml_document TYPE REF TO if_ixml_document,
lr_xml_root TYPE REF TO if_ixml_element,
lr_xml_element TYPE REF TO if_ixml_element,
lr_xml_node TYPE REF TO if_ixml_node,
lv_name TYPE string,
lv_namespace TYPE string.
DATA l_string TYPE string.
DATA: name TYPE string,
namespace TYPE string,
go TYPE REF TO zsfdcco_soap,
lr_action TYPE REF TO zsfdcco_soap.
DATA: ls_header TYPE REF TO if_wsprotocol_ws_header.
CREATE OBJECT lr_action
EXPORTING
logical_port_name = 'ZFDC_PORT'.
ls_header ?= lr_action->get_protocol('IF_WSPROTOCOL_WS_HEADER').
CONCATENATE
'<Soap:Header>'
'<ns2:session xmlns:ns2="https://test.salesforce.com/services/Soap/c/36.0/0DFm0000000CacF">'
'<sessionid>' v_session_id '</sessionid>'
'</ns2:session>'
'</Soap:Header>' INTO lv_string.
* convert to xstring
lv_xstring = cl_proxy_service=>cstring2xstring( lv_string ).
IF NOT lv_xstring IS INITIAL.
* create ixml dom document from xml xstring
CALL FUNCTION 'SDIXML_XML_TO_DOM'
EXPORTING
xml = lv_xstring
IMPORTING
document = lr_xml_document
EXCEPTIONS
invalid_input = 1
OTHERS = 2.
IF sy-subrc = 0 AND NOT lr_xml_document IS INITIAL.
lr_xml_root = lr_xml_document->get_root_element( ).
lr_xml_element ?= lr_xml_root->get_first_child( ).
* add header element by element to soap header
WHILE NOT lr_xml_element IS INITIAL.
lv_name = lr_xml_element->get_name( ).
lv_namespace = lr_xml_element->get_namespace_uri( ).
ls_header->set_request_header( name = lv_name namespace = lv_namespace dom = lr_xml_element ).
lr_xml_element ?= lr_xml_element->get_next( ).
ENDWHILE.
ENDIF.
ENDIF.
TRY.
CALL METHOD lr_action->update
EXPORTING
input = i_input
IMPORTING
output = e_output.
CATCH cx_ai_system_fault .
CATCH zsfdccx_invalid_sobject_fault .
CATCH zsfdccx_unexpected_error_fault .
CATCH zsfdccx_invalid_id_fault .
CATCH zsfdccx_invalid_field_fault .
CATCH cx_ai_application_fault .
ENDTRY.
Hi Deepak,
We have called the Sales force application in two parts:
1. Login to the salesforce using port that is created using standard salesforce WSDL. Pass the user id and password (We maintained userid and password in custom table). The output of this is session ID.
2. We used the session ID from above and pass the required custom data to our salesforce object
Even if there is an extra space or instead of lower case if there is upper case letter or vice versa it doesnot work.
Here is the code:
Part1 : TO call the standard salesforce login.
DATA : lo_object TYPE REF TO zfi_co_soap,
ls_input TYPE zfi_login_request1,
ls_output TYPE zfi_login_response1,
ls_sys_exception TYPE REF TO cx_ai_system_fault,
lv_message TYPE bapiret2-message,
ls_ztfi_sfdc_login TYPE ty_ztfi_sfdc_login,
ls_appln_exception TYPE REF TO cx_ai_application_fault,
lv_msgid TYPE string,
lv_string TYPE string,
* Get message manager
lo_api_controller TYPE REF TO if_wd_controller,
lo_message_manager TYPE REF TO if_wd_message_manager.
lo_api_controller ?= wd_this->wd_get_api( ).
IF NOT lo_api_controller IS INITIAL.
* get the instance of message manager
CALL METHOD lo_api_controller->get_message_manager
RECEIVING
message_manager = lo_message_manager.
ENDIF.
* Create Instance for logical port ZXX_SFDC_PORT
TRY.
CREATE OBJECT lo_object
EXPORTING
logical_port_name = 'ZXX_SFDC_PORT'.
CATCH cx_ai_system_fault INTO ls_sys_exception.
ENDTRY.
* report error message if exception raised.
IF ls_sys_exception IS NOT INITIAL.
lv_message = ls_sys_exception->errortext.
* report message
CALL METHOD lo_message_manager->report_error_message
EXPORTING
message_text = lv_message
RECEIVING
message_id = lv_msgid.
EXIT.
ENDIF.
* Get SFDC Login credentials from table -
SELECT SINGLE zzuser_id
zzpassword FROM zXXXX_sfdc_login
INTO ls_zXXXx_sfdc_login
WHERE zzsysid = sy-sysid.
IF sy-subrc = 0.
ls_input-username = ls_zxxxx_sfdc_login-zzuser_id.
ls_input-password = ls_zxxxx_sfdc_login-zzpassword.
ELSE. " No SFDC login data maintained
* Report error message : Please maintain SFDC Login Credentials
wd_this->report_err_msg('056').
EXIT.
ENDIF.
CLEAR : ls_sys_exception,
ls_appln_exception.
* Call method to Login & get Session ID from SFDC
TRY.
CALL METHOD lo_object->login
EXPORTING
input = ls_input
IMPORTING
output = ls_output.
CATCH cx_ai_application_fault INTO ls_appln_exception.
CATCH cx_ai_system_fault INTO ls_sys_exception .
ENDTRY.
* report error message if exception raised.
IF ls_sys_exception IS NOT INITIAL.
lv_message = ls_sys_exception->errortext.
* report message
CALL METHOD lo_message_manager->report_error_message
EXPORTING
message_text = lv_message
RECEIVING
message_id = lv_msgid.
EXIT.
ENDIF.
* report error message if application exception raised.
IF ls_appln_exception IS NOT INITIAL.
* report message : Invalid SFDC Login Username or Password
wd_this->report_err_msg('057').
EXIT.
ENDIF.
* Check session ID
IF ls_output-result-session_id IS NOT INITIAL.
MOVE ls_output-result-session_id TO wd_this->gv_session_id.
* raise_alert( ). " raise alert
ENDIF.
Part 2 : To call the custom salesforce app
IF wd_this->gv_session_id IS NOT INITIAL.
TRY.
CREATE OBJECT lo_object1
EXPORTING
logical_port_name = 'ZXXXX_SFDC_OBJECT_PORT'.
CATCH cx_ai_system_fault INTO ls_sys_exception.
ENDTRY.
IF ls_sys_exception IS NOT INITIAL.
lv_message = ls_sys_exception->errortext.
* report message
CALL METHOD lo_message_manager->report_error_message
EXPORTING
message_text = lv_message
RECEIVING
message_id = lv_msgid.
CLEAR lv_message.
EXIT.
ENDIF.
** get ws_header protocol
TRY.
ls_header ?= lo_object1->get_protocol(
'IF_WSPROTOCOL_WS_HEADER').
CATCH cx_ai_system_fault INTO ls_sys_exception.
ENDTRY.
CONCATENATE
'<Soap:Header xmlns:Soap="http://schemas.xmlsoap.org/soap/envelope/">'
'<urn:SessionHeader xmlns:urn="urn:enterprise.soap.sforce.com">'
'<urn:sessionId>' wd_this->gv_session_id '</urn:sessionId>'
'</urn:SessionHeader>'
'</Soap:Header>'
INTO lv_string.
lv_xstring = cl_proxy_service=>cstring2xstring( lv_string ).
IF NOT lv_xstring IS INITIAL.
* create ixml dom document from xml xstring
CALL FUNCTION 'SDIXML_XML_TO_DOM'
EXPORTING
xml = lv_xstring
IMPORTING
document = lr_xml_document
EXCEPTIONS
invalid_input = 1
OTHERS = 2.
IF sy-subrc = 0 AND NOT lr_xml_document IS INITIAL.
lr_xml_root = lr_xml_document->get_root_element( ).
lr_xml_element ?= lr_xml_root->get_first_child( ).
* add header element by element to soap header
WHILE NOT lr_xml_element IS INITIAL.
lv_name = lr_xml_element->get_name( ).
lv_namespace = lr_xml_element->get_namespace_uri( ).
ls_header->set_request_header( name = lv_name
namespace = lv_namespace
dom = lr_xml_element ).
lr_xml_element ?= lr_xml_element->get_next( ).
ENDWHILE.
ENDIF.
ENDIF.
ELSE. " No session ID created
EXIT.
ENDIF.
* Call the required methods
TRY.
CALL METHOD lo_object1->view_latest_dispute_cases
EXPORTING
input = ls_input_latest
IMPORTING
output = ls_output_latest.
CATCH cx_ai_system_fault INTO ls_sys_exception.
CATCH cx_ai_application_fault INTO ls_appln_exception.
ENDTRY.
Thank you Arvind for your prompt response!!
It worked!!
we were breaking our head for last two days. You Rock!!
Arvind,
Have you had chance to work on opportunity update for salesforce enterprise WSDL?
We are not sure how to pass the opportunity object to the update method.
Your help is highly appreciated.
Hi Deepak,
I'm not sure of the opportunity update.
If you are talking about any update to salesforce data, you need to call the corresponding method and pass the required data. In our case, we are updating the inquiries/disputes that are created in salesforce.
Thanks again Arvind for your response.
I our case we have to update opportunity with quote number from SAP and the update method does not specify fields explicitly how to map the fields to the WSDL structure which is very confusing.
Thanks again!!
Let me know how could I get you points for your help.
Hi Deepak,
Without your structure( attribute of method created by consuming WSDL given by salesforce) containing the required fields you cannot pass the data. Ask your salesforce counter part to add the required fields and then give the WSDL to you so that, you can again regenerate your code.
Reg points...since this thread was started by me...you cannot give points here
Thanks,
Aravind.
I have data in internal table . I want send this data to another program from SAP system. Can you help me? What I must do for sending data with web service . I must function module create?
Hi,
this depends whether you want to implement a SOAP or a REST web service.
For a SOAP web Service you can create a function modul and use the wizard to create the webservice. For a REST web service you create a SICF-Service and add a custom HTTP handler.
Hi Robert,
The question is if you want to pass data between two abap programs or if what you want is to build a web service for exposing data outside sap system?
If you want to pass data between two abap programs, you can do the following:
Passing Data Between Programs - ABAP Programming (BC-ABA) - SAP Library
In case you want to expose data, you can build an odata web service which is the standard that sap is using for fiori:
Step-by-step guide to build an OData Service based on RFCs – Part 1
Regards,
Emanuel
I already created function module which will just show data.
For testing let's read data and into internal table , how I can after read show data as xml format in browser
You can see xml in the browser if you develop odata web services.
You can choose between xml and json format.
Regards,
Emanuel
hello,
I am trying to test standard SAP web service.
employeemasterdatareplicationr_OUT
1. I tried it from SOAPUI tool with the WSDL file,
SRT: Plain SOAP: Reliable messaging (RM) configured, but no Message ID and no WSRM assertion provided.
2. I tried test from SOAMANAGER then I am getting following error -- (button "open web service navigator for selected binding")
then it routing to wsnavigator and getting 404 error.
3. WS Navigator is not working from SAP.
http://hostname:50000/wsnavigator - this is also not working 404 error.
Can you please let me know how tot resolve these errors?
Regards,
Khaja.
Were you able to achieve the above said interface?
Thanks
Ragu
Yes...
Hello Ashok,
How did you achieve it? Do Magento work with webservice? Can we use SAP PI SOAP adapter for Magento integration?
Regards
Ragu
It worked with webservice.
Hello,
I cannot test web service using WSNAVIGATOR.
WS Navigator is not working from SAP.
http://hostname:8001/wsnavigator - not working 404 error.
i am getting the following error. can you please let me know how to solve this error?
Service cannot be reachedWhat has happened?URL call was terminated because the corresponding service is not available. |
Note The termination occurred in system with error code 404 and for the reason Not found. |
What can I do?Please select a valid URL.
HTTP 404 - Not found Your SAP Internet Communication Framework Team |