The header property/field TestServicePort.MYBaseTypes is missing or not public

I am getting the following error:



The header property/field TestServicePort .MYBaseTypes is missing or not public.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[Exception: The header property/field TestServicePort.MYBaseTypes is missing or not public.]
   System.Web.Services.Protocols.SoapReflector.ReflectMethod(LogicalMethodInfo methodInfo, Boolean client, XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, String defaultNs) +4263

[InvalidOperationException: Method TestServicePort.MYBaseTypes can not be reflected.]
   System.Web.Services.Protocols.SoapReflector.ReflectMethod(LogicalMethodInfo methodInfo, Boolean client, XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, String defaultNs) +6630
   System.Web.Services.Description.SoapProtocolReflector.ReflectMethod() +134
   System.Web.Services.Description.ProtocolReflector.ReflectBinding(ReflectedBinding reflectedBinding) +2512
   System.Web.Services.Description.ProtocolReflector.Reflect() +626
   System.Web.Services.Description.ServiceDescriptionReflector.ReflectInternal(ProtocolReflector[] reflectors) +560
   System.Web.Services.Description.ServiceDescriptionReflector.Reflect(Type type, String url) +117
   System.Web.Services.Protocols.DocumentationServerType..ctor(Type type, String uri) +159
   System.Web.Services.Protocols.DocumentationServerProtocol.Initialize() +335
   System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing) +99

[InvalidOperationException: Unable to handle request.]
   System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing) +258
   System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) +93

[InvalidOperationException: Failed to handle request.]
   System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) +240
   System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath) +106
   System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +328
   System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +139
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +146







And the code:

#region WSCF
//------------------------------------------------------------------------------
// <autogenerated code>
//     This code was generated by a tool.
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </autogenerated code>
//------------------------------------------------------------------------------
// File time 04-10-07 01:19
//
// This source code was auto-generated by WsContractFirst, Version=0.7.6319.1
#endregion


namespace TestService
{
    using System.Diagnostics;
    using System.Web.Services;
    using System.ComponentModel;
    using System.Web.Services.Protocols;
    using System;
    using System.Xml.Serialization;
    using System.Web;
   
   
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.42")]
    [System.Web.Services.WebServiceAttribute(Namespace="https://....")]
    [System.Web.Services.WebServiceBindingAttribute(Name="TestService", Namespace="https://....")]
    [System.Xml.Serialization.XmlIncludeAttribute(typeof(BaseMessageType))]
    [System.ComponentModel.TypeConverterAttribute(typeof(System.ComponentModel.ExpandableObjectConverter))]
    public partial class TestServicePort : System.Web.Services.WebService, ITestServicePort
    {
       
        public object myBaseTypes;
       
        public TestServicePort()
        {
        }
       
        public TestServicePort(object myBaseTypes)
        {
            this.myBaseTypes = myBaseTypes;
        }
       
        [System.Xml.Serialization.XmlElementAttribute(ElementName="MYBaseTypes")]
        public object MYBaseTypesObjects
        {
            get
            {
                return this.myBaseTypes;
            }
            set
            {
                if ((this.myBaseTypes != value))
                {
                    this.myBaseTypes = value;
                }
            }
        }
       
        /// <remarks/>
        [System.Web.Services.Protocols.SoapHeaderAttribute("MYBaseTypes")]
        [System.Web.Services.WebMethodAttribute(MessageName="MYBaseTypes1")]
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("https://....", OneWay=true, Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare, Binding="TestService")]
        public virtual void MYBaseTypes([System.Xml.Serialization.XmlElementAttribute("MYBaseTypes", Namespace="https://....")] object myBaseTypes2)
        {
            throw new System.NotImplementedException();
        }
    }
}



Now I made : myBaseTypes public which I thought it would actually fix the issue.

Anyone have any ideas relating to this...
directxBOBAsked:
Who is Participating?
 
surajgupthaCommented:
Start afresh, Use the same wizard to generate a web service and make sure you use string/ int only
0
 
surajgupthaCommented:
Web services require that all the properties are strongly typed. If the property is declared as an object there is no way it would know to to serialize the object or deserialize it.

Please use a specific type instead of using a generic object
0
 
directxBOBAuthor Commented:
Just spotted that alot of people are switching to an arrayList, will give it a shot.
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
surajgupthaCommented:
An array list isnt strongly types either. My guess is that it wouldnt work. Please try anyways
0
 
directxBOBAuthor Commented:
Any idea what I could use?
0
 
surajgupthaCommented:
Did ArrayList not work??
0
 
directxBOBAuthor Commented:
Nope, nor did string or int... So I'm just wondering if there was anything else. Perhaps Dataset or something else.
0
 
surajgupthaCommented:
string and int SHOULD work. What error are you getting when you use int or string?
0
 
directxBOBAuthor Commented:
[Exception: The header property/field TestServicePort.MYBaseTypes is missing or not public.]
   System.Web.Services.Protocols.SoapReflector.ReflectMethod(LogicalMethodInfo methodInfo, Boolean client, XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, String defaultNs) +4263

