Error consuming webservice, content type “application/xop+xml” does not match expected type “text/xml”

前端 未结 7 1846
我在风中等你
我在风中等你 2020-11-30 03:16

I\'m having a weird issue when consuming a webservice for a product that my company has bought. The product is called Campaign Commander and it\'s made by a company called

7条回答
  •  执笔经年
    2020-11-30 03:28

    I'm not sure if this is any appropriate place to put this, but I was having a hard time getting my Windows Service to connect to a WSDL (using an auto generated web reference).

    I was getting the same error as the original poster here. Since I'm not using WCF the app.config would not work for me and caused my service not to start. I did find a post on MSDN where AjayChigurupati states to change

    public partial class WsdlService : System.Web.Services.Protocols.SoapHttpClientProtocol {...}

    To

    public partial class WsdlService : Microsoft.Web.Services3.WebServicesClientProtocol {...}

    (Make sure to add the Microsoft.Web.Services3 reference to your project)

    Now we have access to the boolean property RequireMtom and you can surround your calling function like so:

        public DownloadResponse downloadDataFile([System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] DownloadRequest Request) {
            RequireMtom = true; // ADDED
            object[] results = this.Invoke("downloadDataFile", new object[] {
                        Request});
            RequireMtom = false; // ADDED
            return ((DownloadResponse)(results[0]));
        }
    

    Hopefully this helps someone else with the same problem in the future.

提交回复
热议问题