Delphi XE不正确使用WebService

时间:2012-01-26 11:36:11

标签: xml delphi soap biztalk delphi-xe

在下面的Delphi XE中展示WSDL正在创建如此处所示的代码。 Out WebService正在BizTalk服务器上运行:

....
....

  PicassoBTSTest_PortalOrchestration_Port_Portal = interface(IInvokable)
  ['{706CEB1F-0EC1-08C2-03C7-395C12905558}']
    **procedure Operation_Portal(var part: Variant); stdcall;**
  end;

function GetPicassoBTSTest_PortalOrchestration_Port_Portal(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): PicassoBTSTest_PortalOrchestration_Port_Portal;

....
....

调用WebService时我正在执行此操作:

procedure TForm1.Button2Click(Sender: TObject);
var
  X: PicassoBTSTest_PortalOrchestration_Port_Portal;
  V: Variant;
begin
  X := GetPicassoBTSTest_PortalOrchestration_Port_Portal;

  V := 'JUST A TEST';

  X.Operation_Portal(V);
  ShowMessage(V);
end;

正如我们在日志中看到的,这段代码正在调用我们的后端。但是我们没有收到正确的答复。调用Operation_Portal后,V参数不变。当它包含其他值时,它包含'JUST A TEST'文本。

我尝试过运行Delphi 2006中的代码,它给了我相同的结果。

我做错了什么。为什么我没有收到后端的回复?

/布赖恩

<?xml version="1.0" encoding="UTF-8"?>
-<wsdl:definitions xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:tns="http://techotel.dk/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://techotel.dk/" name="BizTalkServiceInstance">-<wsdl:documentation><CreationInfo Created="2012-01-26 10:31:43Z"/></wsdl:documentation>-<wsdl:types><xsd:schema targetNamespace="http://techotel.dk/Imports"/></wsdl:types>-<wsdl:message name="PicassoBTSTest_PortalOrchestration_Port_Portal_Operation_Portal_InputMessage"><wsdl:part name="part" type="xsd:anyType"/></wsdl:message>-<wsdl:message name="PicassoBTSTest_PortalOrchestration_Port_Portal_Operation_Portal_OutputMessage"><wsdl:part name="part" type="xsd:anyType"/></wsdl:message>-<wsdl:portType name="PicassoBTSTest_PortalOrchestration_Port_Portal"><wsdl:documentation>service "PicassoBTSTest.PortalOrchestration" port "Port_Portal"</wsdl:documentation>-<wsdl:operation name="Operation_Portal"><wsdl:documentation>operation "Operation_Portal"</wsdl:documentation><wsdl:input message="tns:PicassoBTSTest_PortalOrchestration_Port_Portal_Operation_Portal_InputMessage"/><wsdl:output message="tns:PicassoBTSTest_PortalOrchestration_Port_Portal_Operation_Portal_OutputMessage"/></wsdl:operation></wsdl:portType>-<wsdl:binding name="BasicHttpBinding_ITwoWayAsync" type="tns:PicassoBTSTest_PortalOrchestration_Port_Portal"><soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>-<wsdl:operation name="Operation_Portal"><wsdl:documentation>operation "Operation_Portal"</wsdl:documentation><soap:operation style="document" soapAction="Operation_Portal"/>-<wsdl:input><soap:body use="literal"/></wsdl:input>-<wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation></wsdl:binding>-<wsdl:service name="BizTalkServiceInstance">-<wsdl:port name="BasicHttpBinding_ITwoWayAsync" binding="tns:BasicHttpBinding_ITwoWayAsync"><soap:address location="http://akibiztalk01.internal.local/PicassoBTSTestPortal/PicassoBTSTest_PortalOrchestration_Port_Portal.svc"/></wsdl:port></wsdl:service></wsdl:definitions>

1 个答案:

答案 0 :(得分:0)

首先,我要验证服务器是否发送了一个包含期望值的XML SOAP响应。

如果值在响应中,则Delphi以某种方式无法将其分配给Variant变量。

该服务是否已在C#中开发?也许对于测试,编写Delphi版本的服务并比较响应XML结构是有帮助的。