在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
1 uses XMLIntf, XMLDoc; 2 3 4 5 XML to XTR文件转换 6 7 8 9 1、File-->open打开你要分析的XML文件 10 2、在左边选择你要分析的接点,双击加到中间的转换列表中 11 3、Create-->DataPacket from XML 12 4、Create and Test Transformation 13 5、file-->save-->Transformation得到一个.xtr的文件 14 6、打开.xtr文件,第一行找到"><SelectEach dest="DATAPACKET\ROWDATA\ROW" from="\Envelope\Body\……> 15 把‘soap:’、‘diffgr:’删除,保存 16 7、XMLTransformProvider->transformRead->TransformationFile指向.xtr文件 17 8、设置ClientDataSet1的ProviderName属性 18 19 =====客户端============================================================== 20 21 必需先 22 23 CEMAI.GetCEMAISoap; 24 25 ============= 26 27 procedure TMainfrm.Button1Click(Sender: TObject); 28 begin 29 Edit1.Text:=XTRPath ; 30 HttpRIO1.HTTPWebNode.Agent := 'Borland SOAP 1.2' ; 31 HttpRIO1.HTTPWebNode.UseUTF8InHeader := True; 32 HttpRIO1.Converter.Options := HttpRIO1.Converter.Options + [soUTF8InHeader, soUTF8EncodeXML]; 33 HttpRIO1.Converter.Options := [soSendMultiRefObj, soTryAllSchema, soRootRefNodesToBody, soUTF8InHeader, soCacheMimeResponse, soUTF8EncodeXML]; 34 HttpRio1.Converter.Encoding := 'utf-8' ; 35 HttpRIO1.URL := defURL; 36 (HTTPRIO1 as CEMAISoap).GetDataSet(Key,Ssql); 37 end; 38 39 ========================= 40 41 procedure TMainfrm.HTTPRIO1AfterExecute(const MethodName: String; 42 SOAPResponse: TStream); 43 var 44 XMLDoc: IXMLDocument; 45 begin 46 SOAPResponse.Position := 0; 47 ClientDataset1.Active := FALSE; 48 SOAPResponse.Position := 0; 49 50 XMLDoc := NewXMLDocument; 51 XMLDoc.Encoding := 'UTF8'; 52 SOAPResponse.Position := 0; 53 XMLDoc.LoadFromStream(SOAPResponse); 54 xmlDoc.SaveToFile('c:\max.xml'); //保存xml文件到根目录 55 56 XMLTransformProvider1.TransformRead.SourceXmlDocument := XMLDoc.GetDOMDocument; 57 XMLTransformProvider1.TransformRead.TransformationFile := Edit1.Text; 58 ClientDataSet1.OPEN ; 59 ClientDataset1.Active := TRUE; 60 61 end; 62 63 =====服务单元,自动生成================================= 64 65 服务单元,必需在initialization处加一句。 66 67 initialization 68 InvRegistry.RegisterInvokeOptions(TypeInfo(CEMAISoap),ioDocument) ;
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论