<SOAP-ENV:Envelope
. . . <SOAP-ENV:Header> <ns0:AuthHeader xmlns:ns0="http://ServiceHost/SOAPHeader"> <ns0:UserName>Scott</ns0:UserName> <ns0:Password>Administrator</ns0:Password> </ns0:AuthHeader> </SOAP-ENV:Header> . . . </SOAP-ENV:Envelope> |
/* SOAPHeader3.p
Calls a ficticious web service, passes it a username and password through a SOAP message request header, and gets back a string. 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 cUsername AS CHARACTER INIT "Scott". DEFINE VARIABLE cPassword AS CHARACTER INIT "Administrator" . DEFINE VARIABLE cResponse AS CHARACTER FORMAT "x(72)". |
DEFINE VARIABLE hXdoc AS HANDLE.
DEFINE VARIABLE hXnoderef1 AS HANDLE. DEFINE VARIABLE hXnoderef2 AS HANDLE. DEFINE VARIABLE hXAttribute AS HANDLE. DEFINE VARIABLE hXtext AS HANDLE. DEFINE VARIABLE g_header AS HANDLE. /*2*/ /* Build global SOAP request header */ RUN BuildRequestHeader (OUTPUT g_header). /* Create the Web service server object */ CREATE SERVER hWebSrvc. /* Connect to the WS */ hWebSrvc:CONNECT("-WSDL http://ServiceHost/SOAPHeader/HeaderExample.asmx?wsdl"). /* Get the method, set the port type */ RUN HeaderSoap SET hPortType ON hWebSrvc. /*3*/ /* Associate the request callback with the port type */ hPortType:SET-CALLBACK-PROCEDURE("REQUEST-HEADER", "ReqHandler"). /*4*/ /* Invoke the web service and display the results */ RUN HellowMyWorld IN hPortType (OUTPUT cResponse). DISPLAY cResponse LABEL "WS Response" WITH FRAME aaa. /*5*/ DELETE OBJECT g_header. DELETE OBJECT hPortType. hWebSrvc:DISCONNECT(). DELETE OBJECT hWebSrvc. /**************** Internal Procedures ****************/ |