Invoking CGI URL via http

Hello.

I need to invoke a CGI service, where the URL is given to me. And i’m supposed to wait for the reply back from this URL.
I will send an XML, via http to this URL, and receive back another XML, via http.

  1. Would i still use the ‘invoke method’? Or is invoking the CGI URL different from invoking a normal URL?

  2. If i wish to submit in a user ID and password to this CGI URL, how do i pass on this info to the URL, including my data?

You can use the pub.client:http service to access the url, submit the xml and get the response back. If you look into this service, you can see that there is a place where you can provide the username and password.
Good luck.

i tried setting the userID and password into the ‘auth’ section.
but would the content-type be ‘text/xml’ or ‘application/x-www-form-urlencoded’?

Initially i used content-type = ‘text/xml’, but my statusMessage came back as Connection=‘closed’.
the UserID and password is correct. but my statusMessage=‘Not Found’.

am i doing something wrong?

The content-type ‘text/xml’ should be fine. After the http step, you will have to map the body/bytes to a bytesToString step. This will let you see the output of the invoke.
By the way, are you able to access the URL from an internet explorer?
Thanks

yes. i tried the URL from Internet Explorer. And it’s working.

unfortunately, i kept getting a status code of 440, and statusMessage = not found.

so i tried hardcoding the UserID and password into the CGI URL. but still failure.

i understand i’m supposed to use the ‘auth’ section to input the userID and password in, but either way of using the ‘auth’ or hardcoding the userID into the URL is not working.

Hi, Jennifer.

Do you kow if your CGI script is expecting variables via the POST method or GET method?

GET variables can be appended to the end of a URL (http://www.wmusers.com/some-script.cgi?var1=value1&var2=value2.

POST variables must be sent via a FORM.

CGI URLs are no different from regular URLs. You’ll be able to dig up more information from the Perl error log.

Do you have the method set as POST?
Thanks

yes. it’s set as POST.

ok. now it’s working, statusCode=200, statusMessage=OK.
but after mapping the body/byte to the byteToString service,
i’m getting the string=Empty String.

did i map the right thing properly?

You mean the string that is returned from bytesToString is empty? If it is, you should talk to the CGI URL person whether they receive the xml document or not.
Thanks

so do i set the method as POST or GET?
(i’m kinda confused when do i use wat)

in btw, i’m facing quite a baffling thing here.
I created to services to http to the CGI URL.

SERVICE 1, is where i will 'Send XML" using the developer, with the data in it.

SERVICE 2, i enter the data manually (using the ‘map’ step).

Why is it that when i run the service, SERVICE 2 works, but SERVICE 1 keeps prompting me errors???

okie. yesterday i hardcoded the authorisation info into the cgi url (http://username:password@www….\cgi ) and i could manage to get the statusCode=220, n statusMessage=OK.

Today, it keeps prompting me ‘authorisation required’. but when i tried the CGI URL direct from the Internet Explorer with the same userName and password, it was working.

did i code the URL in wrongly? or is there a more fool-proof reliable method for me to put in my authorisation information?

If you look in the headers section under the INPUT to pub.client:http, there is a user and pass variables that you need to set with your username and password.

Ray

Considering that i have to submit the information with authorisation information(including the data), and i have to expect the results back, do i set the info at “GET” or “POST”?
Someone advised me to use “POST”, but another person submitted to the CGI URL, via an .asp page, and set the settings as “GET”, and the URL as "http://www…/.cgi?XML_STRING="

how would i incorporate that into my URL?

It’s pretty easy. One of the inputs to pub.client:http is method. The only two choices you have are GET/POST.

I recommend two things:

  1. Read all about pub.client:http in the Integration Built-in Services Guide. It is in the developer folder under ./developer/doc/guides (v.6.0+) or ./developer/doc for earlier versions.

  2. You can test your idea by invoking the flow directly and filling in the information. You can then check to see which method will provide the return of data for you successfully.

Hope this helps (HTH)

Ray

  1. use “get” to send your xml data
  2. make sure the url from where the response is sent uses “post”.

same as you got, I won’t be able to grab the data returned from that invoke…instead, i need to call a remote servlet in request/response mode.
anyone here can suggest ??? thanks,

j-