Click here to Skip to main content
15,878,543 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey Guru's,

Okie i will rephrase the question,i was trying to consume the webservices in C#,can you please give me some lead.


C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Services.Description;
using System.IO;
using System.Xml;
namespace wsdlreader
{
    class Program
    {
        static void Main(string[] args)
        {
            ServiceDescription wsdl = ServiceDescription.Read(@"C:\Inetpub\wwwroot\WebService1\t.wsdl");
            foreach (PortType pt in wsdl.PortTypes)
            {
                Console.WriteLine("PortType {0}", pt.Name);
                foreach (Operation op in pt.Operations)
                {
                    Console.WriteLine("\tOperation: {0}", op.Name);
                    foreach (OperationMessage msg in op.Messages)
                    {
                        if (msg is OperationInput)
                            Console.WriteLine("\t\tInput Message: {0}", msg.Message);
                        else if (msg is OperationOutput)
                            Console.WriteLine("\t\tOutput Message: {0}", msg.Message);
                        else
                            Console.WriteLine("\t\tFault Message: {0}", msg.Message);
                    }
                }
            }

        }


    }
}
Posted
Updated 1-Mar-11 13:50pm
v3
Comments
luisnike19 1-Mar-11 20:24pm    
What do you need? what's the problem with this code?
thatraja 1-Mar-11 20:25pm    
any error?

 
Share this answer
 
Comments
shan1395 1-Mar-11 21:43pm    
first of all thanks for all your help.There is nothing wrong with that code,if you seen the code above,am not using referenced to read the wsdl file.

I am trying to consume my webservice thru add reference.

What i did here is i add the webreference and call my webservice (wsdl) file.and trying to invoke those webservice in my console application to retrieve the value of the field.

And i have one more question ,how can i create the porxy webservice,bcoz when i call my webservice it return 404 error.
luisnike19 2-Mar-11 0:36am    
You could have a problem with the IIS. In case you have IIS 6.0 check this link http://support.microsoft.com/kb/315122
MSDN might be the best link for you[^].
 
Share this answer
 
Comments
shan1395 2-Mar-11 0:57am    
Thanks Abhinav,yep that helped me.

Moved from stage one to stage two.

I gotta another problem when i call the method
shan1395 2-Mar-11 1:01am    
when i was trying to call the method

<S:ELEMENT name="ExportEmployees" xmlns:s="#unknown">-<S:COMPLEXTYPE>-
<S:SEQUENCE>
   <S:ELEMENT name="LoginName" type="s:string" maxoccurs="1" minoccurs="0" />
   <S:ELEMENT name="Password" type="s:string" maxoccurs="1" minoccurs="0" />
   <S:ELEMENT name="LastExport" type="s:dateTime" maxoccurs="1" minoccurs="1" nillable="true" />
</S:SEQUENCE>
</S:COMPLEXTYPE>
</S:ELEMENT>

i couldn't able to find ? any help please
#realJSOP 2-Mar-11 8:38am    
Take more care when you post a message here. You need to escape your pointy brackes so everything between them shows up.
Before you consume a Web service you must first install it correctly.
All the steps are listed here:
http://www.eggheadcafe.com/community/aspnet/7/10043054/using-wsdl-file-to-connect-to-a-webservice.aspx[^]

After that using it is very simple. You access the web service as if you accessed a class.
Class.Method....


--
Signature:
How old is the Orthodox Faith?
http://www.orthodoxphotos.com/history.shtml[^]
 
Share this answer
 
Comments
shan1395 2-Mar-11 17:02pm    
Thanks for your comment TheRomanian,i was following the exact same way the "http://www.eggheadcafe.com" ask to do.still i couldn't able to pull my method.i can see other methods but this one is to pass the string and retrieve the values

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900