간단한 세관 신고 확인을 위해 Delphi 2007에서 SOAP 클라이언트를 작성합니다. 나는 SOAP 서버에 몇 가지 정보를 보내고 서버가 내가 보낸 정보를 찾을 수 없다면 세관 릴리스 또는 SOAP 오류에 대한 세부 사항을 다시 받아야한다. 첫 번째 부분은 잘 작동하지만 오류 처리는하지 않습니다.Delphi 2007 SOAP 오류 처리
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsd:schema targetNamespace="http://trips.crownagents.com/wsexception/message"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://trips.crownagents.com/wsexception/message">
<xsd:element name="WSException" type="WSException" nillable="true"/>
<xsd:complexType name="WSException">
<xsd:sequence>
<xsd:element name="ErrorCode" type="xsd:string" minOccurs="0" maxOccurs="1"/>
<xsd:element name="ErrorDescription" type="xsd:string" minOccurs="0" maxOccurs="1"/>
<xsd:element name="Stack" type="xsd:string" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
을 그리고 내가 돌아올 SOAP 응답은 예외 참조 할 것 :
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ns0="http://trips.crownagents.com/wsexception/message"
xmlns:ns1="http://trips.crownagents.com/external/customs/release/message"
xmlns:ns2="http://trips.crownagents.com/external/common/message">
<env:Body>
<env:Fault xsi:type="env:Fault">
<faultcode>env:Server</faultcode>
<faultstring xsi:nil="1"/>
<detail>
<ans1:WSExceptionResponse xmlns:ans1="http://msgsvr.trips.crownagents.com/">
<ErrorCode>0002</ErrorCode>
<ErrorDescription>Invalid Declaration</ErrorDescription>
<Stack>getSingleResult() did not retrieve any entities.</Stack>
</ans1:WSExceptionResponse>
</detail>
</env:Fault>
</env:Body>
</env:Envelope>
을 - (전체 WSDL이 표시되지 않습니다 메인 WSDL에 의해 포함)를 WSDL 사용자 지정 SOAP 예외를 지정합니다
그러나 내 코드에는 WSExceptionResponse가 표시되지 않습니다. 델파이 2007 (https://groups.google.com/forum/#!msg/borland.public.delphi.webservices.soap/71t3P-vPMbk/qw9JVTEVS3YJ)에서 SOAP 처리에 문제가 몇이 있음을 나는 읽고
Try
Res := Rel.releaseStatus(RelInfo);
Except
On E: WSExceptionResponse Do // This never fires
Status('Release check error (' + E.ErrorCode + ' - ' +
E.ErrorDescription + ').', True);
Else
Status('Release check error (' + Exception(ExceptObject).Message +
').', True);
End;
내가 제안에 따라 그것을 되돌릴 OPToSOAPDomConv.pas 파일을 변경 한 대신, 나는 일반적인 ERemotableException를 얻을 수 그러나 그것은 도움이되지 않습니다. 누구든지 내가 뭘 잘못하고 있는지에 대한 아이디어가 있습니까?
SoapUI를 사용하여 서비스가 예상대로 작동하는지 확인한 다음 SoapUI 및 Delphi SOAP 요청간에 차이점이 있는지 확인하십시오. – mjn
SoapUI가 메시지를 보내는 방법은 델파이가하는 방법과는 많이 다르지만 (네임 스페이스와 관련이 있지만) 반환 된 폴트 메시지는 정확히 같은 방법입니다. – Caynadian