Paso 1: Crear y ejecutar la aplicación C++
Cclient.c
#include
#include
#include "soapEncryptDecryptSoapBindingProxy.h" / / obtener el stub generado
#include "EncryptDecryptSoapBinding.nsmap"
#include
#include
void callWeb();
Texto del widget, text1;
Main (int argc, char *argv[])
{
Aplicación de XtAppContext;
Nivel de widget, botón;
void my_callback (Widget, XtPointer, XtPointer);
Btn_text de XmString;
Arg args [2];
XtSetLanguageProc (NULL, NULL, NULL);
nivel = XtVaOpenApplication (& app, "Cliente Web", NULL, 0 & argc, argv, NULL,
sessionShellWidgetClass, NULL);
Forma de widget = XtVaCreateManagedWidget ("", xmFormWidgetClass,
nivel, XmNrightAttachment, XmATTACH_FORM, XmNy, 10, XmNwidth, 447, XmNheight, 587, XmNbackground, 0xa1b6d6, NULL);
FirstLabel widget = XtVaCreateManagedWidget ("", xmLabelWidgetClass, forma,
XmNlabelString, XmStringCreateLocalized ("cifrar/descifrar cliente de servicios Web por Saurabh Saxena"), XmNbackground, 0xc1ffff, XmNtopAttachment
XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, NULL);
Widget Label = XtVaCreateManagedWidget ("", xmLabelWidgetClass, XmNlabelString, XmStringCreateLocalized ("Enter Text"), XmNbackground, 0xc1ffcc, de la forma
XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, firstLabel, XmNleftAttachment, XmATTACH_FORM, XmNwidth, 75, XmNheight, 29, NULL);
texto = XtVaCreateManagedWidget ("", xmTextWidgetClass, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, etiqueta, XmNtopAttachment, de la forma
XmATTACH_WIDGET, XmNtopWidget, firstLabel, XmNwidth, 75, XmNheight, 29, XmNbackground, 0xffffff, XmNeditable, TRUE, XmNcursorPositionVisible,
FALSO, XmNhighlightThickness, XmNshadowThickness, 0, 1, NULL);
botón = XtVaCreateManagedWidget ("", xmPushButtonWidgetClass, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, firstLabel, de la forma
XmNleftAttachment,XmATTACH_WIDGET,XmNleftWidget,text,XmNlabelString,XmStringCreateSimple("Click"),XmNheight,20,XmNwidth,40,NULL);
Widget Label2 = XtVaCreateManagedWidget ("", xmLabelWidgetClass, XmNlabelString, XmStringCreateLocalized ("texto de salida"), XmNbackground, de la forma
0xc1ffcc, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, etiqueta, XmNleftAttachment, XmATTACH_FORM, XmNwidth, 75, XmNheight, 29, NULL);
text1 = XtVaCreateManagedWidget ("", xmTextWidgetClass, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, Label2, XmNtopAttachment, de la forma
XmATTACH_WIDGET, XmNtopWidget, texto, XmNwidth, 75, XmNheight, 29, XmNbackground, 0xffffff, XmNeditable, FALSE, XmNcursorPositionVisible,
FALSO, XmNhighlightThickness, XmNshadowThickness, 0, 1, NULL); XtAddCallback (botón, XmNactivateCallback, my_callback, NULL); XtManageChild (botón); XtRealizeWidget (nivel superior);
XtAppMainLoop (app);} void my_callback (Widget w, XtPointer client_data, XtPointer call_data)
{XmPushButtonCallbackStruct * cbs =(XmPushButtonCallbackStruct *) call_data; callWeb();
} void callWeb()
{EncryptDecryptSoapBindingProxy servicio; resultado de patraña;
Si (service.encDec(XmTextGetString(text),result) == SOAP_OK)
{
macros << "Resultado" << resultado << std::endl;
char * cstr = nuevo char[result.length() + 1];
strcpy (cstr, result.c_str());
XmTextSetString(text1,cstr);
Delete [] cstr;
}
otra cosa
Service.soap_stream_fault(STD::cerr);
}
Para compilar el código anterior usando el siguiente comando:
g ++ -o Cclient.c de Cclient soapC.cpp soapEncryptDecryptSoapBindingProxy.cpp - lgsoap ++ - lXm - lXt-lX11
Ejecute el archivo para acceder a la funcionalidad proporcionada por el servicio Web.