Skip to main content

Hi all,

I'm trying to get the response and content from the URL using UHTTP.
vStatus = vUHTTP->SEND(vURI, "GET", "", "", vHeaders, vContent, vResponse)

I get the response 200 OK. But I'm not receiving the Content. If I access the url from the browser I get a xml content. I expect the same xml content using UHTTP also.

Could you please help to resolve this issue.







------------------------------
Thanks,
Satheesh MuthuGopal
------------------------------

Hi all,

I'm trying to get the response and content from the URL using UHTTP.
vStatus = vUHTTP->SEND(vURI, "GET", "", "", vHeaders, vContent, vResponse)

I get the response 200 OK. But I'm not receiving the Content. If I access the url from the browser I get a xml content. I expect the same xml content using UHTTP also.

Could you please help to resolve this issue.







------------------------------
Thanks,
Satheesh MuthuGopal
------------------------------

Hi all,

I have created the headers and specified application/xml. But after the SEND request, I get the content back in html. Also the vHeaders changed to text/html

putitem/id vHeaders, "Content-Type", "application/xml; charset=UTF-8"
putitem/id vheaders, "Accept-Charset", "ISO-8859-1 ; q = 0.4, UTF-16BE; q=0.9"

Do I need define value for vContent also before calling the SEND request to get the response back in xml format ?



------------------------------
Thanks,
Satheesh MuthuGopal
------------------------------

Hi all,

I have created the headers and specified application/xml. But after the SEND request, I get the content back in html. Also the vHeaders changed to text/html

putitem/id vHeaders, "Content-Type", "application/xml; charset=UTF-8"
putitem/id vheaders, "Accept-Charset", "ISO-8859-1 ; q = 0.4, UTF-16BE; q=0.9"

Do I need define value for vContent also before calling the SEND request to get the response back in xml format ?



------------------------------
Thanks,
Satheesh MuthuGopal
------------------------------

Morning,

It depends on how the api is set up. If it is prepared to return multiple formats, you could pass "accept-content" in the header of your request. But as I said, the api has to be ready to accept this.

Who defines what to return is the api you called.



------------------------------
Juliano Anoar Haoach Garcia
Suport Analyst
Coamo -Coop. Agropecuaria Mouraoense
Campo Mourão BR
------------------------------

Hi all,

I have created the headers and specified application/xml. But after the SEND request, I get the content back in html. Also the vHeaders changed to text/html

putitem/id vHeaders, "Content-Type", "application/xml; charset=UTF-8"
putitem/id vheaders, "Accept-Charset", "ISO-8859-1 ; q = 0.4, UTF-16BE; q=0.9"

Do I need define value for vContent also before calling the SEND request to get the response back in xml format ?



------------------------------
Thanks,
Satheesh MuthuGopal
------------------------------

Hi Satheesh 

I tested it with the following examples
-1-
<?xml version="1.0" encoding="utf-8">
<root>
    <element attribute="attribute">test xml</element>
</root>

-2-
<?xml version="1.0" encoding="utf-8">
<!DOCTYPE html>
<html>
    <head>
        <title>title</title>
    </head>
    <body>
        <h1>test xhtml5</h1>
    </body>    
</html>

-3-
<!DOCTYPE html>
<html>
    <head>
        <title>title</title>
    </head>
    <body>
        <h1>test html5</h1>
    </body>    
</html>

works file, my component looks like;

; Your component defines here (optional)...
; Your component VARIABLES block here (optional)...
operation exec

    variables
        string vUri       
        string vContent   
        string vSoapAction   
        string vResponse  
        numeric vPStatus, vStatus
    endVariables

   vUri = "http://localhost:8080/tcco/test.html"    
   vStatus = $instanceHandle()->uHttp("", "", vUri, vContent, vSoapAction, vResponse, vPStatus) 
   help "%%vResponse%%%%%^%%vContent%%%"
        
  ; edit

   return 0

end


operation uHttp
    params
        string pUserName   : IN ; Credentials
        string pPassword   : IN ; Credentials
        string pUri        : IN ; 
        string pContent    : INOUT ; XML soap envelope
        string pSoapAction : IN ; Soap Action
        string pResponse   : OUT
        numeric pStatus  : OUT ; get_status    
    endParams
    
    variables
        handle  vUHTTP
        numeric vStatus
        string  vURI, vHeaders, vContent, vResponse, vUsername, vPassword
    endvariables
    
    newinstance "UHTTP", vUHTTP

    vHeaders = ""
    putitem/id vHeaders, "Content-Type", "text/xml; charset=UTF-8"
    putitem/id vheaders, "Accept-Encoding", "gzip,deflate"
    putitem/id vheaders, "SOAPAction", pSoapAction
    
    vUsername = ""
    putitem vUsername, -1 "%%pUsername%%%(scheme=L)"
    
    vStatus = vUHTTP->SEND(pURI, "POST", vUsername, pPassword, vHeaders, pContent, pResponse)
    
    return(vStatus)
    
end; operation uHttp



