Einzelnen Beitrag anzeigen

DennisR

Registriert seit: 22. Dez 2020
4 Beiträge
 
Delphi 2006 Professional
 
#4

AW: HTTPRIO SOAP Header/Request ändern D2006

  Alt 23. Dez 2020, 10:10
Um es nochmal zu verdeutlichen:

Das hier wird durch Delphi verschickt

Code:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <s:Header xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <To s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://localhost:1200/38f9edad-b272-4649-917e-1180b4c5207e</To>
    <Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://tempuri.org/IPOS/Sign</Action>
  </s:Header>
  <SOAP-ENV:Body>
    <Sign xmlns="http://tempuri.org/">
      <data xmlns="http://schemas.datacontract.org/2004/07/fiskaltrust.ifPOS.v0">
        <ftCashBoxID>d797b413-7cb6-43b3-8ff0-3594f60ae3cd</ftCashBoxID>
        <ftQueueID></ftQueueID>
        <ftPosSystemId></ftPosSystemId>
        <cbTerminalID>1</cbTerminalID>
        <cbReceiptReference>INIT</cbReceiptReference>
        <cbReceiptMoment>2020-12-21T11:23:00.362Z</cbReceiptMoment>
        <cbChargeItems></cbChargeItems>
        <cbPayItems></cbPayItems>
        <ftReceiptCase>4919338172267102211</ftReceiptCase>
        <ftReceiptCaseData></ftReceiptCaseData>
        <cbReceiptAmount xsi:nil="true" xmlns=""></cbReceiptAmount>
        <cbUser>Admin</cbUser>
        <cbArea></cbArea>
        <cbCustomer></cbCustomer>
        <cbSettlement></cbSettlement>
        <cbPreviousReceiptReference></cbPreviousReceiptReference>
      </data>
    </Sign>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
und es klappt nicht.

So schicke ich es per SoapUI:
Code:
<SOAP-ENV:Envelope xmlns:tem="http://tempuri.org/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <SOAP-ENV:Body>
        <Sign xmlns="http://tempuri.org/">
        <tem:data xmlns="http://schemas.datacontract.org/2004/07/fiskaltrust.ifPOS.v0">
            <ftCashBoxID>d797b413-7cb6-43b3-8ff0-3594f60ae3cd</ftCashBoxID>
            <ftQueueID></ftQueueID>
            <ftPosSystemId></ftPosSystemId>
            <cbTerminalID>1</cbTerminalID>
            <cbReceiptReference>INIT</cbReceiptReference>
            <cbReceiptMoment>2020-10-27T11:19:43.962Z</cbReceiptMoment>
            <cbChargeItems></cbChargeItems>
            <cbPayItems></cbPayItems>
            <ftReceiptCase>4919338172267102211</ftReceiptCase>
            <ftReceiptCaseData></ftReceiptCaseData>
            <cbReceiptAmount xmlns="" xsi:nil="true"/>
            <cbUser>Admin</cbUser>
            <cbArea></cbArea>
            <cbCustomer></cbCustomer>
            <cbSettlement></cbSettlement>
            <cbPreviousReceiptReference></cbPreviousReceiptReference>
        </tem:data>
        </Sign>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
und es klappt. Ich müsste also nur den Header rausschmeißen (OnBeforeExecute - hat aber keine Auswirkung, Text wird unverändert geschickt), sowie das data durch tem:data ersetzen.

Aufgerufen wird das ganze dann so:
Delphi-Quellcode:
      RecMoment.AsUtcDateTime := Now;
      Receipt.ftCashBoxID := 'd797b413-7cb6-43b3-8ff0-3594f60ae3cd';
      Receipt.cbTerminalID := '1';
      Receipt.cbReceiptReference := 'INIT';
      Receipt.cbReceiptMoment := RecMoment;

      aXmlDecimal.DecimalString := '0';

      aChargeItem.Quantity := aXmlDecimal;
      aChargeItem.Amount := aXmlDecimal;
      aChargeItem.VATRate := aXmlDecimal;
      aChargeItem.ftChargeItemCase := 0;

      apayitem.Quantity := aXmlDecimal;
      apayitem.Amount := aXmlDecimal;
      apayitem.ftPayItemCase := 0;

      SetLength(arChItems,1);
      arChItems[0] := aChargeItem;

      Receipt.cbChargeItems := arChItems;

      SetLength(arPayItems,1);
      arPayItems[0] := apayitem;

      Receipt.cbPayItems := arPayItems;

      Receipt.ftReceiptCase := 4919338172267102211;
      Receipt.cbUser := 'Admin';

      try
        Response := test.Sign(Receipt);
      finally
        erg := Response.ftStateData;
      end;
Die einzelnen Klassen sehen in der Regel so aus:
Delphi-Quellcode:
ReceiptRequest = class(TRemotable)
  private
    FftCashBoxID: WideString;
    ....
  public
    destructor Destroy; override;
  published
    property ftCashBoxID: WideString read FftCashBoxID write FftCashBoxID;
    ....
  end;
