SOAP_FMAC1 void SOAP_FMAC2 soap_print_fault(struct soap *soap, std::ostream& msg) { if (soap->error) { if (!*soap_faultcode(soap)) soap_set_fault(soap); if (!*soap_faultstring(soap)) *soap_faultstring(soap) = ""; msg << "SOAP FAULT: " << *soap_faultcode(soap) << std::endl << "\"" << *soap_faultstring(soap) << "\"" << std::endl; if (*soap_faultdetail(soap)) msg << "Detail: " << *soap_faultdetail(soap) << std::endl; } }
static void glite_jp_server_err2fault(const glite_jp_context_t ctx,struct soap *soap) { struct SOAP_ENV__Detail *detail; struct jptype__genericFault *item; #if GSOAP_VERSION >= 20709 struct jptype__genericFault *f; item = f = jp2s_error(soap,ctx->error); #else struct _genericFault *f = soap_malloc(soap, sizeof *f); item = f->jpelem__genericFault = jp2s_error(soap,ctx->error); #endif soap_receiver_fault(soap,"Oh, shit!",NULL); // no error in JP context? if (!item) return; detail = (struct SOAP_ENV__Detail *)soap_faultdetail(soap); #if GSOAP_VERSION >= 20700 detail->fault = (void *)f; #else detail->value = (void *)f; #endif detail->__type = GFNUM; detail->__any = NULL; if (soap->version == 2) soap->fault->SOAP_ENV__Detail = detail; else soap->fault->detail = detail; }
static void _fault_to_error(glite_delegation_ctx *ctx, const char *method) { const char **code, **string, **detail; struct soap *soap = ctx->soap; soap_set_fault(soap); if (soap->fault) { /* Look for a SOAP 1.1 fault */ if (soap->fault->detail) decode_exception(ctx, soap->fault->detail, method); /* Look for a SOAP 1.2 fault */ if (soap->fault->SOAP_ENV__Detail) decode_exception(ctx, soap->fault->SOAP_ENV__Detail, method); } /* If we did not manage to decode the exception, try generic error * decoding */ if (!ctx->error) { code = soap_faultcode(soap); string = soap_faultstring(soap); detail = soap_faultdetail(soap); /* If the SOAP 1.1 detail is empty, try the SOAP 1.2 detail */ if (!detail && soap->fault && soap->fault->SOAP_ENV__Detail) detail = (const char **)&soap->fault->SOAP_ENV__Detail->__any; /* Provide default messages */ if (!code || !*code) { code = alloca(sizeof(*code)); *code = "(SOAP fault code missing)"; } if (!string || !*string) { string = alloca(sizeof(*string)); *string = "(SOAP fault string missing)"; } if (detail && *detail) glite_delegation_set_error(ctx, "%s: SOAP fault: %s - %s (%s)", method, *code, *string, *detail); else glite_delegation_set_error(ctx, "%s: SOAP fault: %s - %s", method, *code, *string); } soap_end(soap); }
/* * This method is used to print the SOAP fault to a string */ void soap_sprint_fault(struct soap *soap, char *fd) { if (soap->error) { const char *c, *v = NULL, *s, **d; d = soap_faultcode(soap); if (!*d) soap_set_fault(soap); c = *d; if (soap->version == 2) v = *soap_faultsubcode(soap); s = *soap_faultstring(soap); d = soap_faultdetail(soap); sprintf(fd, "%s%d fault: %s [%s]\n\"%s\"\nDetail: %s\n", soap->version ? "SOAP 1." : "Error ", soap->version ? (int)soap->version : soap->error, c, v ? v : "no subcode", s ? s : "[no reason]", d && *d ? *d : "[no detail]"); } }
static int my_soap_set_error(struct soap *soap, const char *faultcode, const char *faultsubcodeQName, const char *faultstring, const char *faultdetailXML, int soaperror) { *soap_faultcode(soap) = faultcode; if (faultsubcodeQName) *soap_faultsubcode(soap) = faultsubcodeQName; *soap_faultstring(soap) = faultstring; if (faultdetailXML && *faultdetailXML) { register const char **s = soap_faultdetail(soap); if (s) *s = faultdetailXML; } return soap->error = soaperror; }
void Request::Execute() { try { this->setEndpoint(); this->setHeader(); try { this->getRequest(); } catch (soap* soap) { if (soap_check_state(soap)) std::clog << "Error: soap struct state not initialized\n"; else if (soap->error) { const char *c, *v = NULL, *s, **d; d = soap_faultcode(soap); if (!*d) soap_set_fault(soap); c = *d; if (soap->version == 2) v = *soap_faultsubcode(soap); s = *soap_faultstring(soap); d = soap_faultdetail(soap); std::clog << (soap->version ? "SOAP 1." : "Error ") << (soap->version ? (int) soap->version : soap->error) << " fault: " << c << "[" << (v ? v : "no subcode") << "]" << std::endl << "\"" << (s ? s : "[no reason]") << "\"" << std::endl << "Detail: " << (d && *d ? *d : "[no detail]") << std::endl; ; } } } catch (int a) { if (a == 100) std::clog << "ERRORE: endpoint non trovato" << std::endl; } }
void edg_wll_ErrToFault(const edg_wll_Context ctx,struct soap *soap) { char *et,*ed; struct SOAP_ENV__Detail *detail; #if GSOAP_VERSION >= 20709 struct lbt__genericFault *f = soap_malloc(soap,sizeof *f); struct lbt__genericFault *item = f; #else struct _genericFault *f = soap_malloc(soap,sizeof *f); struct lbt__genericFault *item = f->lbe__genericFault = soap_malloc(soap, sizeof *item); #endif memset(item, 0, sizeof(*item)); item->code = edg_wll_Error(ctx,&et,&ed); item->text = soap_malloc(soap,strlen(et)+1); strcpy(item->text, et); free(et); if (ed) { item->description = soap_malloc(soap,strlen(ed)+1); strcpy(item->description,ed); free(ed); } detail = (struct SOAP_ENV__Detail *)soap_faultdetail(soap); detail->__type = GFNUM; #if GSOAP_VERSION >= 20700 detail->fault = f; #else detail->value = f; #endif detail->__any = NULL; soap_receiver_fault(soap,"An error occurred, see detail",NULL); if (soap->version == 2) soap->fault->SOAP_ENV__Detail = detail; else soap->fault->detail = detail; }
const char *RemoteDiscoveryBindingProxy::soap_fault_detail() { return *soap_faultdetail(this->soap); }
const char *WsDfuServiceSoapProxy::soap_fault_detail() { return *soap_faultdetail(this); }
const char *repositorySoapBindingProxy::soap_fault_detail() { return *soap_faultdetail(this->soap); }
const char *RepositorySoapProxy::soap_fault_detail() { return *soap_faultdetail(this); }
const char *UploaderSoapProxy::soap_fault_detail() { return *soap_faultdetail(this); }
const char *OntologyQuerySoapBindingProxy::soap_fault_detail() { return *soap_faultdetail(this); }
const char *CRAB_ProxySOAPProxy::soap_fault_detail() { return *soap_faultdetail(this); }
const char *MemberServicesSoapProxy::soap_fault_detail() { return *soap_faultdetail(this); }
const char *CustomBinding_DumpUploadService3_UploaderProxy::soap_fault_detail() { return *soap_faultdetail(this); }
const char *ws_USCOREaccountServiceSoapProxy::soap_fault_detail() { return *soap_faultdetail(this); }
const char *SearchBindingProxy::soap_fault_detail() { return *soap_faultdetail(this); }
const char *RuleEngineBindingProxy::soap_fault_detail() { return *soap_faultdetail(this->soap); }
const char *SealingServicesBindingProxy::soap_fault_detail() { return *soap_faultdetail(this); }
const char *enrimaSoap11Proxy::soap_fault_detail() { return *soap_faultdetail(this); }
const char *BESFactorySOAPBindingProxy::soap_fault_detail() { return *soap_faultdetail(this); }
const char *ReceiverBindingProxy::soap_fault_detail() { return *soap_faultdetail(this); }
const char *dpws_discoveryProxy::soap_fault_detail() { return *soap_faultdetail(this); }
const char *ImagingBindingProxy::soap_fault_detail() { return *soap_faultdetail(this); }
int interoptA(const char *url) { struct soap *soap; int i, g; xsd__string so, si = "Hello World! <>&"; struct ArrayOfstring Asi, Aso; xsd__int no, ni = 1234567890; xsd__int n = 2147483647; struct ArrayOfint Ani, Ano; xsd__float f1 = 123.5678; xsd__float f2 = 3.14; xsd__float fo, fi = 123.5; #ifdef SYMBIAN const struct soap_double_nan { unsigned int n1, n2; } soap_double_nan; #endif xsd__float nan = FLT_NAN, inf = FLT_PINFTY, ninf = FLT_NINFTY; struct ArrayOffloat Afi, Afo; struct s__SOAPStruct sti, *p; struct ns__echoStructResponse sto; struct ArrayOfSOAPStruct Asti, Asto; struct ns__echoVoidResponse Rv; struct xsd__base64Binary b64i, b64o; xsd__dateTime dto, dti = "1967-12-29T01:02:03"; struct xsd__hexBinary hbi, hbo; xsd__decimal Do, Di = "1234567890.123456789"; xsd__boolean bo, bi = true; displayText("running test A on"); displayText((char*)url); soap = soap_new(); soap->namespaces = (struct Namespace *)namespaces; // soap.send_timeout = 30; // soap.recv_timeout = 30; Asi.__size = 8; Asi.__offset = 0; Asi.__ptr = (xsd__string*)malloc(Asi.__size*sizeof(xsd__string)); Asi.__ptr[0] = NULL; Asi.__ptr[1] = " Hello\tWorld"; Asi.__ptr[2] = NULL; Asi.__ptr[3] = "! "; Asi.__ptr[4] = NULL; Asi.__ptr[5] = si; Asi.__ptr[6] = NULL; Asi.__ptr[7] = si; Ani.__size = 0; Ani.__offset = 0; Ani.__ptr = NULL; // (xsd__int*)malloc(Ani.__size*sizeof(xsd__int)); Afi.__size = 5; Afi.__offset = 0; Afi.__ptr = (xsd__float**)malloc(Afi.__size*sizeof(xsd__float*)); Afi.__ptr[0] = &f1; Afi.__ptr[1] = &f1; // FLT_NAN; Afi.__ptr[2] = &inf; // FLT_PINFTY; Afi.__ptr[3] = &ninf; // FLT_NINFTY; Afi.__ptr[4] = &f2; sti.varString = "Hello"; sti.varInt = &n; sti.varFloat = &f1; Asti.__size = 3; Asti.__offset = 2; Asti.__ptr = (struct s__SOAPStruct**)malloc((Asti.__size+1)*sizeof(struct s__SOAPStruct*)); p = (struct s__SOAPStruct*)malloc(Asti.__size*sizeof(struct s__SOAPStruct)); Asti.__ptr[0] = p; Asti.__ptr[1] = p+1; Asti.__ptr[2] = p+2; Asti.__ptr[3] = p; Asti.__ptr[0]->varString = "Hello"; Asti.__ptr[0]->varInt = &n; Asti.__ptr[0]->varFloat = &f1; Asti.__ptr[1]->varString = "World"; Asti.__ptr[1]->varInt = &n; Asti.__ptr[1]->varFloat = &f2; Asti.__ptr[2]->varString = "!"; Asti.__ptr[2]->varInt = &n; Asti.__ptr[2]->varFloat = &f2; unsigned char b64data[4]={0x80, 0x81, 0x82, 0x83}; b64i.__ptr = b64data; b64i.__size = 4; hbi.__ptr = (unsigned char*)"This is an example HexBinary encoded string"; hbi.__size = strlen((char*)hbi.__ptr)+1; char *site=(char*)url; char* action = "http://soapinterop.org/"; bool ok=true; if (soap_call_ns__echoString(soap, site, action, si, so)) { displayText("echoString failed"); ok=false; } else if (!so || strcmp(si, so)) { ok=false; displayText("echoString mismatch"); } else displayText("echoString pass"); if (soap_call_ns__echoInteger(soap, site, "http://soapinterop.org/", ni, no)) { ok=false; displayText("echoInteger fail"); } else if (ni != no) { ok=false; displayText("echoInteger mismatch"); } else displayText("echoInteger pass"); if (soap_call_ns__echoFloat(soap, site, "http://soapinterop.org/", fi, fo)) { ok=false; displayText("echoFloat fail"); } else if (fi != fo) { ok=false; displayText("echoFloat mismatch"); } else displayText("echoFloat pass"); if (soap_call_ns__echoStruct(soap, site, "http://soapinterop.org/", sti, sto)) { ok=false; displayText("echoStruct fail"); } else if (!sto._return.varString || strcmp(sti.varString, sto._return.varString) || !sto._return.varInt || *sti.varInt != *sto._return.varInt || !sto._return.varFloat || *sti.varFloat != *sto._return.varFloat) { ok=false; displayText("echoStruct mismatch"); } else displayText("echoStruct pass"); if (soap_call_ns__echoStringArray(soap, site, "http://soapinterop.org/", Asi, Aso)) { soap_set_fault(soap); soap_faultdetail(soap); ok=false; displayText("echoStringArray fail"); } else { g = 0; if (Asi.__size != Aso.__size) g = 1; else for (i = 0; i < Asi.__size; i++) if (Asi.__ptr[i] && Aso.__ptr[i] && strcmp(Asi.__ptr[i], Aso.__ptr[i])) g = 1; else if (!Asi.__ptr[i]) ; else if (Asi.__ptr[i] && !Aso.__ptr[i]) g = 1; if (g) { ok=false; displayText("echoStringArray mismatch"); } else displayText("echoStringArray pass"); } if (soap_call_ns__echoIntegerArray(soap, site, "http://soapinterop.org/", Ani, Ano)) { displayText("echoIntegerArray fail"); ok=false; } else { g = 0; if (Ani.__size != Ano.__size) g = 1; else for (i = 0; i < Ani.__size; i++) if (Ani.__ptr[i] && (!Ano.__ptr[i] || *Ani.__ptr[i] != *Ano.__ptr[i])) g = 1; if (g) { displayText("echoIntegerArray mismatch"); ok=false; } else displayText("echoIntegerArray pass"); } if (soap_call_ns__echoFloatArray(soap, site, "http://soapinterop.org/", Afi, Afo)) { displayText("echoFloatArray fail"); ok=false; } else { g = 0; if (Afi.__size != Afo.__size) g = 1; else for (i = 0; i < Afi.__size; i++) if (Afi.__ptr[i] && Afo.__ptr[i] && soap_isnan(*Afi.__ptr[i]) && soap_isnan(*Afo.__ptr[i])) ; else if (Afi.__ptr[i] && (!Afo.__ptr[i] || *Afi.__ptr[i] != *Afo.__ptr[i])) g = 1; if (g) { displayText("echoFloatArray mismatch"); ok=false; } else displayText("echoFloatArray pass"); } if (soap_call_ns__echoStructArray(soap, site, "http://soapinterop.org/", Asti, Asto)) { displayText("echoStructArray fail"); ok=false; } else { g = 0; if (Asti.__size+Asti.__offset != Asto.__size+Asto.__offset) g = 1; else for (i = Asti.__offset; i < Asti.__size+Asti.__offset; i++) if (!Asto.__ptr[i-Asto.__offset] || !Asto.__ptr[i-Asto.__offset]->varString || strcmp(Asti.__ptr[i-Asti.__offset]->varString, Asto.__ptr[i-Asto.__offset]->varString) || !Asto.__ptr[i-Asto.__offset]->varInt || *Asti.__ptr[i-Asti.__offset]->varInt != *Asto.__ptr[i-Asto.__offset]->varInt || !Asto.__ptr[i-Asto.__offset]->varFloat || *Asti.__ptr[i-Asti.__offset]->varFloat != *Asto.__ptr[i-Asto.__offset]->varFloat) g = 1; if (g) { displayText("echoStructArray mismatch"); ok=false; } else displayText("echoStructArray pass"); } if (soap_call_ns__echoVoid(soap, site, "http://soapinterop.org/", Rv)) { displayText("echoVoid fail"); ok=false; } else displayText("echoVoid pass"); { int S1=sizeof(int); int S2= sizeof (size_t); int S3=sizeof(0); } if (soap_call_ns__echoBase64(soap, site, "http://soapinterop.org/", b64i, b64o)) { displayText("echoBase64 fail"); ok=false; } else if ((b64i.__size+2)/3 != (b64o.__size+2)/3 || strncmp((char*)b64i.__ptr, (char*)b64o.__ptr,b64i.__size)) { displayText("echoBase64 mismatch"); ok=false; } else displayText("echoBase64 pass"); if (soap_call_ns__echoDate(soap, site, "http://soapinterop.org/", dti, dto)) { displayText("echoDate fail"); ok=false; } else if (!dto || strncmp(dti, dto, 19)) { displayText("echoDate mismatch"); ok=false; } else displayText("echoDate pass"); if (soap_call_ns__echoHexBinary(soap, site, "http://soapinterop.org/", hbi, hbo)) { ok=false; displayText("echoHexBinary fail"); } else if (hbi.__size != hbo.__size || strcmp((char*)hbi.__ptr, (char*)hbo.__ptr)) { ok=false; displayText("echoHexBinary mismatch"); } else displayText("echoHexBinary pass"); if (soap_call_ns__echoDecimal(soap, site, "http://soapinterop.org/", Di, Do)) { ok=false; displayText("echoDecimal pass"); } else if (strcmp(Di, Do)) { ok=false; displayText("echoDecimal mismatch"); } else displayText("echoDecimal pass"); if (soap_call_ns__echoBoolean(soap, site, "http://soapinterop.org/", bi, bo)) { ok=false; displayText("echoBoolean fail"); } else if (bi != bo) { ok=false; displayText("echoBoolean mismatch"); } else displayText("echoBoolean pass"); soap_end(soap); soap_done(soap); if (ok) displayText("ALL PASS"); else displayText("FAILURES"); return 0; end: return 1; }
const char *calcProxy::soap_fault_detail() { return *soap_faultdetail(this); }
const char *WsAttributesServiceSoapProxy::soap_fault_detail() { return *soap_faultdetail(this); }
const char *DoorControlBindingProxy::soap_fault_detail() { return *soap_faultdetail(this); }
const char *CS8ServerV1Proxy::soap_fault_detail() { return *soap_faultdetail(this); }