Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7974271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:19:35+00:00 2026-06-04T08:19:35+00:00

I created a web service http://service.mydomain.com/MobileService.asmx I created a Windows mobile application I added

  • 0
  1. I created a web service
    “http://service.mydomain.com/MobileService.asmx”
  2. I created a Windows mobile application
  3. I added a reference to this web service
  4. I started coding and finished the WP7 application and deployed the we service
  5. Then I used IIS 7.5 to disable anonymous authentication and used basic authentication to secure my web service.
  6. After using basic authentication I added the new reference to my service and VS 2010 ask about authentication, I used my Username and Password
  7. Then when I tried to use the new services I had an Exception.

    Error on Reference.cs:

    public System.IAsyncResult BeginGetArticle(MyWP7App.MyService.GetArticleRequest request, System.AsyncCallback callback, object asyncState) {
    object[] _args = new object[1];
    _args[0] = request;
    System.IAsyncResult _result = base.BeginInvoke(“GetArticle”, _args, callback, asyncState);
    return _result;
    }

CommunicationException: {“The remote server returned an error: NotFound.”}

StatusDescription: Unauthorized

at System.Net.Browser.ClientHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
   at System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClass2.<EndGetResponse>b__1(Object sendState)
   at System.Net.Browser.AsyncHelper.<>c__DisplayClass4.<BeginOnUI>b__0(Object sendState)
   at System.Reflection.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi, Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark)
   at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, StackCrawlMark& stackMark)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at System.Delegate.DynamicInvokeOne(Object[] args)
   at System.MulticastDelegate.DynamicInvokeImpl(Object[] args)
   at System.Delegate.DynamicInvoke(Object[] args)
   at System.Windows.Threading.Dispatcher.<>c__DisplayClass4.<FastInvoke>b__3()
   at System.Reflection.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi, Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark)
   at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, StackCrawlMark& stackMark)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at System.Delegate.DynamicInvokeOne(Object[] args)
   at System.MulticastDelegate.DynamicInvokeImpl(Object[] args)
   at System.Delegate.DynamicInvoke(Object[] args)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.Dispatch(DispatcherPriority priority)
   at System.Windows.Threading.Dispatcher.OnInvoke(Object context)
   at System.Windows.Hosting.CallbackCookie.Invoke(Object[] args)
   at System.Windows.Hosting.DelegateWrapper.InternalInvoke(Object[] args)
   at System.Windows.RuntimeHost.ManagedHost.InvokeDelegate(IntPtr pHandle, Int32 nParamCount, ScriptParam[] pParams, ScriptParam& pResult)

This how I’m trying to connect to my web service:

in ParsingHelper.cs:

using System;
using System.Text.RegularExpressions;
using System.Xml.Serialization;
using System.Collections.ObjectModel;
    namespace MyWP7App
    {
    [XmlRoot("root")]
    public class Categories
    {
        [XmlArray("Categories")]
        [XmlArrayItem("Category")]
        public ObservableCollection<Category> Collection { get; set; }
    }
    }
    public class Category
    {
        [XmlAttribute("ID")]
        public int ID { get; set; }
        [XmlAttribute("SubCategories")]
        public int SubCategoriesCount { get; set; }
        [XmlElement("Name")]
        public string Name { get; set; }
        [XmlArray("SubCategories")]
        [XmlArrayItem("SubCategory")]
        public ObservableCollection<SubCategory> Collection { get; set; }
    }

in MyPage.xaml.cs:

using System;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Xml.Serialization;
using Microsoft.Phone.Controls;
using System.Xml.Linq;

    namespace MyWP7App
    {
        public partial class CategoriesPage : PhoneApplicationPage
        {
        private ObservableCollection<Category> itemsSource;
        public ObservableCollection<Category> ItemsSource
        {
            get
            {
                return this.itemsSource;
            }
            set
            {
                this.itemsSource = value;
            }
        }

        private static MyService.MobileServiceSoapClient Service = null;


        public PanoramaMainPage()
        {
            InitializeComponent();
            if (null == ItemsSource)
                GetCategories();
            else
                imtListBox.ItemsSource = this.ItemsSource;
        }

        private void GetCategories()
        {
            Service = new MyService.MobileServiceSoapClient();

            // I tried to do the following when the service is secure, but I had the same error:
            // Service.ClientCredentials.UserName.UserName = "Username";
            // Service.ClientCredentials.UserName.Password = "Password";

            Service.GetCategoriesCompleted += new EventHandler<MyService.GetCategoriesCompletedEventArgs>(Service_GetCategoriesCompleted);
            Service.GetCategoriesAsync();
        }
        void Service_GetCategoriesCompleted(object sender, MyService.GetCategoriesCompletedEventArgs e)
        {
            try
            {
                if (e.Result == null || e.Error != null)
                {
                    MessageBox.Show("There was an error downloading the XML-file!");
                }
                if (!e.Cancelled)
                {
                    XmlSerializer serializer = new XmlSerializer(typeof(Categories));
                    XDocument document = XDocument.Parse("<root>" + e.Result.ToString() + "</root>");
                    Categories arts = new Categories();
                    arts = (Categories)serializer.Deserialize(document.CreateReader());
                    this.ItemsSourceListBox = arts.Collection;
                    imtListBox.ItemsSource = this.Items1Source;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            Service.Abort();
        }
    }

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T08:19:36+00:00Added an answer on June 4, 2026 at 8:19 am

    have a look at this post
    http://msdn.microsoft.com/en-us/library/ff637320(VS.96).aspx

    This post details how to pass username / password. Here’s a snippet from the page

    using (OperationContextScope contextScope = new OperationContextScope(svc.InnerChannel))
    {
        byte[] bc = System.Text.Encoding.UTF8.GetBytes(@"username" + ":" + "password"); // the string passed after basic:
        HttpRequestMessageProperty httpProps = new HttpRequestMessageProperty();
        httpProps.Headers[HttpRequestHeader.Authorization] = "Basic " + Convert.ToBase64String(bc);
        OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpProps;
        // call the service.
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have followed this tutorial http://netbeans.org/kb/docs/websvc/gs-axis.html and successfully created the web service. When i
I have created a new wcf4 web application and added a new wcf service.
My office mate created a web service application to be consumed by a .Net
I have created an Axis web service as a Java 6 application running on
I have created a C# web service using visual studio to stop the windows
I'm getting this error when testing my web service created by exlipse using Axis
I have a web address www.abc.com/check ... I have created a web service on
I have created a REST web service using WCF and use HTTP Post Method.
I have Axis2 created web service client. This service uses both SSL and WS-Security
So I have an asp.net 2.0 web application and I created a web service

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.