Dann Croghan
Re: WSDL - Cannot Unwrap issues [Edit]

Re: WSDL - Cannot Unwrap issues [Edit]


I just spent a few minutes on this and, yes, if I'm reading this WSDL correctly, indeed the Service requires WS-Addressing. The top level WSDLs contains not Policy elements but if you look at the other WSDL,, imported from the top-level one you'll see the following:
{code}   <wsp:Policy wsu:Id="WSHttpBinding_MFET_policy">     <wsp:ExactlyOne>       <wsp:All>         <wsaw:UsingAddressing />       </wsp:All>     </wsp:ExactlyOne>   </wsp:Policy> {code}
I'll come back to WS-Addressing later. Each operation exposed by the Service also expects a MFETHeader. Here's how you set this header:
{code} procedure TForm16.Button1Click(Sender: TObject); var   AMFETHeader: MFETHeader;   AService: MFET;   ASubmissionList: SubmissionList;   I: Integer; begin   AMFETHeader := MFETHeader.Create;   try     AMFETHeader.User := 'user';     AMFETHeader.Password := 'password';     AMFETHeader.Environment := EnvironmentType.P;
    AService := GetMFET(False, '', HTTPRIO1);     (AService as ISOAPHeaders).Send(AMFETHeader);
    ASubmissionList := AService.SubmissionListBySubmissionId('100');     try       // Here process response     finally       for I := 0 to Length(ASubmissionList)-1 do         ASubmissionList[I].Free;     end;   finally     AMFETHeader.Free;   end; end; {code}

If you hook the OnBeforeExecute event on the RIO you'll see that the above calls generates the following request:
{code} <?xml version="1.0"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="" xmlns:xsd="" xmlns:xsi="">   <SOAP-ENV:Header>     <NS1:MFETHeader xmlns:NS1="">       <NS1:User>user</NS1:User>       <NS1:Password>password</NS1:Password>       <NS1:Environment>P</NS1:Environment>     </NS1:MFETHeader>   </SOAP-ENV:Header>   <SOAP-ENV:Body>     <SubmissionId xmlns="">100</SubmissionId>   </SOAP-ENV:Body> </SOAP-ENV:Envelope> {code}

Adjust the user/password and Environment appropriately.
But the above will still generate the error you received because that error, as I suspected, is not about a missing MFEFHeader but rather that the Service requires WS-Addressing. I suspect that the service probably wants the minimal WS-Addressing header: with 'To', 'Action', 'MessageID' and (maybe) 'ReplyTo'. Automatic handling of WS-Addressing is something we plan to add to Delphi SOAP. For now, when required, it has to be handled manually.
I tried to add a manual WS-Addressing header. First I added the 'Action' - which is what the service complained about. Once that was done, it complained about the 'To' item. I added that one, and a MessageID. At that point the Service simply returns 400 (Bad Request). So it seems that I'm getting through the WS-Addressing issues. I'm hoping that '400' is the way the Service says "You don't have a valid user/password or submissionId for me to process"... although I can't really confirm this. Here's the request I sent:
{code} <?xml version="1.0"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="" xmlns:xsd="" xmlns:xsi="">   <SOAP-ENV:Header xmlns:wsa=''>
    <NS1:MFETHeader xmlns:NS1="">
    <SubmissionId xmlns="">100</SubmissionId>

The 'Action' has to match the SOAPAction of the method you're invoking. In the case of this Service, you'll see that the importer generated the following line:
{code}   InvRegistry.RegisterDefaultSOAPAction(TypeInfo(MFET), ''); {code}
So you just have to substitute %operationName% for whatever operation/method you are invoking.
The 'To' must be the URL to which we're sending requests. You can find that value again in the code generated by the importer:
{code} function GetMFET(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): MFET; const   defWSDL = '';   defURL = '';   defSvc = 'MFET';   defPrt = 'WSHttpBinding_MFET'; {code}
It's the 'defURL' constant that's needed.
The MessageID must be a unique identifier - so I just create a GUID.
If you have a valid user/password/submissionId and can try the above, please let me know if that worked for you.
FYI: Phrase searches are enclosed in either single or double quotes
Originally created by
Sun, 25 Oct 2020 08:42:20 UTC
Copyright © 2009-2020
HREF Tools Corp.