Forum
× Components and Libraries for Web Development, discussions, problems and suggestions

Question pl_wst EXMLReadError in CentOS 7

  • Md. Shariful Alam Khan
  • Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
4 years 2 months ago #8682 by Md. Shariful Alam Khan
pl_wst EXMLReadError in CentOS 7 was created by Md. Shariful Alam Khan
I am getting following error:
Exception at 00000000005029AE: EXMLReadError:
In 'stream:' (line 1 pos 1345): Unmatching element end tag (expected "</HR>").
Below is my code:
procedure Execute;
var
vGetMerchant: UnicodeString;
send: SendTranRequest;
me: Merc;
tr: TranData;
vcard : Card;
begin
send := SendTranRequest.Create;
me := Merc.Create;
me.id := UnicodeString(GatewayID);
me.regKey := UnicodeString(RegKey);
send.merc := me;
tr := TranData.Create;
tr.tranNr := '1';
case trancode of
'0': send.tranCode := SendTranRequest_tranCode_Type.SendTranRequest_tranCode_Type__0;
'1': send.tranCode := SendTranRequest_tranCode_Type.SendTranRequest_tranCode_Type__1;
'2': send.tranCode := SendTranRequest_tranCode_Type.SendTranRequest_tranCode_Type__2;
'3': send.tranCode := SendTranRequest_tranCode_Type.SendTranRequest_tranCode_Type__3;
'4': send.tranCode := SendTranRequest_tranCode_Type.SendTranRequest_tranCode_Type__4;
'5': send.tranCode := SendTranRequest_tranCode_Type.SendTranRequest_tranCode_Type__5;
'6': send.tranCode := SendTranRequest_tranCode_Type.SendTranRequest_tranCode_Type__6;
'7': send.tranCode := SendTranRequest_tranCode_Type.SendTranRequest_tranCode_Type__7;
'9': send.tranCode := SendTranRequest_tranCode_Type.SendTranRequest_tranCode_Type__9;
'10': send.tranCode := SendTranRequest_tranCode_Type.SendTranRequest_tranCode_Type__10;
'11': send.tranCode := SendTranRequest_tranCode_Type.SendTranRequest_tranCode_Type__11;
'12': send.tranCode := SendTranRequest_tranCode_Type.SendTranRequest_tranCode_Type__12;
'13': send.tranCode := SendTranRequest_tranCode_Type.SendTranRequest_tranCode_Type__13;
'14': send.tranCode := SendTranRequest_tranCode_Type.SendTranRequest_tranCode_Type__14;
'15': send.tranCode := SendTranRequest_tranCode_Type.SendTranRequest_tranCode_Type__15;
'17': send.tranCode := SendTranRequest_tranCode_Type.SendTranRequest_tranCode_Type__16;
'18': send.tranCode := SendTranRequest_tranCode_Type.SendTranRequest_tranCode_Type__18;
end;
vcard := Card.Create;
vcard.pan := UnicodeString(AccountNumber);
vcard.sec := UnicodeString(CVV2);
vcard.xprDt := UnicodeString(ExpirationDate);
send.card := vcard;
send.reqAmt := UnicodeString(Amount);
SYNAPSE_RegisterHTTP_Transport;
vGetMerchant := UnicodeString(wst_CreateInstance_MerchantWebServicesPortType('SOAP:',
'HTTP:Address=https://ws.cert.transactionexpress.com:443/portal/merchantframework/MerchantWebServices-v1',
' ws.cert.transactionexpress.com/portal/me...rchantWebServices-v1 ').SendTran(send));
WriteLn(vGetMerchant);
end;
What I am doing wrong? Please help. I am using CT 5.5 in CentOS 7. This wsdl uses OpenSSL with TLS v1.2. I have added following unit in my project which is a console application:
synapse_http_protocol, soap_formatter, ssl_openssl,
Please help.

Please Log in or Create an account to join the conversation.

  • Md. Shariful Alam Khan
  • Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
4 years 2 months ago #8683 by Md. Shariful Alam Khan
Replied by Md. Shariful Alam Khan on topic pl_wst EXMLReadError in CentOS 7
No one here to response.

Please Log in or Create an account to join the conversation.

  • Tony_O_Gallos
  • Tony_O_Gallos's Avatar
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Ελεύθερο λογισμικό ή θάνατος
More
4 years 2 months ago - 4 years 2 months ago #8684 by Tony_O_Gallos
Replied by Tony_O_Gallos on topic pl_wst EXMLReadError in CentOS 7
Hi Md. Shariful Alam Khan,
you are trying to parse "raw" HTML with a XML parser.
Your error is : Unmatching element end tag (expected "</HR>").
Some HTML markup don't require closing tag, HR is one of them (like BR, IMG, see here )
XML requires closing tags (or at least a trailing / in the markup).
You could use some regular expressions to correct the wrong tags or use external "filter" (like CEF or PhantomJS) which could "cure" your DOM before to parse it in your application.

Hoping this will help you :)
Last edit: 4 years 2 months ago by Tony_O_Gallos.

Please Log in or Create an account to join the conversation.

  • Md. Shariful Alam Khan
  • Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
4 years 2 months ago #8685 by Md. Shariful Alam Khan
Replied by Md. Shariful Alam Khan on topic pl_wst EXMLReadError in CentOS 7
But I am not doing any XML or HTML part. All I am doing is Posting to SOAP WebServer through pl_wst which is HTTPS post. I am just calling the wst_CreateInstance_MerchantWebServicesPortType proxy method which is generate by WST. You can parse pas file from Merchant and test it.

Please Log in or Create an account to join the conversation.

  • Md. Shariful Alam Khan
  • Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
4 years 2 months ago #8686 by Md. Shariful Alam Khan
Replied by Md. Shariful Alam Khan on topic pl_wst EXMLReadError in CentOS 7
This is the response I am getting from SOAPUI:
<html><head><title>Webserver - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error () that prevented it from fulfilling this request.</u></p><HR size="1" noshade="noshade"><h3>Webserver</h3></body></html>
Its HTML not XML nor XHTML. In HTML hr tag does not require end tag, for reference please see W3School . It's bug in pl_wst for reading XML as per laz2_XMLRead and xmltextreader unit. Line no 3481, 3482 in xmltextreader unit and line no 3453 in laz2_XMLRead unit.

Please Log in or Create an account to join the conversation.

  • Tony_O_Gallos
  • Tony_O_Gallos's Avatar
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Ελεύθερο λογισμικό ή θάνατος
More
4 years 2 months ago - 4 years 2 months ago #8690 by Tony_O_Gallos
Replied by Tony_O_Gallos on topic pl_wst EXMLReadError in CentOS 7
Your EXMLReadError comes from the parsing of the response returned by the server, which is HTML, a HTML page displayed below.

Your parser expects XML, not HTML.
It is a server internal error, and the returned page produces an error on your side after this.
Nothing surprising ;)
I would say something is wrong with the parameters you try to send to the service (format ? encoding ?).
Attachments:
Last edit: 4 years 2 months ago by Tony_O_Gallos.

Please Log in or Create an account to join the conversation.