------------------------------
Dino Seelig
CTO
Tcco
Drunen NL
------------------------------

Hi Satheesh 

I tested it with the following examples
-1-
<?xml version="1.0" encoding="utf-8">
<root>
    <element attribute="attribute">test xml</element>
</root>

-2-
<?xml version="1.0" encoding="utf-8">
<!DOCTYPE html>
<html>
    <head>
        <title>title</title>
    </head>
    <body>
        <h1>test xhtml5</h1>
    </body>    
</html>

-3-
<!DOCTYPE html>
<html>
    <head>
        <title>title</title>
    </head>
    <body>
        <h1>test html5</h1>
    </body>    
</html>

works file, my component looks like;

; Your component defines here (optional)...
; Your component VARIABLES block here (optional)...
operation exec

    variables
        string vUri       
        string vContent   
        string vSoapAction   
        string vResponse  
        numeric vPStatus, vStatus
    endVariables

   vUri = "http://localhost:8080/tcco/test.html"    
   vStatus = $instanceHandle()->uHttp("", "", vUri, vContent, vSoapAction, vResponse, vPStatus) 
   help "%%vResponse%%%%%^%%vContent%%%"
        
  ; edit

   return 0

end


operation uHttp
    params
        string pUserName   : IN ; Credentials
        string pPassword   : IN ; Credentials
        string pUri        : IN ; 
        string pContent    : INOUT ; XML soap envelope
        string pSoapAction : IN ; Soap Action
        string pResponse   : OUT
        numeric pStatus  : OUT ; get_status    
    endParams
    
    variables
        handle  vUHTTP
        numeric vStatus
        string  vURI, vHeaders, vContent, vResponse, vUsername, vPassword
    endvariables
    
    newinstance "UHTTP", vUHTTP

    vHeaders = ""
    putitem/id vHeaders, "Content-Type", "text/xml; charset=UTF-8"
    putitem/id vheaders, "Accept-Encoding", "gzip,deflate"
    putitem/id vheaders, "SOAPAction", pSoapAction
    
    vUsername = ""
    putitem vUsername, -1 "%%pUsername%%%(scheme=L)"
    
    vStatus = vUHTTP->SEND(pURI, "POST", vUsername, pPassword, vHeaders, pContent, pResponse)
    
    return(vStatus)
    
end; operation uHttp



------------------------------
Dino Seelig
CTO
Tcco
Drunen NL
------------------------------
Hi Juliano, Hi Dino,
 
Sorry for the very delayed reply. I was fully packed with other priorities. 
 
I tried these methods. But I get error -12 (Please note I'm using Uniface 10.4.01)
 
I used : vUHTTP->SET_FLAGS(2) - to avoid the error.
 
Also I tried to send the request either with POST or GET. I see the HTML content if I use POST. 
 
I get the content in HTML format including the URL which I passed as  a parameter in send request. But the URL was updated with authentication parameters. Unfortunately, I'm not getting the actual body content of the URL (if I use the link in chrome I get the xml. But unable to get from UHTTP)
 
As of now we are using OCX container and I'm trying to change this approach to UHTTP. 
 
I tried sending the request with various vheader parameter like text/xml, application/xml and text/html,application/xhtml+xml,application/xml but nothing helps.
 
Do I need to include ca-bundle.crt in my uniface installation at common/usys? if yes, how can I generate this ca-bundle.crt
 
or am I missing something else ?
 
Thanks,
 
Satheesh


------------------------------
Thanks,
Satheesh MuthuGopal
------------------------------
Hi Juliano, Hi Dino,
 
Sorry for the very delayed reply. I was fully packed with other priorities. 
 
I tried these methods. But I get error -12 (Please note I'm using Uniface 10.4.01)
 
I used : vUHTTP->SET_FLAGS(2) - to avoid the error.
 
Also I tried to send the request either with POST or GET. I see the HTML content if I use POST. 
 
I get the content in HTML format including the URL which I passed as  a parameter in send request. But the URL was updated with authentication parameters. Unfortunately, I'm not getting the actual body content of the URL (if I use the link in chrome I get the xml. But unable to get from UHTTP)
 
As of now we are using OCX container and I'm trying to change this approach to UHTTP. 
 
I tried sending the request with various vheader parameter like text/xml, application/xml and text/html,application/xhtml+xml,application/xml but nothing helps.
 
Do I need to include ca-bundle.crt in my uniface installation at common/usys? if yes, how can I generate this ca-bundle.crt
 
or am I missing something else ?
 
Thanks,
 
Satheesh


------------------------------
Thanks,
Satheesh MuthuGopal
------------------------------

Hi Satheesh,

Setup Tomcat, Create a domainname, place an index.html folder, test it (localhost:8080/domainname/index.html)

When that is done, test this from Uniface.

When that works fine...than you know, Uniface config looks ok.

The next step is a third party domain using for example certificates....did you follow the previous steps?

Cheers

Dino



------------------------------
Dino Seelig
CTO
Tcco
Drunen NL
------------------------------