#include "soapH.h" #include "interop2C.nsmap" int main(int argc, char **argv) { struct soap soap; int n = 42; float f = 99.005; struct SOAP_ENV__Header h; struct m__echoVoidResponse r; struct s__SOAPStruct s; h.h__echoMeStringRequest = NULL; h.h__echoMeStringRequest_ = NULL; h.h__echoMeStringResponse = NULL; h.h__echoMeStructRequest = NULL; h.h__echoMeStructRequest_ = NULL; h.h__echoMeStructResponse = NULL; h.h__someUnknownRequest = NULL; h.h__someUnknownRequest_ = NULL; s.varString = "hello world"; s.varInt = &n; s.varFloat = &f; FILE *fd = fopen("interop2Cfaults.html", "a"); soap_init(&soap); fprintf(fd, ""); soap.send_timeout = 30; soap.recv_timeout = 30; // request from client (with mustUnderstand="0", recipient is target) h.h__echoMeStringRequest = "hello world"; soap.header = &h; soap.actor = "http://schemas.xmlsoap.org/soap/actor/next"; if (soap_call_m__echoVoid(&soap, argv[1], "http://soapinterop.org/", r)) { printf("FAULT\n", argv[1]); fprintf(fd, "
", argv[1]);
    soap_print_fault(&soap, fd);
    soap_print_fault_location(&soap, fd);
    fprintf(fd, "

"); } else printf("PASS\n"); fflush(stdout); // request from client (with mustUnderstand="0", recipient is not target) soap.header = &h; soap.actor = "http://some/other/actor"; if (soap_call_m__echoVoid(&soap, argv[1], "http://soapinterop.org/", r)) { printf("FAULT\n", argv[1]); fprintf(fd, "
", argv[1]);
    soap_print_fault(&soap, fd);
    soap_print_fault_location(&soap, fd);
    fprintf(fd, "

"); } else printf("PASS\n"); fflush(stdout); // request from client (with mustUnderstand="1", recipient is target) h.h__echoMeStringRequest = NULL; h.h__echoMeStructRequest_ = &s; soap.header = &h; soap.actor = "http://schemas.xmlsoap.org/soap/actor/next"; if (soap_call_m__echoVoid(&soap, argv[1], "http://soapinterop.org/", r)) { printf("FAULT\n", argv[1]); fprintf(fd, "
", argv[1]);
    soap_print_fault(&soap, fd);
    soap_print_fault_location(&soap, fd);
    fprintf(fd, "

"); } else printf("PASS\n"); fflush(stdout); // request from client (with mustUnderstand="1", recipient is not target) soap.header = &h; soap.actor = "http://some/other/actor"; if (soap_call_m__echoVoid(&soap, argv[1], "http://soapinterop.org/", r)) { printf("FAULT\n", argv[1]); fprintf(fd, "
", argv[1]);
    soap_print_fault(&soap, fd);
    soap_print_fault_location(&soap, fd);
    fprintf(fd, "

"); } else if (soap.header && soap.header->h__echoMeStructResponse) { printf("FAIL\n", argv[1]); fprintf(fd, "The header contains a response but should not.
", argv[1]); } else printf("PASS\n"); fflush(stdout); // Unknown header element: request from client (with mustUnderstand="0", recipient is target) h.h__echoMeStructRequest_ = NULL; h.h__someUnknownRequest = "XYZ"; soap.header = &h; soap.actor = "http://schemas.xmlsoap.org/soap/actor/next"; if (soap_call_m__echoVoid(&soap, argv[1], "http://soapinterop.org/", r)) { printf("FAULT\n", argv[1]); fprintf(fd, "
", argv[1]);
    soap_print_fault(&soap, fd);
    soap_print_fault_location(&soap, fd);
    fprintf(fd, "

"); } else printf("PASS\n"); fflush(stdout); // Unknown header element: request from client (with mustUnderstand="1", recipient is target) h.h__someUnknownRequest = NULL; h.h__someUnknownRequest_ = "XYZ"; soap.header = &h; soap.actor = "http://schemas.xmlsoap.org/soap/actor/next"; if (soap_call_m__echoVoid(&soap, argv[1], "http://soapinterop.org/", r) != SOAP_MUSTUNDERSTAND) { printf("FAULT\n", argv[1]); fprintf(fd, "
", argv[1]);
    soap_print_fault(&soap, fd);
    soap_print_fault_location(&soap, fd);
    fprintf(fd, "

"); } else printf("PASS\n"); // Unknown header element: request from client (with mustUnderstand="0", recipient is not target) h.h__someUnknownRequest_ = NULL; h.h__someUnknownRequest = "XYZ"; soap.header = &h; soap.actor = "http://some/other/actor"; if (soap_call_m__echoVoid(&soap, argv[1], "http://soapinterop.org/", r)) { printf("FAULT\n", argv[1]); fprintf(fd, "
", argv[1]);
    soap_print_fault(&soap, fd);
    soap_print_fault_location(&soap, fd);
    fprintf(fd, "

"); } else printf("PASS\n"); // Unknown header element: request from client (with mustUnderstand="1", recipient is not target) h.h__someUnknownRequest = NULL; h.h__someUnknownRequest_ = "XYZ"; soap.header = &h; soap.actor = "http://some/other/actor"; if (soap_call_m__echoVoid(&soap, argv[1], "http://soapinterop.org/", r)) { printf("FAULT\n", argv[1]); fprintf(fd, "
", argv[1]);
    soap_print_fault(&soap, fd);
    soap_print_fault_location(&soap, fd);
    fprintf(fd, "

"); } else printf("PASS\n"); fprintf(fd, ""); fclose(fd); return 0; }