cancel
Showing results for 
Search instead for 
Did you mean: 

Starting workflow with HTTP-Post

Former Member
0 Kudos

Hello,

I have an installation of SAP ERP 2005 SR2 IDES on Win2003 SR2 SP2 and want to start a simple workflow with an external application. Therefor I created an elementary test-workflow and set the general task flag so everybody is allowed to start it. So far everything work fine as I start it manually.

Now I want to start the workflow by an external application over a HTTP-Post as described in

http://help.sap.com/saphelp_47x200/helpdata/EN/54/de9e3887d6174fe10000009b38f842/content.htm

I configured the webserver (Customizing Web-Server) as follows:

Service: WebFlow (Intranet)

Address: http://192.168.0.216:8000/

Path: SAP/BC/WORKFLOW_XML/?

and sent a post via perl to http://192.168.0.216:8000/SAP/BC/WORKFLOW_XML/?protocol=01&localkey=WS99900004

<?xml version="1.0" ?>

<WfMessage Version="1.0" xmlns="http://www.wfmc.org/standards/doc/WF-XML">

<WfMessageHeader>

<Request ResponseRequired="No">

<Key>http://192.168.0.216:8000/SAP/BC/WORKFLOW_XML/?protocol=01&localkey=WS99900004</Key>

</WfMessageHeader>

<WfMessageBody>

<CreateProcessInstance.Request StartImmediately="true">

<ObserverKey>http://192.168.0.224</ObserverKey>

</CreateProcessInstance.Request>

</WfMessageBody>

</WfMessage>

The Web-Server returns

C:\FH\SAP\perl-scripte>perl http-post.pl

HTTP/1.1 200 OK

Server: SAP Web Application Server (1.0;700)

Content-Length: 0

Content-Type: text/plain

Client-Date: Sun, 01 Jun 2008 11:00:24 GMT

Client-Peer: 192.168.0.216:8000

Client-Response-Num: 1

but it seems that nothing happens.

Where can I get some more information like log-messages or did I forgot something essential?

Accepted Solutions (1)

Accepted Solutions (1)

Boris_Rubarth
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Daniel,

sorry, my fault: response can have length 0.

Rgds, Boris

Answers (3)

Answers (3)

Boris_Rubarth
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Daniel,

the image shows the ICF recording with content-length = 0 for the request, I am not sure, but that should not be, since you submit an xml document, right?

Regards, Boris

Former Member
0 Kudos

the image shows the response from sap-system. I think there is content-length = 0 ok, isn't it?

Here is the [request|http://img227.imageshack.us/img227/4324/sicfrequestyr7.jpg] with [sourcecode|http://img219.imageshack.us/img219/1504/sicfsrcuo5.jpg]

athavanraja
Active Contributor
0 Kudos

just place an http break point in class CL_HTTP_WORKFLOW_XML method

IF_HTTP_EXTENSION~HANDLE_REQUEST to debugg and see whether the request get passed properly or not.

(this is the handler class for your service in sicf)

Raja

Former Member
0 Kudos

thx for that hint.

The debugger starts after I sent xml-post. It's conspicuous that variable RC turns into 1 after line 95

 rc = prequestdoc->parse_xstring( stream = xml_as_xstring ).

Later are following a lot of requests

 if rc = 0 

Do you know if I am on the right track? Or isn't rc relevant in my case?

[Screenshot|http://img161.imageshack.us/img161/8857/debuggermm5.jpg]

Former Member
0 Kudos

as I wrote in :

perhaps I have a fundamential wrong comprehension, but shouldn't trigger the service workflow_xml (default_host/sap/bc/workflow_xml) any event after he gets the wf-xml message?

I started event trace, sent a xml to workflow_xml and nothing happened: http://img238.imageshack.us/img238/8756/eventtracezp1.jpg

Former Member
0 Kudos

thx to all and for interested... it works with SOAP:

Former Member
0 Kudos

Thx for the hint of the recorder. I get an error message which is probably the reason why the workflow doesn't start.

Daniel

Former Member
0 Kudos

sorry, it wasn't an error... the xml-request couldn't be displayed correctly.

So I have no idea why it doesn't work, posted my question also in [BPM and Workflow|; and hope for an answer.

athavanraja
Active Contributor
0 Kudos

ICM expects a FQDN (fully qualified domain name) in the url. it will not work with ip address (http://192.168.0.216:8000/). it should be something like http:abahose.mydomain.com:port

Raja

Former Member
0 Kudos

I inserted into client and server C:\WINDOWS\system32\drivers\etc\hosts

192.168.0.216	imperia-sap.imperia.net
192.168.0.50	dangileri-mob.imperia.net

updated web-server [web-server configuration|http://img412.imageshack.us/img412/7638/customizingwebserverjg0.jpg]

and sent request via perl


#!/usr/bin/perl

use strict;

use LWP::UserAgent;
use HTTP::Request::Common;

my $userAgent = LWP::UserAgent->new(agent => 'perl post');

my $message = "<?xml version=\"1.0\" ?>
<WfMessage Version=\"1.0\" xmlns=\"http://www.wfmc.org/standards/doc/WF-XML\">
    <WfMessageHeader>
        <Request ResponseRequired=\"No\" />
        <Key><a href="http://imperia-sap.imperia.net:8000/SAP/BC/WORKFLOW_XML/?~protocol=03&~localkey=WS99900004" TARGET="test_blank">http://imperia-sap.imperia.net:8000/SAP/BC/WORKFLOW_XML/?~protocol=03&~localkey=WS99900004</a></Key>
    </WfMessageHeader>
    <WfMessageBody>
        <CreateProcessInstance.Request StartImmediately=\"true\">
        <ObserverKey><a href="http://dangileri-mob.imperia.net:80" TARGET="test_blank">http://dangileri-mob.imperia.net:80</a></ObserverKey>
        <ContextData><ContextData />
        </CreateProcessInstance.Request>
    </WfMessageBody>
</WfMessage>";


my $response = $userAgent->request( POST 'http://imperia-sap.imperia.net:8000/SAP/BC/WORKFLOW_XML/?',
                                    Content_Type    =>  'text/xml',
                                    Content         =>  $message,
                                    Authorization   =>  'BASIC ***password***');
                                    
print $response->error_as_HTML unless $response->is_success;

print $response->as_string;

As before I get a [reaction of SICF|http://img141.imageshack.us/img141/29/sicfwm9.jpg] but the workflow WS99900004 won't started

Boris_Rubarth
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi ,

probably the forum [BPM and Workflow|; is a better place to find someone familiar with that.

Regarding the question on log messages: transaction SICF offers the possibility to swith on a recorder. Select the service that is called form outside (in this case sap/bc/workflow_xml ?) and use menu edit/recorder/activate recording. Send another request and check the recording: menu edit/recorder/display recording.

Regards,

Boris