Microsoft Developer Network > Página Inicial dos Fóruns > Visual C# General > webservices3 ... can't find addNumbers and it's cause a missing assembly error
Fazer uma PerguntaFazer uma Pergunta
 

Respondidowebservices3 ... can't find addNumbers and it's cause a missing assembly error

  • quarta-feira, 4 de novembro de 2009 18:10angus454 Medalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     

    Using the C# example from http://msdn.microsoft.com/en-us/library/aa528788.aspx I have built the code below. The problem is it reports a missing assembly or reference error, highlighting addNumbers. I have references for Microsoft.Web.Services3, .Security, .Security.Token as in the example and have also added a reference to system.Web.Services as in the example. If anyone knows what assembly reference I need to add to get addNumbers to be recognized I'd really appreciate it! Here's the code I wrote:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using VIN_decoder_web_service.com.vinlink.ws3;
    using Microsoft.Web.Services3;
    using Microsoft.Web.Services3.Security;
    using Microsoft.Web.Services3.Security.Tokens;
    using System.Web.Services.Protocols;
    using Microsoft.Web.Services3.Security.X509;

     

    namespace VIN_decoder_web_service
    {
        public partial class frmForm1 : Form
        {
            public frmForm1()
            {
                InitializeComponent();
            }

            private void btnDecode_Click(object sender, EventArgs e)
            {
                {
                    UsernameToken userToken;
                    userToken = new UsernameToken("username", "password");
                    // Create a new instance of the proxy class.               

                    AddNumbers serviceProxy = new AddNumbers(); ********************* this is where the error is ***************
                    // Get the SoapContext associated with the SOAP request.
                    SoapContext requestContext = serviceProxy.RequestSoapContext;
                    // Set the period of time in which the SOAP request expires to one minute.
                    requestContext.Security.Timestamp.TtlInSeconds = 60;
                    // Add the UsernameToken token to the SOAP message.
                    requestContext.Security.Tokens.Add(userToken);
                    // Sign the SOAP message using the UsernameToken.
                    requestContext.Security.Elements.Add(new MessageSignature(userToken));
                    // decode the vin
                    VIN_decoder_web_service.com.vinlink.ws3.Decoder dec = new VIN_decoder_web_service.com.vinlink.ws3.Decoder();
                    //specify the report type
                    VIN_decoder_web_service.com.vinlink.ws3.Report[] rep = dec.decode("2G4WS52J611297400", ReportTypes.OPTION);
                    //dumpo report to messagebox
                    string VINreport = Convert.ToString(dec);
                    MessageBox.Show(VINreport);
                   

                }
            }
      


    slowly getting my mind around .NET...

Respostas

  • quinta-feira, 5 de novembro de 2009 11:32Ji.ZhouMSFT, ModeradorMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     Respondido

    Hello,

    Thanks for posting! :-)

    It reports missing a reference because AddNumbers is not recognized as a class. It is not a type in any of the assembly you referenced(Microsoft.Web.Services3, .Security, .Security.Token ).

    I looked into the documentation you mentioned, http://msdn.microsoft.com/en-us/library/aa528788.aspx

    It does not mention the AddNumbers either. Where did you get the codes?
    AddNumbers serviceProxy = new AddNumbers();


    Have a nice day!

     

     

    Ji Zhou

    MSDN Subscriber Support in Forum

    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

Todas as Respostas

  • quinta-feira, 5 de novembro de 2009 11:32Ji.ZhouMSFT, ModeradorMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     Respondido

    Hello,

    Thanks for posting! :-)

    It reports missing a reference because AddNumbers is not recognized as a class. It is not a type in any of the assembly you referenced(Microsoft.Web.Services3, .Security, .Security.Token ).

    I looked into the documentation you mentioned, http://msdn.microsoft.com/en-us/library/aa528788.aspx

    It does not mention the AddNumbers either. Where did you get the codes?
    AddNumbers serviceProxy = new AddNumbers();


    Have a nice day!

     

     

    Ji Zhou

    MSDN Subscriber Support in Forum

    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • quinta-feira, 5 de novembro de 2009 13:55angus454 Medalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     
    thanks for writing back... I had 20 MSDN windows opened yesterday trying to figure this out and it looks like I have copied the wrong reference URL in my original post. I can go back and try to dig it up. Ultimately what I'm trying to do is get past the response from the seb service that is complaining that the expected security headers are not found. If I can refind the link I'll respond... thanks again.
    slowly getting my mind around .NET...