.net - How To Remove extra Result Tag from my Soap Response C# -
i know questions has been asked before cloud not find answer anywhere.
the thing have below code on asmx file :
namespace irancellsmsserver { [soapdocumentservice(routingstyle = soapserviceroutingstyle.requestelement)] [webservice(namespace = "http://www.csapi.org/schema/parlayx/data/sync/v1_0/local")] [webservicebinding(conformsto = wsiprofiles.basicprofile1_1)] [system.componentmodel.toolboxitem(false)] public class soapserver : system.web.services.webservice { [webmethod] public syncorderrelationresponse syncorderrelation( sync.userid userid, string spid, string productid, string serviceid, string servicelist, int updatetype, string updatetime, string updatedesc, string effectivetime, string expirytime, item[] extensioninfo ) { syncorderrelationresponse = new syncorderrelationresponse(); a.result = 0; a.resultdescription = "ok"; return a; } } }
and result :
<?xml version="1.0" encoding="utf-8"?> <soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <soap:body> <syncorderrelationresponse xmlns="http://www.csapi.org/schema/parlayx/data/sync/v1_0/local"> <syncorderrelationresult> //dont want <result>0</result> <resultdescription>ok</resultdescription> </syncorderrelationresult> //dont want </syncorderrelationresponse> </soap:body> </soap:envelope
the problem dont want <syncorderrelationresult>
tag .net created automatically. want remove. have tried [soapdocumentmethod(parameterstyle=soapparameterstyle.bare)] no luck tels me should have 1 parameter. there way this?
expected result :
<?xml version="1.0" encoding="utf-8"?> <soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <soap:body> <syncorderrelationresponse xmlns="http://www.csapi.org/schema/parlayx/data/sync/v1_0/local"> <result>0</result> <resultdescription>ok</resultdescription> </syncorderrelationresponse> </soap:body> </soap:envelope
here code of syncorderrelationresponse :
namespace irancellsmsserver.sync { using system; using system.web.services; using system.diagnostics; using system.web.services.protocols; using system.xml.serialization; using system.componentmodel; /// <remarks/> [system.codedom.compiler.generatedcodeattribute("system.web.services", "4.6.1055.0")] [system.diagnostics.debuggerstepthroughattribute()] [system.componentmodel.designercategoryattribute("code")] [system.web.services.webservicebindingattribute(name="datasyncbinding", namespace="http://www.csapi.org/wsdl/parlayx/data/sync/v1_0/service")] public partial class datasyncservice : system.web.services.protocols.soaphttpclientprotocol { private bool usedefaultcredentialssetexplicitly; /// <remarks/> public datasyncservice() { this.url = global::irancellsmsserver.properties.settings.default.irancellsmsserver_sync_datasyncservice; if ((this.islocalfilesystemwebservice(this.url) == true)) { this.usedefaultcredentials = true; this.usedefaultcredentialssetexplicitly = false; } else { this.usedefaultcredentialssetexplicitly = true; } } public new string url { { return base.url; } set { if ((((this.islocalfilesystemwebservice(base.url) == true) && (this.usedefaultcredentialssetexplicitly == false)) && (this.islocalfilesystemwebservice(value) == false))) { base.usedefaultcredentials = false; } base.url = value; } } public new bool usedefaultcredentials { { return base.usedefaultcredentials; } set { base.usedefaultcredentials = value; this.usedefaultcredentialssetexplicitly = true; } } /// <remarks/> [system.web.services.protocols.soapdocumentmethodattribute("", use=system.web.services.description.soapbindinguse.literal, parameterstyle=system.web.services.protocols.soapparameterstyle.bare)] [return: system.xml.serialization.xmlelementattribute("syncorderrelationresponse", namespace="http://www.csapi.org/schema/parlayx/data/sync/v1_0/local")] public syncorderrelationresponse syncorderrelation([system.xml.serialization.xmlelementattribute("syncorderrelation", namespace="http://www.csapi.org/schema/parlayx/data/sync/v1_0/local")] syncorderrelation syncorderrelation1) { object[] results = this.invoke("syncorderrelation", new object[] { syncorderrelation1}); return ((syncorderrelationresponse)(results[0])); } /// <remarks/> public void syncorderrelationasync(syncorderrelation syncorderrelation1, object userstate) { if ((this.syncorderrelationoperationcompleted == null)) { this.syncorderrelationoperationcompleted = new system.threading.sendorpostcallback(this.onsyncorderrelationoperationcompleted); } this.invokeasync("syncorderrelation", new object[] { syncorderrelation1}, this.syncorderrelationoperationcompleted, userstate); } } /// <remarks/> [system.codedom.compiler.generatedcodeattribute("system.xml", "4.6.1055.0")] [system.serializableattribute()] [system.diagnostics.debuggerstepthroughattribute()] [system.componentmodel.designercategoryattribute("code")] [system.xml.serialization.xmltypeattribute(namespace="http://www.csapi.org/schema/parlayx/data/sync/v1_0/local")] public partial class syncorderrelationresponse { private int resultfield; private string resultdescriptionfield; //private item[] extensioninfofield; /// <remarks/> public int result { { return this.resultfield; } set { this.resultfield = value; } } /// <remarks/> public string resultdescription { { return this.resultdescriptionfield; } set { this.resultdescriptionfield = value; } } /// <remarks/> //[system.xml.serialization.xmlarrayitemattribute("item", form=system.xml.schema.xmlschemaform.unqualified, isnullable=false)] //public item[] extensioninfo { // { // return this.extensioninfofield; // } // set { // this.extensioninfofield = value; // } //} } /// <remarks/> public syncorderrelationresponse result { { this.raiseexceptionifnecessary(); return ((syncorderrelationresponse)(this.results[0])); } } } } }
thanks.
add on top of method
[webmethod] [return: xmlelement("syncorderrelationresponse")] [soapdocumentmethod(parameterstyle = soapparameterstyle.bare)]
Comments
Post a Comment