Stap 1: Maken en uitvoeren van C++ app
Cclient.c
#include
#include
#include "soapEncryptDecryptSoapBindingProxy.h" / / krijgen de gegenereerde stub
#include "EncryptDecryptSoapBinding.nsmap"
#include
#include
nietig callWeb();
Widget tekst text1;
Main (int argc, char *argv[])
{
XtAppContext app;
Toplevel widget, knop;
VOID my_callback (Widget, XtPointer, XtPointer);
XmString btn_text;
ARG args [2];
XtSetLanguageProc (NULL, NULL, NULL);
Toplevel = XtVaOpenApplication (& app, "Webclient", NULL, 0, & argc, argv, NULL,
sessionShellWidgetClass, NULL);
Widget vorm = XtVaCreateManagedWidget ("", xmFormWidgetClass,
Toplevel, XmNrightAttachment, XmATTACH_FORM, XmNy, 10, XmNwidth, 447, XmNheight, 587, XmNbackground, 0xa1b6d6, NULL);
Widget firstLabel = XtVaCreateManagedWidget ("", xmLabelWidgetClass, vorm,
XmNlabelString, XmStringCreateLocalized ("coderen/decoderen Service webclient door Saurabh Saxena"), XmNbackground, 0xc1ffff, XmNtopAttachment
XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, NULL);
Widget Label = XtVaCreateManagedWidget ("", xmLabelWidgetClass, vormen, XmNlabelString, XmStringCreateLocalized ("Voer tekst"), XmNbackground, 0xc1ffcc,
XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, firstLabel, XmNleftAttachment, XmATTACH_FORM, XmNwidth, 75, XmNheight, 29, NULL);
tekst = XtVaCreateManagedWidget ("", xmTextWidgetClass, vormen, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, Label, XmNtopAttachment,
XmATTACH_WIDGET, XmNtopWidget, firstLabel, XmNwidth, 75, XmNheight, 29, XmNbackground, 0xffffff, XmNeditable, TRUE, XmNcursorPositionVisible,
ONWAAR, XmNhighlightThickness, 0, XmNshadowThickness, 1, NULL);
knop = XtVaCreateManagedWidget ("", xmPushButtonWidgetClass, vormen, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, firstLabel,
XmNleftAttachment,XmATTACH_WIDGET,XmNleftWidget,text,XmNlabelString,XmStringCreateSimple("Click"),XmNheight,20,XmNwidth,40,NULL);
Widget Label2 = XtVaCreateManagedWidget ("", xmLabelWidgetClass, vormen, XmNlabelString, XmStringCreateLocalized ("uitvoertekst"), XmNbackground,
0xc1ffcc, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, Label, XmNleftAttachment, XmATTACH_FORM, XmNwidth, 75, XmNheight, 29, NULL);
text1 = XtVaCreateManagedWidget ("", xmTextWidgetClass, vormen, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, Label2, XmNtopAttachment,
XmATTACH_WIDGET, XmNtopWidget, tekst, XmNwidth, 75, XmNheight, 29, XmNbackground, 0xffffff, XmNeditable, FALSE, XmNcursorPositionVisible,
ONWAAR, XmNhighlightThickness, 0, XmNshadowThickness, 1, NULL); XtAddCallback (knop, XmNactivateCallback, my_callback, NULL); XtManageChild (knop); XtRealizeWidget (toplevel);
XtAppMainLoop (app);} VOID my_callback (Widget w, XtPointer client_data, XtPointer call_data)
{XmPushButtonCallbackStruct * cbs =(XmPushButtonCallbackStruct *) call_data; callWeb();
} void callWeb()
{EncryptDecryptSoapBindingProxy service; std::string resultaat;
Als (service.encDec(XmTextGetString(text),result) == SOAP_OK)
{
Std::Cout << "Resultaat" << resultaat << std::endl;
char * cstr = nieuwe char[result.length() + 1];
strcpy (cstr, result.c_str());
XmTextSetString(text1,cstr);
verwijderen [] cstr;
}
anders
service.soap_stream_fault(std::cerr);
}
Compileer de bovenstaande code met de volgende opdracht:
g ++ -o Cclient Cclient.c soapC.cpp soapEncryptDecryptSoapBindingProxy.cpp - lgsoap ++ - lXm - lXt-lX11
Stormloop naar de Executable voor toegang tot de functionaliteit die door de webservice.