Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Asmx Web Service Request Content Type Error

Posted on 2014-04-05
6
Medium Priority
?
1,080 Views
Last Modified: 2014-05-22
I created an Asmx Web Service for online invoice solution. My web service is reciever and getting an error when a company tries to send me an invoice while I trace the web service. I created my web service by their wsdl with Visual Studio's Wsdl.exe

Here is my error:

 Server found request content type to be 'multipart/related; type="application/xop+xml"; boundary="uuid:c40af87f-d64a-4d1c-a430-09328900731e"; start="<root.message@cxf.apache.org>"; start-info="application/soap+xml"; action="sendDocument"', but expected 'application/soap+xml'.

Open in new window


Here is my asmx.cs file:

using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Text;
using System.Web;
using System.Web.Configuration;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Serialization;
//using EFaturaMaker.EFaturaService;

namespace PostboxWS
{
    

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://gib.gov.tr/vedop3/eFatura")]
    public partial class getAppRespRequestType
    {

        private string instanceIdentifierField;

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public string instanceIdentifier
        {
            get
            {
                return this.instanceIdentifierField;
            }
            set
            {
                this.instanceIdentifierField = value;
            }
        }
    }

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://gib.gov.tr/vedop3/eFatura")]
    public partial class documentReturnType
    {

        private string msgField;

        private string hashField;

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public string msg
        {
            get
            {
                return this.msgField;
            }
            set
            {
                this.msgField = value;
            }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public string hash
        {
            get
            {
                return this.hashField;
            }
            set
            {
                this.hashField = value;
            }
        }
    }

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://www.w3.org/2005/05/xmlmime")]
    public partial class base64Binary
    {

        private string contentTypeField;

        private byte[] valueField;

        /// <remarks/>
        [System.Xml.Serialization.XmlAttributeAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]
        public string contentType
        {
            get
            {
                return this.contentTypeField;
            }
            set
            {
                this.contentTypeField = value;
            }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlTextAttribute(DataType = "base64Binary")]
        public byte[] Value
        {
            get
            {
                return this.valueField;
            }
            set
            {
                this.valueField = value;
            }
        }
    }

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://gib.gov.tr/vedop3/eFatura")]
    public partial class documentType
    {

        private string fileNameField;

        private base64Binary binaryDataField;

        private string hashField;

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public string fileName
        {
            get
            {
                return this.fileNameField;
            }
            set
            {
                this.fileNameField = value;
            }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public base64Binary binaryData
        {
            get
            {
                return this.binaryDataField;
            }
            set
            {
                this.binaryDataField = value;
            }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public string hash
        {
            get
            {
                return this.hashField;
            }
            set
            {
                this.hashField = value;
            }
        }
    }

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://gib.gov.tr/vedop3/eFatura")]
    public partial class getAppRespResponseType
    {

        private string applicationResponseField;

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public string applicationResponse
        {
            get
            {
                return this.applicationResponseField;
            }
            set
            {
                this.applicationResponseField = value;
            }
        }
    }

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
    [System.Web.Services.WebServiceBindingAttribute(Name = "EFaturaSoapBinding", Namespace = "http://gib.gov.tr/vedop3/eFatura")]
    public interface IEFaturaSoapBinding
    {

        /// <remarks/>
        [System.Web.Services.WebMethodAttribute()]
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("getApplicationResponse", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Bare)]
        [return: System.Xml.Serialization.XmlElementAttribute("getAppRespResponse", Namespace = "http://gib.gov.tr/vedop3/eFatura")]
        getAppRespResponseType getApplicationResponse([System.Xml.Serialization.XmlElementAttribute(Namespace = "http://gib.gov.tr/vedop3/eFatura")] getAppRespRequestType getAppRespRequest);

        /// <remarks/>
        [System.Web.Services.WebMethodAttribute()]
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("sendDocument", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Bare)]
        [return: System.Xml.Serialization.XmlElementAttribute("documentResponse", Namespace = "http://gib.gov.tr/vedop3/eFatura")]
        documentReturnType sendDocument([System.Xml.Serialization.XmlElementAttribute(Namespace = "http://gib.gov.tr/vedop3/eFatura")] documentType documentRequest);
    }
    /// <summary>
    /// Summary description for Postbox
    /// </summary>
    //[WebService(Namespace = "http://gib.gov.tr/vedop3/eFatura")]
    //[SoapDocumentService(ParameterStyle = SoapParameterStyle.Wrapped)]
    //[WebServiceBinding(Namespace = "http://gib.gov.tr/vedop3/eFatura")]
    //[System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    [WebService(Namespace = "http://gib.gov.tr/vedop3/eFatura")]
    public class Postbox : IEFaturaSoapBinding
    {
        

