cancel
Showing results for 
Search instead for 
Did you mean: 

System-independent (and transportable) web service

Former Member
0 Kudos

Hello,

I would like to use a web service in my Interactive Form. Therefore, I created an RFC function module and created the corresponding web service. Then I launched SOAMANAGER to get the URL of the WSDL file, copy it, changed it a bit (removed the last part: "?sap-client=100", otherwise Adobe LiveCycle Designer would not accept it) and pasted into the "New Data Connection" dialog box in ALCD.

But this URL is system-dependent (begin with the development system hostname). So, once transported to other systems (integration, quality or production), it won't work anymore.

So, my first question is: how to make it system-independent?

My second question is: how to transport web services?

Thanks in advance.

Mathieu

Accepted Solutions (1)

Accepted Solutions (1)

vaibhav_tiwari
Contributor
0 Kudos

Hi Mathieu,

You have to do the configuration for web service in every system you are transporting it to.

But from adobe form side you don't need to call it everytime.

Just create two dropdowns for system id and client in the form and modify your webservice url according to the selected client and system id.

For modifying and calling the web service you need to modify the code written on the button to call the web service in the form.

There pass the modified url while connecting to web service.

For more info on dynamic url generation go through the below link:

http://forums.adobe.com/thread/719890.

Transporting a web service is similar to any object transportation in SAP.

After transporting it to another system. You have to go through the process in SOAMANAGER to create the end-points for the web service.

Hope it will help a little bit.

Regards,

Vaibhav

Former Member
0 Kudos

Hi,

Sorry for the late reply. It was tricky, but I finally found out how to make it system independant. It was really tricky to make it work fine, so here is the solution:

1) The Web Service URL will have to be an entry parameter of the Interactive PDF. You can generate it this way:


  CONSTANTS: lc_http_protocol_id  TYPE icmproto VALUE 1,
             lc_web_service_name  TYPE string   VALUE 'my_web_service_name',
             lc_http              TYPE string   VALUE 'http://',
             lc_web_service_dir   TYPE string   VALUE 'sap/bc/srt/rfc/sap',
             lc_sep               TYPE c        VALUE '/'.

    CALL FUNCTION 'ICM_GET_INFO'
      TABLES
        servlist = lt_server_info.

    LOOP AT lt_server_info  INTO ls_server_info
                            WHERE active = abap_true
                            AND protocol = lc_http_protocol_id.
*                            AND hostname CS sy-host.
    ENDLOOP.

    IF sy-subrc EQ 0.

      CONCATENATE lc_http ls_server_info-hostname ':' ls_server_info-service INTO lv_web_service_url.
      CONCATENATE lv_web_service_url
                  lc_web_service_dir
                  lc_web_service_name
                  sy-mandt
                  lc_web_service_name
                  lc_web_service_name
                  INTO lv_web_service_url
                  SEPARATED BY lc_sep.

2) In the Interactive Form, use the following javascript code:


try {
	var urlObject = xfa.record.WEB_SERVICE_URL;
	var url = urlObject.value;
	
	var request = {};
	request["urn:sap-com:document:sap:soap:functions:mc-style:MyWebServiceMethod"] = {myParameter: 'My parameter value'};	

	var response = SOAP.request({
		cURL: url,
		oRequest: request,
		cNamespace: "urn:sap-com:document:sap:soap:functions:mc-style"
	});
	
// get the response values
	xfa.record.MyValue.value = response["urn:sap-com:document:sap:soap:functions:mc-style:MyWebServiceMethod"]["MyResponseParameter"];

} catch (e) {
	xfa.host.messageBox(e.toString());
}

0 Kudos

hi Mathieu,

I have some question on the java code part.

I copy the code above and paste into the execute button event 'click' and run at 'client'.

replace 'WEB_SERVICE_URL' by the import parameter (lv_web_service_url from abap code above).

but the adobe form still point to same client (not client independent).

may I know what am I missing here?

Regards,

Lau

0 Kudos

To add some more info to Hui's issue, (since I also have the same problem),

Even though a URL generted as described above is provided with in the Adobe form, it still points to the URL in the DataConenction - this can be seen in the XML view of the Adobe Form.

Does anybody have a solution for this?

I opened a message with SAP but did not hear back yet..

0 Kudos

hi Candra,

I store the url in one of hidden field in form, then copy javascript below to click event, button control type: Regular.

just replace all the "<>" in the code below.

var message;

var response;

// The name of the data connection will be pulled from the WSDLConnection name in the ConnectionSet packet

var sWSDLName = <DataConnection name>;

// clone, modify and execute the connection.

var vConnection = xfa.connectionSet[sWSDLName].clone(true);

vConnection.soapAddress.value = <url>;

// Execute the connection, without remerge data after the result.

  var ws_rc = vConnection.execute(true);


0 Kudos

Hui,

It seems your solution works (I have to try).

Is this code adaptable to work with multiple data connections?

Can you please post this message at this url:

so that I can award points?

Thanks

Chandra

0 Kudos

hi Chandra,

for multiple data connection, you have to repeat these code with replace different data connection name and it's url address.

you may use script object (something like subroutine) for this.


Regards,

Kathy Lau

Answers (0)