<soap:Envelope>
. . . <soap:Header> <AuthHeader xmlns="http://ServiceHost/SOAPHeader"> <AccessID>XYZZY</AccessID> </AuthHeader> </soap:Header> . . . </soap:Envelope > |
/* SOAPHeader1.p
* Calls a fictitious Web service, first to request access, which gets back * a SOAP response header containing an AccessID, and sends the response * header back as part of a new request using the required access * credential that allows the Web service to respond appropriately to * the follow-up request. * The Web service has only one service and port available. *//*1*//* Define local variables */ DEFINE VARIABLE hWebSrvc AS HANDLE. DEFINE VARIABLE hPortType AS HANDLE. DEFINE VARIABLE cResponse AS CHARACTER FORMAT "x(72)". DEFINE VARIABLE g_header AS HANDLE. /* Create the Web service server object */ CREATE SERVER hWebSrvc. /* Connect to the Web service */ hWebSrvc:CONNECT("-WSDL http://ServiceHost/SOAPHeader/HeaderExample.asmx?wsdl"). /* Get the method, set the port type */ RUN HeadersSoap SET hPortType ON hWebSrvc. /*2*/ /* Associate the req. & resp. callbacks with the port type */ hPortType:SET-CALLBACK-PROCEDURE("REQUEST-HEADER", "ReqHandler"). hPortType:SET-CALLBACK-PROCEDURE("RESPONSE-HEADER", "RespHandler"). /*3*/ /* Invoke the Web service with no header and display the results */ RUN OpenAccess IN hPortType (OUTPUT cResponse). DISPLAY cResponse LABEL "WS response" WITH FRAME aaa. /*4*/ /* Go again with the AccessID set from previous response header */ cResponse = "". RUN HelloWorld IN hPortType (OUTPUT cResponse). DISPLAY cResponse LABEL "WS response" WITH FRAME bbb. |
/*5*/
DELETE OBJECT g_header. DELETE OBJECT hPortType. hWebSrvc:DISCONNECT(). DELETE OBJECT hWebSrvc. /**************** Internal Procedures ****************/ |