0

如果我使用 VB .NET 遵循代码,它工作得很好。但是我怎么能在delphi 2010上实现它。我的问题是找到模拟r.MessageData.AppData.Any。

我尝试使用

rootNode := otv.MessageData.AppData.ObjectToSOAP(rootNode,rootNode,HttpRIO.Converter,'OrderInfo','otv',[],s);
  or p := otv.MessageData.AppData.DataContext.GetDataPointer(0);

但我找不到 AppData 对象的属性 - (例如 orderId)。

我必须阅读并设置 appData 的属性 - 我如何在 Delphi 2010 上做到这一点

谢谢你。

    **part of unit WSDL Importer(CommonAppDataType class is empty)**
unit AisMFCService;

interface

uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;

const
  IS_OPTN = $0001;
  IS_UNBD = $0002;
  IS_NLBL = $0004;
  IS_ATTR = $0010;
  IS_REF  = $0080;


type

  // ************************************************************************ //
  // The following types, referred to in the WSDL document are not being represented
  // in this file. They are either aliases[@] of other types represented or were referred
  // to but never[!] declared in the document. The types from the latter category
  // typically map to predefined/known XML or Embarcadero types; however, they could also 
  // indicate incorrect WSDL documents that failed to declare or import a schema type.
  // ************************************************************************ //
  // !:string          - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:anyURI          - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:dateTime        - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:base64Binary    - "http://www.w3.org/2001/XMLSchema"[Gbl]

  Include              = class;                 { "http://www.w3.org/2004/08/xop/include"[GblCplx] }
  Include2             = class;                 { "http://www.w3.org/2004/08/xop/include"[GblElm] }
  orgExternalType      = class;                 { "http://eos.ru/doc/service"[GblCplx] }
  MessageType          = class;                 { "http://eos.ru/doc/service"[GblCplx] }
  SubMessageType       = class;                 { "http://eos.ru/doc/service"[GblCplx] }
  MessageDataTypeOfCommonAppDataType = class;   { "http://eos.ru/doc/service"[GblCplx] }
  CommonAppDataType    = class;                 { "http://eos.ru/doc/service"[GblCplx] }
  AppDocumentType      = class;                 { "http://eos.ru/doc/service"[GblCplx] }
  ReferenceType        = class;                 { "http://eos.ru/doc/service"[GblCplx] }
  Message_             = class;                 { "http://eos.ru/doc/service"[GblElm] }
  MessageData          = class;                 { "http://eos.ru/doc/service"[GblElm] }
  orgExternalType2     = class;                 { "http://smev.gosuslugi.ru/rev120315"[GblCplx] }
  MessageType2         = class;                 { "http://smev.gosuslugi.ru/rev120315"[GblCplx] }
  SubMessageType2      = class;                 { "http://smev.gosuslugi.ru/rev120315"[GblCplx] }
  MessageDataTypeOfCommonAppDataType2 = class;   { "http://smev.gosuslugi.ru/rev120315"[GblCplx] }
  CommonAppDataType2   = class;                 { "http://smev.gosuslugi.ru/rev120315"[GblCplx] }
  AppDocumentType2     = class;                 { "http://smev.gosuslugi.ru/rev120315"[GblCplx] }
  ReferenceType2       = class;                 { "http://smev.gosuslugi.ru/rev120315"[GblCplx] }
  Message_2            = class;                 { "http://smev.gosuslugi.ru/rev120315"[GblElm] }
  MessageData2         = class;                 { "http://smev.gosuslugi.ru/rev120315"[GblElm] }
  sendRequestMessage   = class;                 { "http://eos.ru/doc/Message"[Lit][GblElm] }
  ResponseMessage      = class;                 { "http://eos.ru/doc/Message"[Lit][GblElm] }
  sendGetStatusRequestMessage = class;          { "http://eos.ru/doc/Message"[Lit][GblElm] }
  GetStatusResponseMessage = class;             { "http://eos.ru/doc/Message"[Lit][GblElm] }
  SubMessage           = class;                 { "http://eos.ru/doc/service"[Alias] }
  SubMessage2          = class;                 { "http://smev.gosuslugi.ru/rev120315"[Alias] }
....

  // ************************************************************************ //
  // XML       : CommonAppDataType, global, <complexType> (AppDAta)
  // Namespace : http://eos.ru/doc/service
  // ************************************************************************ //
  CommonAppDataType = class(TRemotable)
  private
  published
  end;

来自 webService 的 xml 文本

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ResponseMessage xmlns="http://eos.ru/doc/Message"><Message xmlns="http://smev.gosuslugi.ru/rev120315"><Sender><Code>342703391</Code><Name>Дело</Name></Sender><Recipient><Code>123456789</Code><Name>АИС МФЦ</Name></Recipient><Originator><Code>123456789</Code><Name>АИС МФЦ</Name></Originator><TypeCode>GSRV</TypeCode><Status>ACCEPT</Status><Date>2013-08-07T16:19:26.39125+04:00</Date><ExchangeType>0</ExchangeType></Message><MessageData xmlns="http://smev.gosuslugi.ru/rev120315"><AppData><OrderInfo xmlns=""><orderId>10028894</orderId><statusCode>1</statusCode><comment>Заявление передано в информационную систему "Дело"</comment></OrderInfo></AppData></MessageData></ResponseMessage></s:Body></s:Envelope>

VB.NEt 代码(它的工作)

Dim a As New ais.AisMFCRequestMessage
        Dim doc As New Xml.XmlDocument
        Dim el As Xml.XmlElement
        el = doc.CreateElement("GetStatuesRequest")
        el.InnerXml = TextBox1.Text
        MsgBox(el.InnerXml)
        Dim els() As Xml.XmlElement
        Dim s As ais.IAisMFCService

        s = New ais.AisMFCServiceClient
        a.Message = New ais.MessageType
        a.Message.Sender = New ais.orgExternalType
        a.Message.Sender.Code = "123456789"
        a.Message.Sender.Name = "АИС МФЦ"
        a.Message.Recipient = New ais.orgExternalType
        a.Message.Recipient.Code = "1234567890"
        a.Message.Recipient.Name = "Delo"
        a.Message.Originator = New ais.orgExternalType
        a.Message.Originator.Code = "123456789"
        a.Message.Originator.Name = "АИС МФЦ"
        a.Message.ServiceName = "SN1"
        a.Message.TypeCode = ais.TypeCodeEnum.GSRV
        a.Message.Status = ais.StatusEnum.REQUEST
        a.Message.Date = Now.Date
        a.Message.ExchangeType = ais.ExchangeTypeEnum.Item2
        a.Message.ServiceCode = "01"
        a.Message.CaseNumber = "1"
        a.MessageData = New ais.MessageDataTypeOfCommonAppDataType
        a.MessageData.AppData = New ais.CommonAppDataType
        ReDim els(0)
        els(0) = el
        a.MessageData.AppData.Any = els

        Dim r As ais.AisMFCResponseMessage = s.CreateRequest(a)
        MsgBox(r.Message.Date.ToString)

        Dim m = r.MessageData.AppData.Any.ToArray
        For Each o In m
            el = o
            TextBox1.Text = el.InnerXml
        Next
4

1 回答 1

0

您没有在 Delphi 的 WSDL Importer 上设置正确的选项,因此导入的类不包含您要查找的数据。WSDL 导入器相当繁琐,可能需要反复试验才能获得预期的结果。在很多情况下,我已经放弃并手动完成了。

于 2013-08-08T08:18:39.287 回答