[InvalidOperationException: Method TestServicePort.MYBaseTypes can not be reflected.]
   System.Web.Services.Protocols.SoapReflector.ReflectMethod(LogicalMethodInfo methodInfo, Boolean client, XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, String defaultNs) +6630
   System.Web.Services.Description.SoapProtocolReflector.ReflectMethod() +134
   System.Web.Services.Description.ProtocolReflector.ReflectBinding(ReflectedBinding reflectedBinding) +2512
   System.Web.Services.Description.ProtocolReflector.Reflect() +626
   System.Web.Services.Description.ServiceDescriptionReflector.ReflectInternal(ProtocolReflector[] reflectors) +560
   System.Web.Services.Description.ServiceDescriptionReflector.Reflect(Type type, String url) +117
   System.Web.Services.Protocols.DocumentationServerType..ctor(Type type, String uri) +159
   System.Web.Services.Protocols.DocumentationServerProtocol.Initialize() +335
   System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing) +99

[InvalidOperationException: Unable to handle request.]
   System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing) +258
   System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) +93

[InvalidOperationException: Failed to handle request.]
   System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) +240
   System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath) +106
   System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +328
   System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +139
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +146

0
 
surajgupthaCommented:
Can you paste the code you are using?
0
 
directxBOBAuthor Commented:
#region WSCF
//------------------------------------------------------------------------------
// <autogenerated code>
//     This code was generated by a tool.
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </autogenerated code>
//------------------------------------------------------------------------------
// File time 04-10-07 01:19
//
// This source code was auto-generated by WsContractFirst, Version=0.7.6319.1
#endregion


namespace TestService
{
    using System.Diagnostics;
    using System.Web.Services;
    using System.ComponentModel;
    using System.Web.Services.Protocols;
    using System;
    using System.Xml.Serialization;
    using System.Web;
   
   
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.42")]
    [System.Web.Services.WebServiceAttribute(Namespace="https://....")]
    [System.Web.Services.WebServiceBindingAttribute(Name="TestService", Namespace="https://....")]
    [System.Xml.Serialization.XmlIncludeAttribute(typeof(BaseMessageType))]
    [System.ComponentModel.TypeConverterAttribute(typeof(System.ComponentModel.ExpandableObjectConverter))]
    public partial class TestServicePort : System.Web.Services.WebService, ITestServicePort
    {
       
        public string myBaseTypes = "";
       
        public TestServicePort()
        {
        }
       
        public TestServicePort(string myBaseTypes)
        {
            this.myBaseTypes = myBaseTypes;
        }
       
        [System.Xml.Serialization.XmlElementAttribute(ElementName="MYBaseTypes")]
        public string MYBaseTypesObjects
        {
            get
            {
                return this.myBaseTypes;
            }
            set
            {
                if ((this.myBaseTypes != value.ToString()))
                {
                    this.myBaseTypes = value.ToString();
                }
            }
        }
       
        /// <remarks/>
        [System.Web.Services.Protocols.SoapHeaderAttribute("MYBaseTypes")]
        [System.Web.Services.WebMethodAttribute(MessageName="MYBaseTypes1")]
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("https://....", OneWay=true, Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare, Binding="TestService")]
        public virtual void MYBaseTypes([System.Xml.Serialization.XmlElementAttribute("MYBaseTypes", Namespace="https://....")] object myBaseTypes2)
        {
            throw new System.NotImplementedException();
        }
    }
}
0
 
surajgupthaCommented:
public virtual void MYBaseTypes([System.Xml.Serialization.XmlElementAttribute("MYBaseTypes", Namespace="https://....")] object myBaseTypes2)

 object myBaseTypes2 ????
0
 
directxBOBAuthor Commented:
sorry that was a typo it's actually a string as well as in the interface class.
0
 
surajgupthaCommented:
Please make sure you dont use any datatype of type object any where in your web service.
0
 
directxBOBAuthor Commented:
Well it's directly related to this one line:

[System.Web.Services.Protocols.SoapHeaderAttribute("M50BaseTypes")]

Perhaps this is the one that does not like the type... I'll keep digging
0
 
surajgupthaCommented:
What are you trying to implement in the soap header??

try removing all the decorators to the webmethod and see if the web service works in the first place. If it does we can then try to add each decorator and see what causes the problem
0
 
directxBOBAuthor Commented:
Sorry never touched SOAP before and all this code is generated, what do you mean by Decorator?
0
 
surajgupthaCommented:
System.Web.Services.Protocols.SoapHeaderAttribute("MYBaseTypes")]
        [System.Web.Services.WebMethodAttribute(MessageName="MYBaseTypes1")]
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("https://....", OneWay=true, Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare, Binding="TestService")]

These are the decorators

>> All this code is generated
Generated by?
0
 
directxBOBAuthor Commented:
The wizard is :

This source code was auto-generated by WsContractFirst, Version=0.7.6319.1

I'll try and start again so.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.