        [WebMethod]
        public documentReturnType sendDocument(documentType documentRequest)
        {
            var dcRtrn = new documentReturnType();
            try
            {
                string sSource;
                string sLog;
                string sEvent;

                sSource = "sendDocument";
                sLog = "Application";
                sEvent = "sendDocument TEST EFATURA";

                if (!EventLog.SourceExists(sSource))
                    EventLog.CreateEventSource(sSource, sLog);

                EventLog.WriteEntry(sSource, sEvent);
                EventLog.WriteEntry(sSource, sEvent,
                    EventLogEntryType.Warning, 234);

                dcRtrn.hash = documentRequest.hash;
                dcRtrn.msg = "BASARIYLA ISLENDI";
                return dcRtrn;

                if (documentRequest.binaryData != null)
                {
                    string WCzipPath = WebConfigurationManager.AppSettings["RecieveBatPath"];
                    var rtrn = EFaturaMaker.ParseEnvelope.saveZipFile(documentRequest.binaryData.Value, documentRequest.fileName, WCzipPath);
                    if (rtrn != null)
                    {
                        dcRtrn.hash = documentRequest.hash;
                        dcRtrn.msg = rtrn;
                        return dcRtrn;
                    }
                }
            }
            catch (Exception ex)
            {
                dcRtrn.msg = ex.Message;
                return dcRtrn;
            }
            return dcRtrn;
        }

        [WebMethod]
        public getAppRespResponseType getApplicationResponse(getAppRespRequestType getAppRespRequest)
        {
            string sSource;
            string sLog;
            string sEvent;

            sSource = "getApplicationResponse";
            sLog = "Application";
            sEvent = "getApplicationResponse TEST EFATURA";

            if (!EventLog.SourceExists(sSource))
                EventLog.CreateEventSource(sSource, sLog);

            EventLog.WriteEntry(sSource, sEvent);
            EventLog.WriteEntry(sSource, sEvent,
                EventLogEntryType.Warning, 234);


            var rtn = new getAppRespResponseType();
            rtn.applicationResponse = @"test1234567890";
            return rtn;
        }

    }
}

Open in new window

0
Comment
Question by:Rudewind
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 25

Expert Comment

by:apeter
ID: 39981839
If you are trying to send/receive more than 4 MB , change your settings are given and try

http://msdn.microsoft.com/en-us/library/aa528822.aspx
0
 

Author Comment

by:Rudewind
ID: 39982807
I tried it, didn't help, same problem... But web.config doesn't accept the code below:

<httpRuntime maxMessageLength="409600"
    executionTimeoutInSeconds="300"/>

Open in new window

0
 
LVL 25

Expert Comment

by:apeter
ID: 39985888
Did you place it under "System.web" like given below ?

<configuration>
  <system.web>
  <httpRuntime maxMessageLength="409600"
    executionTimeoutInSeconds="300"/>
  </system.web>
</configuration>
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Accepted Solution

by:
Rudewind earned 0 total points
ID: 39988118
I solved it by leaving asmx and using WCF. Thank you anyway.
0
 

Author Closing Comment

by:Rudewind
ID: 39997132
Updated to WCF. That solved everything.
0
 

Expert Comment

by:dilarakaranfil
ID: 40083498
how did you solve the solution. can you share your code with us ? wcf service code and configuration ?
0

Featured Post

What is a Denial of Service (DoS)?

A DoS is a malicious attempt to prevent the normal operation of a computer system. You may frequently see the terms 'DDoS' (Distributed Denial of Service) and 'DoS' used interchangeably, but there are some subtle differences.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question