public void soapFaultHandling( ) { GXSoapXMLReader.Read(); while (!((StringUtil.StrCmp(GXSoapXMLReader.LocalName, "Fault") == 0) && (GXSoapXMLReader.NodeType == 2))) { if (StringUtil.StrCmp(StringUtil.Lower(GXSoapXMLReader.Name), "faultcode") == 0) { sFaultCode = GXSoapXMLReader.Value; } else if (StringUtil.StrCmp(StringUtil.Lower(GXSoapXMLReader.Name), "faultstring") == 0) { sFaultString = GXSoapXMLReader.Value; } else if (StringUtil.StrCmp(StringUtil.Lower(GXSoapXMLReader.Name), "detail") == 0) { if (GXSoapXMLReader.IsSimple == 0) { GXSoapXMLReader.Read(); sDetail = GXSoapXMLReader.ReadRawXML(); } else { sDetail = GXSoapXMLReader.Value; } } GXSoapXMLReader.Read(); } if (StringUtil.StringSearch(StringUtil.Lower(sFaultCode), "client", 1) > 0) { currSoapErr = (short)(-20004); currSoapErrmsg = currSoapErrmsg + "SOAP Fault: Error in client request." + StringUtil.NewLine( ) + "Message: " + sFaultString + StringUtil.NewLine( ) + "Detail: " + sDetail; } else if (StringUtil.StringSearch(StringUtil.Lower(sFaultCode), "server", 1) > 0) { currSoapErr = (short)(-20005); currSoapErrmsg = currSoapErrmsg + "SOAP Fault: Error in server execution." + StringUtil.NewLine( ) + "Message: " + sFaultString + StringUtil.NewLine( ) + "Detail: " + sDetail; } else { currSoapErr = (short)(-20006); currSoapErrmsg = currSoapErrmsg + "Unknown error: " + sFaultCode + StringUtil.NewLine( ) + "Message: " + sFaultString + StringUtil.NewLine( ) + "Detail: " + sDetail; } return; }
void executePrivate( ) { /* GeneXus formulas */ /* Output device settings */ context.nSOAPErr = 0; context.sSOAPErrMsg = ""; GXSoapHTTPClient.Host = context.GetServerName( ); GXSoapHTTPClient.Port = context.GetServerPort( ); GXSoapHTTPClient.BaseURL = context.GetScriptPath( ); SoapParm.AssignLocationProperties(context, "AwsCalcularPasajeros", GXSoapHTTPClient); GXSoapHTTPClient.AddHeader("Content-type", "text/xml;charset=utf-8"); GXSoapHTTPClient.AddHeader("SOAPAction", "CalcularPeajesaction/" + "AWSCALCULARPASAJEROS.Execute"); GXSoapXMLWriter.OpenRequest(GXSoapHTTPClient); GXSoapXMLWriter.WriteStartDocument("utf-8", 0); GXSoapXMLWriter.WriteStartElement("SOAP-ENV:Envelope"); GXSoapXMLWriter.WriteAttribute("xmlns:SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/"); GXSoapXMLWriter.WriteAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema"); GXSoapXMLWriter.WriteAttribute("xmlns:SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/"); GXSoapXMLWriter.WriteAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); GXSoapXMLWriter.WriteStartElement("SOAP-ENV:Body"); GXSoapXMLWriter.WriteStartElement("Execute"); GXSoapXMLWriter.WriteAttribute("xmlns", "CalcularPeajes"); GXSoapXMLWriter.WriteElement("Paxitc", StringUtil.Trim(StringUtil.Str((decimal)(AV2PAXITC), 10, 0))); GXSoapXMLWriter.WriteAttribute("xmlns", "http://tempuri.org/"); GXSoapXMLWriter.WriteElement("Trb", StringUtil.Trim(StringUtil.Str((decimal)(AV3TRB), 10, 0))); GXSoapXMLWriter.WriteAttribute("xmlns", "http://tempuri.org/"); GXSoapXMLWriter.WriteElement("Cpsuab", StringUtil.Trim(StringUtil.Str((decimal)(AV4CPSUAB), 10, 0))); GXSoapXMLWriter.WriteAttribute("xmlns", "http://tempuri.org/"); GXSoapXMLWriter.WriteEndElement(); GXSoapXMLWriter.WriteEndElement(); GXSoapXMLWriter.WriteEndElement(); GXSoapXMLWriter.Close(); GXSoapHTTPClient.Execute("POST", "awscalcularpasajeros.aspx"); if (GXSoapHTTPClient.ErrCode != 0) { currSoapErr = (short)(GXSoapHTTPClient.ErrCode * -1 - 10000); currSoapErrmsg = GXSoapHTTPClient.ErrDescription; } GXSoapXMLReader.OpenResponse(GXSoapHTTPClient); GXSoapError = GXSoapXMLReader.Read(); while (GXSoapError > 0) { if (StringUtil.StringSearch(GXSoapXMLReader.Name, "Body", 1) > 0) { if (true) { break; } } GXSoapError = GXSoapXMLReader.Read(); } if (GXSoapError > 0) { GXSoapError = GXSoapXMLReader.Read(); if ((GXSoapError > 0) && (StringUtil.StrCmp(GXSoapXMLReader.LocalName, "Fault") == 0)) { soapFault = 1; } } sTagName = GXSoapXMLReader.Name; if (GXSoapXMLReader.IsSimple == 0) { if (soapFault == 0) { GXSoapError = GXSoapXMLReader.Read(); if ((GXSoapError > 0) && (StringUtil.StrCmp(GXSoapXMLReader.LocalName, "Fault") == 0)) { soapFault = 1; } } if (soapFault == 1) { GXSoapXMLReader.Read(); while (!((StringUtil.StrCmp(GXSoapXMLReader.LocalName, "Fault") == 0) && (GXSoapXMLReader.NodeType == 2))) { if (StringUtil.StrCmp(StringUtil.Lower(GXSoapXMLReader.Name), "faultcode") == 0) { sFaultCode = GXSoapXMLReader.Value; } else if (StringUtil.StrCmp(StringUtil.Lower(GXSoapXMLReader.Name), "faultstring") == 0) { sFaultString = GXSoapXMLReader.Value; } else if (StringUtil.StrCmp(StringUtil.Lower(GXSoapXMLReader.Name), "detail") == 0) { if (GXSoapXMLReader.IsSimple == 0) { GXSoapXMLReader.Read(); sDetail = GXSoapXMLReader.ReadRawXML(); } else { sDetail = GXSoapXMLReader.Value; } } GXSoapXMLReader.Read(); } if (StringUtil.StringSearch(StringUtil.Lower(sFaultCode), "client", 1) > 0) { currSoapErr = (short)(-20004); currSoapErrmsg = currSoapErrmsg + "SOAP Fault: Error in client request." + StringUtil.NewLine( ) + "Message: " + sFaultString + StringUtil.NewLine( ) + "Detail: " + sDetail; } else if (StringUtil.StringSearch(StringUtil.Lower(sFaultCode), "server", 1) > 0) { currSoapErr = (short)(-20005); currSoapErrmsg = currSoapErrmsg + "SOAP Fault: Error in server execution." + StringUtil.NewLine( ) + "Message: " + sFaultString + StringUtil.NewLine( ) + "Detail: " + sDetail; } else { currSoapErr = (short)(-20006); currSoapErrmsg = currSoapErrmsg + "Unknown error: " + sFaultCode + StringUtil.NewLine( ) + "Message: " + sFaultString + StringUtil.NewLine( ) + "Detail: " + sDetail; } } else { nOutParmCount = 0; while (((StringUtil.StrCmp(GXSoapXMLReader.Name, sTagName) != 0) || (GXSoapXMLReader.NodeType == 1)) && (GXSoapError > 0)) { readOk = 0; if (StringUtil.StrCmp2(GXSoapXMLReader.LocalName, "Resultado") && (GXSoapXMLReader.NodeType != 2) && (StringUtil.StrCmp(GXSoapXMLReader.NamespaceURI, "http://tempuri.org/") == 0)) { AV5Resultado = GXSoapXMLReader.Value; if (GXSoapError > 0) { readOk = 1; } GXSoapError = GXSoapXMLReader.Read(); } nOutParmCount = (short)(nOutParmCount + 1); if (readOk == 0) { context.sSOAPErrMsg = context.sSOAPErrMsg + "Error reading " + sTagName + StringUtil.NewLine( ); context.sSOAPErrMsg = context.sSOAPErrMsg + "Message: " + GXSoapXMLReader.ReadRawXML(); GXSoapError = (short)(nOutParmCount * -1); } } } } GXSoapXMLReader.Close(); if (currSoapErr == 0) { if (GXSoapError < 0) { currSoapErr = (short)(GXSoapError * -1); currSoapErrmsg = context.sSOAPErrMsg; } else { if (GXSoapXMLReader.ErrCode > 0) { currSoapErr = (short)(GXSoapXMLReader.ErrCode * -1); currSoapErrmsg = GXSoapXMLReader.ErrDescription; } else { if (GXSoapError == 0) { currSoapErr = (short)(-20001); currSoapErrmsg = "Malformed SOAP message."; } else { currSoapErr = 0; currSoapErrmsg = "No error."; } } } } if (currSoapErr != 0) { oLocation = SoapParm.getlocation(context, "AwsCalcularPasajeros"); if (oLocation.CancelOnError == 1) { throw new Exception(currSoapErrmsg + "(" + StringUtil.LTrim(StringUtil.NToC((decimal)(currSoapErr), 6, 0, ".", "")) + ")"); } } context.nSOAPErr = currSoapErr; context.sSOAPErrMsg = currSoapErrmsg; this.cleanup(); }
public override void webExecute( ) { context.SetDefaultTheme("Flat"); initialize(); if (!context.isAjaxRequest( )) { GXSoapHTTPResponse.AppendHeader("Content-type", "text/xml;charset=utf-8"); } if (StringUtil.StrCmp(StringUtil.Lower(GXSoapHTTPRequest.Method), "get") == 0) { if (StringUtil.StrCmp(StringUtil.Lower(GXSoapHTTPRequest.QueryString), "wsdl") == 0) { GXSoapXMLWriter.OpenResponse(GXSoapHTTPResponse); GXSoapXMLWriter.WriteStartDocument("utf-8", 0); GXSoapXMLWriter.WriteStartElement("definitions"); GXSoapXMLWriter.WriteAttribute("name", "wscalcularquimiqueros"); GXSoapXMLWriter.WriteAttribute("targetNamespace", "CalcularPeajes"); GXSoapXMLWriter.WriteAttribute("xmlns:wsdlns", "CalcularPeajes"); GXSoapXMLWriter.WriteAttribute("xmlns:soap", "http://schemas.xmlsoap.org/wsdl/soap/"); GXSoapXMLWriter.WriteAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema"); GXSoapXMLWriter.WriteAttribute("xmlns", "http://schemas.xmlsoap.org/wsdl/"); GXSoapXMLWriter.WriteAttribute("xmlns:tns", "CalcularPeajes"); GXSoapXMLWriter.WriteStartElement("types"); GXSoapXMLWriter.WriteStartElement("schema"); GXSoapXMLWriter.WriteAttribute("targetNamespace", "CalcularPeajes"); GXSoapXMLWriter.WriteAttribute("xmlns", "http://www.w3.org/2001/XMLSchema"); GXSoapXMLWriter.WriteAttribute("xmlns:SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/"); GXSoapXMLWriter.WriteAttribute("elementFormDefault", "qualified"); GXSoapXMLWriter.WriteStartElement("element"); GXSoapXMLWriter.WriteAttribute("name", "wscalcularquimiqueros.Execute"); GXSoapXMLWriter.WriteStartElement("complexType"); GXSoapXMLWriter.WriteStartElement("sequence"); GXSoapXMLWriter.WriteElement("element", ""); GXSoapXMLWriter.WriteAttribute("minOccurs", "1"); GXSoapXMLWriter.WriteAttribute("maxOccurs", "1"); GXSoapXMLWriter.WriteAttribute("name", "Quimiquerosbandacpsuab"); GXSoapXMLWriter.WriteAttribute("type", "xsd:long"); GXSoapXMLWriter.WriteElement("element", ""); GXSoapXMLWriter.WriteAttribute("minOccurs", "1"); GXSoapXMLWriter.WriteAttribute("maxOccurs", "1"); GXSoapXMLWriter.WriteAttribute("name", "Dominioimo"); GXSoapXMLWriter.WriteAttribute("type", "xsd:string"); GXSoapXMLWriter.WriteEndElement(); GXSoapXMLWriter.WriteEndElement(); GXSoapXMLWriter.WriteEndElement(); GXSoapXMLWriter.WriteStartElement("element"); GXSoapXMLWriter.WriteAttribute("name", "wscalcularquimiqueros.ExecuteResponse"); GXSoapXMLWriter.WriteStartElement("complexType"); GXSoapXMLWriter.WriteStartElement("sequence"); GXSoapXMLWriter.WriteElement("element", ""); GXSoapXMLWriter.WriteAttribute("minOccurs", "1"); GXSoapXMLWriter.WriteAttribute("maxOccurs", "1"); GXSoapXMLWriter.WriteAttribute("name", "Dominioimo"); GXSoapXMLWriter.WriteAttribute("type", "xsd:string"); GXSoapXMLWriter.WriteElement("element", ""); GXSoapXMLWriter.WriteAttribute("minOccurs", "1"); GXSoapXMLWriter.WriteAttribute("maxOccurs", "1"); GXSoapXMLWriter.WriteAttribute("name", "Resultado"); GXSoapXMLWriter.WriteAttribute("type", "xsd:string"); GXSoapXMLWriter.WriteEndElement(); GXSoapXMLWriter.WriteEndElement(); GXSoapXMLWriter.WriteEndElement(); GXSoapXMLWriter.WriteEndElement(); GXSoapXMLWriter.WriteEndElement(); GXSoapXMLWriter.WriteStartElement("message"); GXSoapXMLWriter.WriteAttribute("name", "wscalcularquimiqueros.ExecuteSoapIn"); GXSoapXMLWriter.WriteElement("part", ""); GXSoapXMLWriter.WriteAttribute("name", "parameters"); GXSoapXMLWriter.WriteAttribute("element", "tns:wscalcularquimiqueros.Execute"); GXSoapXMLWriter.WriteEndElement(); GXSoapXMLWriter.WriteStartElement("message"); GXSoapXMLWriter.WriteAttribute("name", "wscalcularquimiqueros.ExecuteSoapOut"); GXSoapXMLWriter.WriteElement("part", ""); GXSoapXMLWriter.WriteAttribute("name", "parameters"); GXSoapXMLWriter.WriteAttribute("element", "tns:wscalcularquimiqueros.ExecuteResponse"); GXSoapXMLWriter.WriteEndElement(); GXSoapXMLWriter.WriteStartElement("portType"); GXSoapXMLWriter.WriteAttribute("name", "wscalcularquimiquerosSoapPort"); GXSoapXMLWriter.WriteStartElement("operation"); GXSoapXMLWriter.WriteAttribute("name", "Execute"); GXSoapXMLWriter.WriteElement("input", ""); GXSoapXMLWriter.WriteAttribute("message", "wsdlns:" + "wscalcularquimiqueros.ExecuteSoapIn"); GXSoapXMLWriter.WriteElement("output", ""); GXSoapXMLWriter.WriteAttribute("message", "wsdlns:" + "wscalcularquimiqueros.ExecuteSoapOut"); GXSoapXMLWriter.WriteEndElement(); GXSoapXMLWriter.WriteEndElement(); GXSoapXMLWriter.WriteStartElement("binding"); GXSoapXMLWriter.WriteAttribute("name", "wscalcularquimiquerosSoapBinding"); GXSoapXMLWriter.WriteAttribute("type", "wsdlns:" + "wscalcularquimiquerosSoapPort"); GXSoapXMLWriter.WriteElement("soap:binding", ""); GXSoapXMLWriter.WriteAttribute("style", "document"); GXSoapXMLWriter.WriteAttribute("transport", "http://schemas.xmlsoap.org/soap/http"); GXSoapXMLWriter.WriteStartElement("operation"); GXSoapXMLWriter.WriteAttribute("name", "Execute"); GXSoapXMLWriter.WriteElement("soap:operation", ""); GXSoapXMLWriter.WriteAttribute("soapAction", "CalcularPeajesaction/" + "AWSCALCULARQUIMIQUEROS.Execute"); GXSoapXMLWriter.WriteStartElement("input"); GXSoapXMLWriter.WriteElement("soap:body", ""); GXSoapXMLWriter.WriteAttribute("use", "literal"); GXSoapXMLWriter.WriteEndElement(); GXSoapXMLWriter.WriteStartElement("output"); GXSoapXMLWriter.WriteElement("soap:body", ""); GXSoapXMLWriter.WriteAttribute("use", "literal"); GXSoapXMLWriter.WriteEndElement(); GXSoapXMLWriter.WriteEndElement(); GXSoapXMLWriter.WriteEndElement(); GXSoapXMLWriter.WriteStartElement("service"); GXSoapXMLWriter.WriteAttribute("name", "wscalcularquimiqueros"); GXSoapXMLWriter.WriteStartElement("port"); GXSoapXMLWriter.WriteAttribute("name", "wscalcularquimiquerosSoapPort"); GXSoapXMLWriter.WriteAttribute("binding", "wsdlns:" + "wscalcularquimiquerosSoapBinding"); GXSoapXMLWriter.WriteElement("soap:address", ""); GXSoapXMLWriter.WriteAttribute("location", "http://" + context.GetServerName( ) + ((context.GetServerPort( ) > 0) && (context.GetServerPort( ) != 80) && (context.GetServerPort( ) != 443) ? ":" + StringUtil.LTrim(StringUtil.Str((decimal)(context.GetServerPort( )), 6, 0)) : "") + context.GetScriptPath( ) + "awscalcularquimiqueros.aspx"); GXSoapXMLWriter.WriteEndElement(); GXSoapXMLWriter.WriteEndElement(); GXSoapXMLWriter.WriteEndElement(); GXSoapXMLWriter.Close(); return; } else { currSoapErr = (short)(-20000); currSoapErrmsg = "No SOAP request found. Call " + "http://" + context.GetServerName( ) + ((context.GetServerPort( ) > 0) && (context.GetServerPort( ) != 80) && (context.GetServerPort( ) != 443) ? ":" + StringUtil.LTrim(StringUtil.Str((decimal)(context.GetServerPort( )), 6, 0)) : "") + context.GetScriptPath( ) + "awscalcularquimiqueros.aspx" + "?wsdl to get the WSDL."; } } if (currSoapErr == 0) { GXSoapXMLReader.OpenRequest(GXSoapHTTPRequest); GXSoapError = GXSoapXMLReader.Read(); while (GXSoapError > 0) { if (StringUtil.StringSearch(GXSoapXMLReader.Name, "Body", 1) > 0) { if (true) { break; } } GXSoapError = GXSoapXMLReader.Read(); } if (GXSoapError > 0) { GXSoapError = GXSoapXMLReader.Read(); if (GXSoapError > 0) { currMethod = GXSoapXMLReader.Name; if (StringUtil.StringSearch(currMethod + "&", "Execute&", 1) > 0) { if (currSoapErr == 0) { sTagName = GXSoapXMLReader.Name; if (GXSoapXMLReader.IsSimple == 0) { GXSoapError = GXSoapXMLReader.Read(); nOutParmCount = 0; while (((StringUtil.StrCmp(GXSoapXMLReader.Name, sTagName) != 0) || (GXSoapXMLReader.NodeType == 1)) && (GXSoapError > 0)) { readOk = 0; if (StringUtil.StrCmp2(GXSoapXMLReader.LocalName, "Quimiquerosbandacpsuab") && (GXSoapXMLReader.NodeType != 2) && (StringUtil.StrCmp(GXSoapXMLReader.NamespaceURI, "CalcularPeajes") == 0)) { AV9QuimiquerosBandaCPSUAB = (long)(NumberUtil.Val(GXSoapXMLReader.Value, ".")); if (GXSoapError > 0) { readOk = 1; } GXSoapError = GXSoapXMLReader.Read(); } if (StringUtil.StrCmp2(GXSoapXMLReader.LocalName, "Dominioimo") && (GXSoapXMLReader.NodeType != 2) && (StringUtil.StrCmp(GXSoapXMLReader.NamespaceURI, "CalcularPeajes") == 0)) { AV16DominioIMO = GXSoapXMLReader.Value; if (GXSoapError > 0) { readOk = 1; } GXSoapError = GXSoapXMLReader.Read(); } nOutParmCount = (short)(nOutParmCount + 1); if (readOk == 0) { context.sSOAPErrMsg = context.sSOAPErrMsg + "Error reading " + sTagName + StringUtil.NewLine( ); context.sSOAPErrMsg = context.sSOAPErrMsg + "Message: " + GXSoapXMLReader.ReadRawXML(); GXSoapError = (short)(nOutParmCount * -1); } } } } } else { currSoapErr = (short)(-20002); currSoapErrmsg = "Wrong method called. Expected method: " + "Execute"; } } } GXSoapXMLReader.Close(); } if (currSoapErr == 0) { if (GXSoapError < 0) { currSoapErr = (short)(GXSoapError * -1); currSoapErrmsg = context.sSOAPErrMsg; } else { if (GXSoapXMLReader.ErrCode > 0) { currSoapErr = (short)(GXSoapXMLReader.ErrCode * -1); currSoapErrmsg = GXSoapXMLReader.ErrDescription; } else { if (GXSoapError == 0) { currSoapErr = (short)(-20001); currSoapErrmsg = "Malformed SOAP message."; } else { currSoapErr = 0; currSoapErrmsg = "No error."; } } } } if (currSoapErr == 0) { executePrivate(); } context.CloseConnections(); GXSoapXMLWriter.OpenResponse(GXSoapHTTPResponse); GXSoapXMLWriter.WriteStartDocument("utf-8", 0); GXSoapXMLWriter.WriteStartElement("SOAP-ENV:Envelope"); GXSoapXMLWriter.WriteAttribute("xmlns:SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/"); GXSoapXMLWriter.WriteAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema"); GXSoapXMLWriter.WriteAttribute("xmlns:SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/"); GXSoapXMLWriter.WriteAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); if (StringUtil.StringSearch(currMethod + "&", "Execute&", 1) > 0) { GXSoapXMLWriter.WriteStartElement("SOAP-ENV:Body"); GXSoapXMLWriter.WriteStartElement("wscalcularquimiqueros.ExecuteResponse"); GXSoapXMLWriter.WriteAttribute("xmlns", "CalcularPeajes"); if (currSoapErr == 0) { GXSoapXMLWriter.WriteElement("Dominioimo", StringUtil.RTrim(AV16DominioIMO)); GXSoapXMLWriter.WriteAttribute("xmlns", "CalcularPeajes"); GXSoapXMLWriter.WriteElement("Resultado", StringUtil.RTrim(AV17Resultado)); GXSoapXMLWriter.WriteAttribute("xmlns", "CalcularPeajes"); } else { GXSoapXMLWriter.WriteStartElement("SOAP-ENV:Fault"); GXSoapXMLWriter.WriteElement("faultcode", "SOAP-ENV:Client"); GXSoapXMLWriter.WriteElement("faultstring", currSoapErrmsg); GXSoapXMLWriter.WriteElement("detail", StringUtil.Trim(StringUtil.Str((decimal)(currSoapErr), 10, 0))); GXSoapXMLWriter.WriteEndElement(); } GXSoapXMLWriter.WriteEndElement(); GXSoapXMLWriter.WriteEndElement(); } GXSoapXMLWriter.WriteEndElement(); GXSoapXMLWriter.Close(); cleanup(); }
public String execute( ) { String returnexecute; returnexecute = ""; context.nSOAPErr = 0; context.sSOAPErrMsg = ""; GXSoapHTTPClient.Host = "tise-wks-345508.canal.acp"; GXSoapHTTPClient.Port = 80; GXSoapHTTPClient.BaseURL = "/CalcularPeajes.NetEnvironment/"; SoapParm.AssignLocationProperties(context, "wsrest_services", GXSoapHTTPClient); if (StringUtil.StrCmp(defaultExecute, "") == 0) { targetResourceName = (String)(SoapParm.GetResourceName(context, "wsrest_services")); if (StringUtil.StrCmp(targetResourceName, "") == 0) { execName = "wsrest.svc"; } else { execName = targetResourceName; } } else { execName = defaultExecute; } GXSoapHTTPClient.AddHeader("Content-type", "text/xml;charset=utf-8"); GXSoapHTTPClient.AddHeader("SOAPAction", "GeneXus.Programs.wsrest_services/wsrest_services/execute"); GXSoapXMLWriter.OpenRequest(GXSoapHTTPClient); GXSoapXMLWriter.WriteStartDocument("utf-8", 0); GXSoapXMLWriter.WriteStartElement("SOAP-ENV:Envelope"); GXSoapXMLWriter.WriteAttribute("xmlns:SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/"); GXSoapXMLWriter.WriteAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema"); GXSoapXMLWriter.WriteAttribute("xmlns:SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/"); GXSoapXMLWriter.WriteAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); if (!(soapHeaders == null)) { if (soapHeaders.Count > 0) { soapHeaders.writexml(GXSoapXMLWriter, "SOAP-ENV:Header", ""); } } else { if (!(String.IsNullOrEmpty(StringUtil.RTrim(soapHeadersRaw)))) { GXSoapXMLWriter.WriteStartElement("SOAP-ENV:Header"); GXSoapXMLWriter.WriteRawText(soapHeadersRaw); GXSoapXMLWriter.WriteEndElement(); } } GXSoapXMLWriter.WriteStartElement("SOAP-ENV:Body"); GXSoapXMLWriter.WriteElement("execute", ""); GXSoapXMLWriter.WriteAttribute("xmlns", "GeneXus.Programs.wsrest_services"); GXSoapXMLWriter.WriteEndElement(); GXSoapXMLWriter.WriteEndElement(); GXSoapXMLWriter.Close(); GXSoapHTTPClient.Execute("POST", execName); if (GXSoapHTTPClient.ErrCode != 0) { currSoapErr = (short)(GXSoapHTTPClient.ErrCode * -1 - 10000); currSoapErrmsg = GXSoapHTTPClient.ErrDescription; } GXSoapXMLReader.OpenResponse(GXSoapHTTPClient); GXSoapError = GXSoapXMLReader.Read(); while (GXSoapError > 0) { if (StringUtil.StringSearch(GXSoapXMLReader.Name, "Body", 1) > 0) { if (true) { break; } } GXSoapError = GXSoapXMLReader.Read(); } if (GXSoapError > 0) { GXSoapError = GXSoapXMLReader.Read(); if ((GXSoapError > 0) && (StringUtil.StrCmp(GXSoapXMLReader.LocalName, "Fault") == 0)) { soapFault = 1; } } sTagName = GXSoapXMLReader.Name; if (GXSoapXMLReader.IsSimple == 0) { if (soapFault == 0) { GXSoapError = GXSoapXMLReader.Read(); if ((GXSoapError > 0) && (StringUtil.StrCmp(GXSoapXMLReader.LocalName, "Fault") == 0)) { soapFault = 1; } } if (soapFault == 1) { soapFaultHandling( ); } else { nOutParmCount = 0; while (((StringUtil.StrCmp(GXSoapXMLReader.Name, sTagName) != 0) || (GXSoapXMLReader.NodeType == 1)) && (GXSoapError > 0)) { readOk = 0; if (StringUtil.StrCmp2(GXSoapXMLReader.LocalName, "Resultado") && (GXSoapXMLReader.NodeType != 2) && (StringUtil.StrCmp(GXSoapXMLReader.NamespaceURI, "GeneXus.Programs.wsrest_services") == 0)) { returnexecute = GXSoapXMLReader.Value; if (GXSoapError > 0) { readOk = 1; } GXSoapError = GXSoapXMLReader.Read(); } nOutParmCount = (short)(nOutParmCount + 1); if (readOk == 0) { context.sSOAPErrMsg = context.sSOAPErrMsg + "Error reading " + sTagName + StringUtil.NewLine( ); context.sSOAPErrMsg = context.sSOAPErrMsg + "Message: " + GXSoapXMLReader.ReadRawXML(); GXSoapError = (short)(nOutParmCount * -1); } } } } GXSoapXMLReader.Close(); if (currSoapErr == 0) { if (GXSoapError < 0) { currSoapErr = (short)(GXSoapError * -1); currSoapErrmsg = context.sSOAPErrMsg; } else { if (GXSoapXMLReader.ErrCode > 0) { currSoapErr = (short)(GXSoapXMLReader.ErrCode * -1); currSoapErrmsg = GXSoapXMLReader.ErrDescription; } else { if (GXSoapError == 0) { currSoapErr = (short)(-20001); currSoapErrmsg = "Malformed SOAP message."; } else { currSoapErr = 0; currSoapErrmsg = "No error."; } } } } if (currSoapErr != 0) { oLocation = SoapParm.getlocation(context, "wsrest_services"); if ((oLocation.CancelOnError == 0) || (oLocation.CancelOnError == 1)) { throw new Exception(currSoapErrmsg + "(" + StringUtil.LTrim(StringUtil.NToC((decimal)(currSoapErr), 6, 0, ".", "")) + ")"); } } context.nSOAPErr = currSoapErr; context.sSOAPErrMsg = currSoapErrmsg; return(returnexecute); }