码迷,mamicode.com
首页 > 其他好文 > 详细

SOAP好像是一种远程调用方式

时间:2017-06-16 18:26:01      阅读:145      评论:0      收藏:0      [点我收藏+]

标签:default   www   sum   auto   var   down   tar   org   exce   

http://wiki.freepascal.org/Web_Service_Toolkit
https://www.freepascal.org/~michael/articles/soap1/soap.pdf
http://chapmanworld.com/2015/03/30/creating-and-consuming-soap-services-in-delphi/
http://www.drbob42.com/examine/examinE2.htm

解析代码:

 

I am trying to parse in Delphi xml like this:

<?xml version="1.0" encoding="UTF-8"?>
 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
     <soap:Fault>
      <faultcode>soap:Server</faultcode>
      <faultstring>java.lang.ClassNotFoundException</faultstring>
    </soap:Fault>
  </soap:Body>
</soap:Envelope>

Delphi code:

program TestXML;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  System.SysUtils,
  Xml.xmldom,
  Xml.XMLIntf,
  Xml.XMLDoc,
  ActiveX;

var
  XMLDoc: TXMLDocument;
  Root,Body,Fault,Node: IXMLNode;

begin
  CoInitialize(nil);
  try
    XMLDoc := TXMLDocument.Create(nil);
    XMLDoc.Options := XmlDoc.Options - [doNodeAutoCreate];
    XMLDoc.LoadFromFile(‘test.xml‘);
    Root := XMLDoc.DocumentElement;
    Body := Root.ChildNodes[‘Body‘];
    Writeln(Body.NodeName);
    Fault := Body.ChildNodes[‘Fault‘];
    Writeln(Fault.NodeName);
    try
      Node := Fault.ChildNodes[‘faultcode‘];
      Writeln(Node.Text);
    except
      on E:exception do Writeln(E.Message); // "Node "faultcode not found".
    end;
  finally
    CoUnInitialize;
  end;
end.

 

 

https://stackoverflow.com/questions/41140947/parse-soap-faultstring-in-delphi

SOAP好像是一种远程调用方式

标签:default   www   sum   auto   var   down   tar   org   exce   

原文地址:http://www.cnblogs.com/findumars/p/7028626.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!