Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

HTTPClient_Services

Don,
I am trying to convert the 162 line 'Process_XML_SOAP' to a routine to use your HTTPClient_Services, to see if I can solve this random timeout issue.
I am now stuck.
First off I dont know what I should be calling next after "Send" and in what sequence and what checks I should be doing.
What I have done below as a test of what is returned, is giving me an error in ResponseStatusCode of 12019
All the other returned values are null

Can you help me out please, and let me know what I am doing wrong.
If you need the Funeral_16272P.XML file, I will have to email it to you and it contains a username/password in the body. (The url is for a testing site, so is ok to access.)

If this needs to be a consulting job, then so be it and let me know and I will send you all the existing related code.(this is the FuneralsManager system that you did the original http/xml stuff for me)

osread PayLoad from "C:\FM_WORKAREA\Funeral_16272P.XML" then URL = "https://lifelinkuat.bdm.nsw.gov.au/lifelink/b2b/LodgeDRS.wsdl" Header='' // Set header for content type of XML to be transmitted Header<1, 1> = "Content-Type" Header<2, 1> = "text/xml" Header<3, 1>="operation" // Set header with the entire xml string length for verification on their end Header<1, 2> = "Content-length" Header<2, 2> = Len(PayLoad) Header<3, 2> = "LodgeDRS" HeaderList=Header Body=Payload ProxyUser='' ProxyPassword='' UseAsynchronous=yes$ UseXMLHTTP=yes$ response = HTTPClient_Services('SendHTTPRequest', "Send", URL, HeaderList, Body, ProxyUser, ProxyPassword, UseAsynchronous, UseXMLHTTP) StatusMsg=error_services("GetMessages") ResponseHeaderFields=HTTPClient_Services('GetResponseHeaderFields') ResponseStatusCode=HTTPClient_Services('GetResponseStatusCode') ResponseStatusPhrase=HTTPClient_Services('GetResponseStatusPhrase') debug

Comments

  • Barry,

    There may very well be additional issues that we need to try and work on, but the first thing I noticed is your URL variable contains an entire HREF tag rather than just a URL. Am I missing something? If not, then I would not expect this to work.
  • Barry,

    Also your header variable I believe is out of alignment. It should be setup like this now:

    Header<-1> = "Content-Type" : @ VM : "text/xml"
    Header<-1> = "Content-Length" : @ VM : Len(Payload)
    etc
  • Paul,

    Do you think that could be an issue with the original code, even though it been working(well sort of I suppose)
    Here is how it is used in process_xml_soap

    If Header then // First transmit any header information NumHeaders = Count(Header<1>, @VM) + (Header<1> NE "") For HeadLoop = 1 to NumHeaders While Continue rv = OLECallMethod(Object, "setRequestHeader", Header<1, HeadLoop>, Header<2, HeadLoop>) Status = OleStatus() If OleStatus() then Response = "OLE Error Code setRequestHeader: ":Status Continue = No$ end Next HeadLoop end
  • Barry,

    I don't believe so. Process_XML_Soap used headers in a paired way where 1, 1 was the item and 2, 1 was the value. Then 1, 2 was the item and 2, 2 was the value.

    That was always an odd way of doing it, but that's what I first worked with and it kind of stuck through the years. With the creation of HTTPClient_Services, we decided to make the Headers variable more normal. So now it is:
    1, 1 is the item and 1, 2 is the value. Then 2, 1 is the item and 2, 2 is the value.
  • Don,

    That must have been the forum formatting as this is the line:

    URL = "https://lifelinkuat.bdm.nsw.gov.au/lifelink/b2b/LodgeDRS.wsdl"
  • changed to:

    Header=''
    Header<-1> = "Content-Type" : @VM : "text/xml"
    Header<-1> = "Content-Length" : @VM : Len(Payload)
    Header<-1> = "operation" : @VM : "LodgeDRS"

    same error
  • Barry,

    A few other tests to try is with the Variables:
    UseAsynchronous=yes$
    UseXMLHTTP=yes$

    If you set UseXMLHTTP to No$, this should cause you to use the server version, which I believe is preferred.
    If you still don't see any improvements, try setting the UseAsynchronous to No$
  • Paul,
    did UseXMLHTTP =No$ (agree, misunderstood the use)

    processing for ages, had to abort (Editor - compile and run)

    tried
    UseAsynchronous=no$

    immediate with nothing in any get values

    I will run again with UseAsynchronous=yes$ and see if it 'runs out'
  • Barry,

    Took another look, and might have found something else. Now Don might overrule me as I may not have the most up to date copy of HTTPClient_Services at the moment, but I believe your code:

    response = HTTPClient_Services('SendHTTPRequest', "Send", URL, HeaderList, Body, ProxyUser, ProxyPassword, UseAsynchronous, UseXMLHTTP)

    should be:

    response = HTTPClient_Services('SendHTTPRequest', "POST", URL, HeaderList, Body, ProxyUser, ProxyPassword, UseAsynchronous, UseXMLHTTP)
  • tried POST, same hang problem, which is actually in the httpclient_services @ line 170 (could be out with my debugs) = If UseAsynchronous then........
    Timeout value was 1800 changed to hardcoded 100 to exit quicker.

    on the loop exit got to here:
    line 184

    Response = SRP_COM(objXMLHTTP, 'GET', 'responseBody')
    If SRP_COM('', 'HASERROR') then
    Error = 'Error getting the responseBody property for the XMLHTTP object in the ' : Service : ' service.'
    Error := ' SRP_COM Error: ' : SRP_COM('', 'ERROR')
    Error_Services('Add', Error)
    Response = ''

    Which I understand BUT, the calling prog has:
    StatusMsg=error_services("GetMessages")
    for which I get null, how should I be retrieving the error message?
  • ..sorry should have said that the debug showed it did execute the Error_Services('Add', Error)
  • Paul is correct. That argument is the Method.
  • Barry,

    You are saying that the SRP_COM is generating an error?
  • Yes, because the loop was exited without a ReadyState being returned.

    If UseAsynchronous then StartTime = GetTickCount() TimeoutDuration = 100 ;*HTTPClient_Services('GetTimeoutDuration') TimedOut = False$ Loop ReadyState = SRP_COM(objXMLHTTP, 'GET', 'readyState') CurrentTime = GetTickCount() ElapsedTime = Int((CurrentTime - StartTime) / 1000) TimedOut = ElapsedTime GE TimeoutDuration While (ReadyState NE HTTP_COMPLETED$) AND Not(TimedOut) Repeat end

    it went down the error path

    // Check the XMLHTTP object's responseBody property to get the server's response. Response = SRP_COM(objXMLHTTP, 'GET', 'responseBody') If SRP_COM('', 'HASERROR') then Error = 'Error getting the responseBody property for the XMLHTTP object in the ' : Service : ' service.' Error := ' SRP_COM Error: ' : SRP_COM('', 'ERROR') Error_Services('Add', Error) Response = '' end else HTTPClient_Services('SetResponseBody', Response) end


    this was executed, so was wanting to findout how I should be getting the error message.

    Error = 'Error getting the responseBody property for the XMLHTTP object in the ' : Service : ' service.'
    Error := ' SRP_COM Error: ' : SRP_COM('', 'ERROR')
    Error_Services('Add', Error)
    Response = ''
Sign In or Register to comment.