Delphi-Quellcode:
initialization
  InvRegistry.RegisterInterface(TypeInfo(IPOS), 'http://tempuri.org/', 'utf-8');
  InvRegistry.RegisterAllSOAPActions(TypeInfo(IPOS), '|http://tempuri.org/IPOS/Sign|http://tempuri.org/IPOS/Journal|http://tempuri.org/IPOS/Echo|http://tempuri.org/IPOS/v1/Sign|http://tempuri.org/IPOS/v1/Journal|http://tempuri.org/IPOS/v1/Echo');
  InvRegistry.RegisterInvokeOptions(TypeInfo(IPOS), ioDocument);
  InvRegistry.RegisterExternalParamName(TypeInfo(IPOS), 'Journal', 'to_', 'to');
  InvRegistry.RegisterExternalParamName(TypeInfo(IPOS), 'Echo', 'message_', 'message');
  InvRegistry.RegisterExternalParamName(TypeInfo(IPOS), 'v1_x002F_Echo', 'message_', 'message');
  RemClassRegistry.RegisterXSClass(EchoRequest, 'http://schemas.datacontract.org/2004/07/fiskaltrust.ifPOS.v1', 'EchoRequest');
  RemClassRegistry.RegisterExternalPropName(TypeInfo(EchoRequest), 'Message_', 'Message');
  RemClassRegistry.RegisterXSClass(EchoResponse, 'http://schemas.datacontract.org/2004/07/fiskaltrust.ifPOS.v1', 'EchoResponse');
  RemClassRegistry.RegisterExternalPropName(TypeInfo(EchoResponse), 'Message_', 'Message');
  RemClassRegistry.RegisterXSClass(JournalRequest, 'http://schemas.datacontract.org/2004/07/fiskaltrust.ifPOS.v1', 'JournalRequest');
  RemClassRegistry.RegisterExternalPropName(TypeInfo(JournalRequest), 'To_', 'To');
  RemClassRegistry.RegisterXSInfo(TypeInfo(StreamBody), 'http://schemas.microsoft.com/Message', 'StreamBody');
  RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfChargeItem), 'http://schemas.datacontract.org/2004/07/fiskaltrust.ifPOS.v0', 'ArrayOfChargeItem');
  RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfPayItem), 'http://schemas.datacontract.org/2004/07/fiskaltrust.ifPOS.v0', 'ArrayOfPayItem');
  RemClassRegistry.RegisterXSClass(ReceiptRequest, 'http://schemas.datacontract.org/2004/07/fiskaltrust.ifPOS.v0', 'ReceiptRequest');
  RemClassRegistry.RegisterXSClass(ChargeItem, 'http://schemas.datacontract.org/2004/07/fiskaltrust.ifPOS.v0', 'ChargeItem');
  RemClassRegistry.RegisterExternalPropName(TypeInfo(ChargeItem), 'Unit_', 'Unit');
  RemClassRegistry.RegisterXSClass(PayItem, 'http://schemas.datacontract.org/2004/07/fiskaltrust.ifPOS.v0', 'PayItem');
  RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfstring), 'http://schemas.microsoft.com/2003/10/Serialization/Arrays', 'ArrayOfstring');
  RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfSignaturItem), 'http://schemas.datacontract.org/2004/07/fiskaltrust.ifPOS.v0', 'ArrayOfSignaturItem');
  RemClassRegistry.RegisterXSClass(ReceiptResponse, 'http://schemas.datacontract.org/2004/07/fiskaltrust.ifPOS.v0', 'ReceiptResponse');
  RemClassRegistry.RegisterXSClass(SignaturItem, 'http://schemas.datacontract.org/2004/07/fiskaltrust.ifPOS.v0', 'SignaturItem');
  RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfChargeItem2), 'http://schemas.datacontract.org/2004/07/fiskaltrust.ifPOS.v1', 'ArrayOfChargeItem2', 'ArrayOfChargeItem');
  RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfPayItem2), 'http://schemas.datacontract.org/2004/07/fiskaltrust.ifPOS.v1', 'ArrayOfPayItem2', 'ArrayOfPayItem');
  RemClassRegistry.RegisterXSClass(ReceiptRequest2, 'http://schemas.datacontract.org/2004/07/fiskaltrust.ifPOS.v1', 'ReceiptRequest2', 'ReceiptRequest');
  RemClassRegistry.RegisterXSClass(ChargeItem2, 'http://schemas.datacontract.org/2004/07/fiskaltrust.ifPOS.v1', 'ChargeItem2', 'ChargeItem');
  RemClassRegistry.RegisterExternalPropName(TypeInfo(ChargeItem2), 'Unit_', 'Unit');
  RemClassRegistry.RegisterXSClass(PayItem2, 'http://schemas.datacontract.org/2004/07/fiskaltrust.ifPOS.v1', 'PayItem2', 'PayItem');
  RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfSignaturItem2), 'http://schemas.datacontract.org/2004/07/fiskaltrust.ifPOS.v1', 'ArrayOfSignaturItem2', 'ArrayOfSignaturItem');
  RemClassRegistry.RegisterXSClass(ReceiptResponse2, 'http://schemas.datacontract.org/2004/07/fiskaltrust.ifPOS.v1', 'ReceiptResponse2', 'ReceiptResponse');
  RemClassRegistry.RegisterXSClass(SignaturItem2, 'http://schemas.datacontract.org/2004/07/fiskaltrust.ifPOS.v1', 'SignaturItem2', 'SignaturItem');

Geändert von DennisR (23. Dez 2020 um 10:19 Uhr) Grund: ergänzt
  Mit Zitat antworten Zitat