library example web-services delphi soap wsdl delphi-2010

web services - example - ¿Es posible enviar y recibir XML a la función WSDL usando Delphi..?



delphi rest client example (2)

Hemos utilizado los servicios web con Delphi en el pasado y estos son simples con pocos parámetros y devolvieron un valor único al cliente. Un nuevo servicio que trabaje debería poder recibir XML y recibir resultados en XML.

¿Hay algún componente que pueda usarse para este propósito?

Cuando intenté usar el siguiente mensaje, aparece un error "Excepción en el parámetro de entrada de Acuerdos de búsqueda XmlElement - System.NullReferenceException: referencia de objeto no establecida en una instancia de un objeto".

LDocument := NewXMLDocument; <<framed an XML input>> DocSearchOut := SearchArgsResponse.Create(); DoxSerchIn := SearchArgs.Create(); DoxSerchIn.SOAPTOObject(LDocument.DocumentElement,LDocument.DocumentElement,HTTPRIO1.Converter); DoxService := GetIDoxService(True,'''',HTTPRIO1); DocSearchOut :=DoxService.SearchAgreements(DoxSerchIn)

Incluso intenté convertir SearchArgs como cadena ancha e intenté pasarlo como una cadena. Esto funciona con pequeños cambios en la ejecución de HTTPRIO. Final Edit

LDocument := NewXMLDocument; <<framed an XML input>> DocSearchOut := SearchArgsResponse.Create(); DoxSerchIn := SearchArgs.Create(); DoxSerchIn.SearchArgs := LDocument.DocumentElement.XML; DoxService := GetIDoxService(True,'''',HTTPRIO1); DocSearchOut :=DoxService.SearchAgreements(DoxSerchIn)

su wsdl

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 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:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:i0="http://www.bank.com/dox/service/v1.0.0" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" name="DoxService" targetNamespace="http://tempuri.org/"> <wsdl:import namespace="http://www.bank.com/dox/service/v1.0.0" location="http://devldn.ldn.bank.com:8258/doxManual/DoxService.svc?wsdl=wsdl0"/> <wsdl:types/> <wsdl:binding name="BasicHttpBinding_IDoxService" type="i0:IDoxService"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="SearchAgreements"> <soap:operation soapAction="http://www.bank.com/dox/service/v1.0.0/IDoxService/SearchAgreements" style="document"/> <wsdl:input> <soap:body use="literal"/> </wsdl:input> <wsdl:output> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="DoxService"> <wsdl:port name="BasicHttpBinding_IDoxService" binding="tns:BasicHttpBinding_IDoxService"> <soap:address location="http://devldn.ldn.bank.com:8258/doxManual/DoxService.svc"/> </wsdl:port> </wsdl:service> </wsdl:definitions>

wsdl0

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 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:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://www.bank.com/dox/service/v1.0.0" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" targetNamespace="http://www.bank.com/dox/service/v1.0.0"> <wsdl:types> <xsd:schema targetNamespace="http://www.bank.com/dox/service/v1.0.0/Imports"> <xsd:import schemaLocation="http://ldndev.ldn.bank.com:8258/doxManual/DoxService.svc?xsd=xsd0" namespace="http://www.bank.com/dox/service/v1.0.0"/> <xsd:import schemaLocation="http://ldndev.ldn.bank.com:8258/doxManual/DoxService.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/> </xsd:schema> </wsdl:types> <wsdl:message name="IDoxService_SearchAgreements_InputMessage"> <wsdl:part name="parameters" element="tns:SearchAgreements"/> </wsdl:message> <wsdl:message name="IDoxService_SearchAgreements_OutputMessage"> <wsdl:part name="parameters" element="tns:SearchAgreementsResponse"/> </wsdl:message> <wsdl:portType name="IDoxService"> <wsdl:operation name="SearchAgreements"> <wsdl:input wsaw:Action="http://www.bank.com/dox/service/v1.0.0/IDoxService/SearchAgreements" message="tns:IDoxService_SearchAgreements_InputMessage"/> <wsdl:output wsaw:Action="http://www.bank.com/dox/service/v1.0.0/IDoxService/SearchAgreementsResponse" message="tns:IDoxService_SearchAgreements_OutputMessage"/> </wsdl:operation> </wsdl:portType> </wsdl:definitions>

xsd0

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.bank.com/dox/service/v1.0.0" elementFormDefault="qualified" targetNamespace="http://www.bank.com/dox/service/v1.0.0"> <xs:element name="SearchAgreements"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" name="searchRequest" nillable="true"> <xs:complexType> <xs:sequence> <xs:any minOccurs="0" processContents="lax"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="SearchAgreementsResponse"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" name="SearchAgreementsResult" nillable="true"> <xs:complexType> <xs:sequence> <xs:any minOccurs="0" processContents="lax"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>

xsd1

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/"> <xs:element name="anyType" nillable="true" type="xs:anyType"/> <xs:element name="anyURI" nillable="true" type="xs:anyURI"/> <xs:element name="base64Binary" nillable="true" type="xs:base64Binary"/> <xs:element name="boolean" nillable="true" type="xs:boolean"/> <xs:element name="byte" nillable="true" type="xs:byte"/> <xs:element name="dateTime" nillable="true" type="xs:dateTime"/> <xs:element name="decimal" nillable="true" type="xs:decimal"/> <xs:element name="double" nillable="true" type="xs:double"/> <xs:element name="float" nillable="true" type="xs:float"/> <xs:element name="int" nillable="true" type="xs:int"/> <xs:element name="long" nillable="true" type="xs:long"/> <xs:element name="QName" nillable="true" type="xs:QName"/> <xs:element name="short" nillable="true" type="xs:short"/> <xs:element name="string" nillable="true" type="xs:string"/> <xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte"/> <xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt"/> <xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong"/> <xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort"/> <xs:element name="char" nillable="true" type="tns:char"/> <xs:simpleType name="char"> <xs:restriction base="xs:int"/> </xs:simpleType> <xs:element name="duration" nillable="true" type="tns:duration"/> <xs:simpleType name="duration"> <xs:restriction base="xs:duration"> <xs:pattern value="/-?P(/d*D)?(T(/d*H)?(/d*M)?(/d*(/./d*)?S)?)?"/> <xs:minInclusive value="-P10675199DT2H48M5.4775808S"/> <xs:maxInclusive value="P10675199DT2H48M5.4775807S"/> </xs:restriction> </xs:simpleType> <xs:element name="guid" nillable="true" type="tns:guid"/> <xs:simpleType name="guid"> <xs:restriction base="xs:string"> <xs:pattern value="[/da-fA-F]{8}-[/da-fA-F]{4}-[/da-fA-F]{4}-[/da-fA-F]{4}-[/da-fA-F]{12}"/> </xs:restriction> </xs:simpleType> <xs:attribute name="FactoryType" type="xs:QName"/> <xs:attribute name="Id" type="xs:ID"/> <xs:attribute name="Ref" type="xs:IDREF"/> </xs:schema>

Entrada al servicio ... por desgracia, el equipo ha agregado algunas cosas, por lo que no puede recuperar los resultados en la interfaz de usuario de SOAP.

<AgreementSearchRequest xmlns="http://www.bank.com/dox/service/v1.0.0" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <Header> <PageNo>1</PageNo> <PageSize>10</PageSize> <Source>IBFD</Source> </Header> <SearchCriteria> <AgreementId>10</AgreementId> <AgreementStatus>Search Status</AgreementStatus> <AgreementType>Search Type</AgreementType> <AgreementVersion>Search Version</AgreementVersion> <CompletedDate>2014-05-30T15:56:45.7533005+05:30</CompletedDate> <ContractingEntity>Search GCRS Code</ContractingEntity> <CounterpartyBranch>Search CP Branch</CounterpartyBranch> <CounterpartyEMID>Search CP EMID</CounterpartyEMID> <CounterpartyId>Search CP ID</CounterpartyId> <CounterpartyName>Search CP Name</CounterpartyName> <CounterpartyType>Search CP Type</CounterpartyType> <CreditContact>Search Contact</CreditContact> <IsOffshoreUser>true</IsOffshoreUser> <Products> <Product> <ProductCode>Search Code</ProductCode>:= <ProductName i:nil="true"/> </Product> </Products> <RXM>Search RXM</RXM> <RequestedDate>2014-05-30T15:56:45.758183+05:30</RequestedDate> <bankLegalEntity>Search LEgal Entity</bankLegalEntity> <bankLegalEntityCategory>Search Legal Entity Category</bankLegalEntityCategory> <UmbrellaCounterpartyEMID>Search Agent EMID</UmbrellaCounterpartyEMID> <UmbrellaCounterpartyName>Search Agent Name</UmbrellaCounterpartyName> </SearchCriteria>

Intenté importar xsd y reemplazar el archivo xml HTTPRIO Antes de ejecutar como se menciona aquí ...

<?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:tns="http://www.bank.com/dox/service/v1.0.0" elementFormDefault="qualified" targetNamespace="http://www.bank.com/dox/service/v1.0.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:complexType name="ArrayOfProduct"> <xs:sequence> <xs:element minOccurs="0" maxOccurs="unbounded" name="Product" nillable="true" type="tns:Product" /> </xs:sequence> </xs:complexType> <xs:element name="ArrayOfProduct" nillable="true" type="tns:ArrayOfProduct" /> <xs:complexType name="Product"> <xs:sequence> <xs:element minOccurs="0" name="ProductCode" nillable="true" type="xs:string" /> <xs:element minOccurs="0" name="ProductName" nillable="true" type="xs:string" /> </xs:sequence> </xs:complexType> <xs:element name="Product" nillable="true" type="tns:Product" /> <xs:complexType name="AgreementSearchRequest"> <xs:sequence> <xs:element name="Header" nillable="true" type="tns:AgreementSearchRequestHeader" /> <xs:element name="SearchCriteria" nillable="true" type="tns:AgreementSearchCriteria" /> </xs:sequence> </xs:complexType> <xs:element name="AgreementSearchRequest" nillable="true" type="tns:AgreementSearchRequest" /> <xs:complexType name="AgreementSearchRequestHeader"> <xs:sequence> <xs:element name="PageNo" type="xs:int" /> <xs:element name="PageSize" type="xs:int" /> <xs:element name="Source" nillable="true" type="xs:string" /> </xs:sequence> </xs:complexType> <xs:element name="AgreementSearchRequestHeader" nillable="true" type="tns:AgreementSearchRequestHeader" /> <xs:complexType name="AgreementSearchCriteria"> <xs:sequence> <xs:element minOccurs="0" name="AgreementId" type="xs:int" /> <xs:element minOccurs="0" name="AgreementStatus" nillable="true" type="xs:string" /> <xs:element minOccurs="0" name="AgreementType" nillable="true" type="xs:string" /> <xs:element minOccurs="0" name="AgreementVersion" nillable="true" type="xs:string" /> <xs:element minOccurs="0" name="CompletedDate" type="xs:dateTime" /> <xs:element minOccurs="0" name="ContractingEntity" nillable="true" type="xs:string" /> <xs:element minOccurs="0" name="CounterpartyBranch" nillable="true" type="xs:string" /> <xs:element minOccurs="0" name="CounterpartyEMID" nillable="true" type="xs:string" /> <xs:element minOccurs="0" name="CounterpartyId" nillable="true" type="xs:string" /> <xs:element minOccurs="0" name="CounterpartyName" nillable="true" type="xs:string" /> <xs:element minOccurs="0" name="CounterpartyType" nillable="true" type="xs:string" /> <xs:element minOccurs="0" name="CreditContact" nillable="true" type="xs:string" /> <xs:element minOccurs="0" name="Products" nillable="true" type="tns:ArrayOfProduct" /> <xs:element minOccurs="0" name="RXM" nillable="true" type="xs:string" /> <xs:element minOccurs="0" name="RequestedDate" type="xs:dateTime" /> <xs:element minOccurs="0" name="egalEntity" nillable="true" type="xs:string" /> <xs:element minOccurs="0" name="LegalEntityCategory" nillable="true" type="xs:string" /> <xs:element minOccurs="0" name="UmbrellaCounterpartyEMID" nillable="true" type="xs:string" /> <xs:element minOccurs="0" name="UmbrellaCounterpartyName" nillable="true" type="xs:string" /> </xs:sequence> </xs:complexType> <xs:element name="AgreementSearchCriteria" nillable="true" type="tns:AgreementSearchCriteria" /> </xs:schema>


Existe el kit de herramientas de servicios web .

Tiene un generador de código que toma un wsdl y genera clases de Pascal desde él que interactúan con el servicio web.

Parece ser exactamente lo que necesitas, pero no sé los detalles.

Luego también están mis Herramientas de Internet para FreePascal (no Delphi).

Contienen intérpretes para XQuery, que es un lenguaje de procesamiento XML de uso general, por lo que puede usarlo con todas las API posibles basadas en XML / HTML con mucho menos código que con los métodos DOM. Pero no le ayudará con nada específico de WSDL, necesita escribir el XML para cada solicitud usted mismo.


En función de otros puntos de vista en los foros vaiours (inc ), hemos solucionado el problema mediante la fijación en 2 lugares.

Se modificó el procedimiento remotoble generado por Delphi. Anteriormente era una clase de parámetro de entrada en sí, así que hemos cambiado a WideString

SearchAgreements = class(TRemotable) private FsearchRequest: WideString ; FsearchRequest_Specified: boolean; procedure SetsearchRequest(Index: Integer; const AsearchRequest: WideString ); function searchRequest_Specified(Index: Integer): boolean; public destructor Destroy; override; published property searchRequest: WideString Index (IS_OPTN) read FsearchRequest write SetsearchRequest stored searchRequest_Specified; end;

Y también hemos modificado HTTPRIO Antes de ejecutar con modificaciones menores y podemos enviar XML con éxito al Servicio.

procedure HTTPRIO1SoapBeforeExecute(const MethodName: string; SOAPRequest: TStream); var StrTemp,Fheader : TStringList; StrBeg,StrEnd,StrParam,StrParam1 : TStringList; StreamTemp : TStream; StrLst : TStringList; StrLstTmp: TStringList; begin StrBeg:=TStringList.Create(); StrEnd:=TStringList.Create(); SOAPRequest.Position := 0; StrTemp.LoadFromStream(SOAPRequest); StrBeg.Text := StringReplace(StrTemp.Text,''&lt;'',''<'',[RfReplaceAll]); StrEnd.Text := StringReplace(StrBeg.Text,''&gt;'',''>'',[RfReplaceAll]); SOAPRequest.Position:=0; SOAPRequest.Size := 0; //Clear the Stream StrEnd.SaveToStream(SOAPRequest); //Reinitialise the stream with right string. SOAPRequest.Position :=0; end;

Hemos hecho una llamada a PHd on Webservices para que cualquier persona que se enfrente a un problema similar pueda contactarme. Gracias :)