• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 205
  • Last Modified:

My first web service

I've been going tutorials to learn web service. I've been asked to do this and have no clue where to start:

"create a Web Service Client of your own and communicate with the service directly". I have the URL as well and i told if I add ?wsdl at the end  to get the wsdl.

Now, where do I start from? How would I know what to send to the web service?  I can post the URL here if anyone can help me with this. Thanksl
0
Camillia
Asked:
Camillia
  • 14
  • 10
1 Solution
 
PamelaFluenteCommented:
Hello there,
writing a web service is remarkably simple. You just write  a function as usual and expose it as a web service. You can use it directly by adding a web reference to your project.
It's quite easy. Microsoft has managed to make web services really simple and intuitive.

You can start with this simple web service:
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q301273&ID=KB;EN-US;Q301273

and googling the web you will find tons of simple examples.
Do not be afraid: it's really simple, if you know the basics of programming.

-Pam
DataTime Reporting Solution - http://groups.google.it/group/DataTime
http://www.datatime.eu/download.aspx

0
 
CamilliaAuthor Commented:
yeah, going thru tutorials now. http://www.w3schools.com/wsdl/wsdl_documents.asp

Will post back . I think i need to see one example of what i was asked above to do...to get an understanding. That's why i said i can post the URL
0
 
PamelaFluenteCommented:
I am not clear why you mentioned "i can post the URL".
That is of no use to a responder, since you have not placed a web service on the server yet and certainly we cannot do it, as we have no access to it.
If you have already prepared a web service , yes, I can consume it from remote.

-Pam
DataTime Reporting Solution - http://groups.google.it/group/DataTime
http://www.datatime.eu/download.aspx
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
CamilliaAuthor Commented:
This is what our client did:
1. They wrote a web service. They sent me a URL and said..u can add ?wsdl to get the info. They also sent another URL . It's has a submit button, I type something in and get a msg back.  They did this as a test.

 *** does this mean the "submit button" page consumed the web service??
So, from our company , I was able to use/call/consume their web service..right? so, the web service is on their server...correct?

2. Then, they asked me to do this: " Now I need you to create a Web Service Client of your own and communicate with the service directly.  The URL for the web service is  <url here>.  To obtain the wsdl just include ?wsdl on the URL."

***So, I need to write code to call their web service?? but what would it have..the wsdl will tell me what to call??
0
 
PamelaFluenteCommented:
Ah. That's another story. To create the client, you can open VS ide, make a new project, make a web reference to the web service and then invoke it using code like the example below.

For instance:
http://151.100.3.84/DataTimeReportPortal/DataTimeReportingServices.asmx
(this is real: try it)

here are examples of service invocation:

'----------- simple code ---------------------------------
        Dim Dtr As New DataTimeReportingServices
        With Dtr
            .HelloWorld()
        End With
'---------------------------------------------------------------
That's it. Very simple.

-Pam
DataTime Reporting Solution - http://groups.google.it/group/DataTime
http://www.datatime.eu/download.aspx
0
 
CamilliaAuthor Commented:
Thanks. I will try and probably post back tomorrow. Thanks for your help tonight. Will let u know.
0
 
CamilliaAuthor Commented:
let me ask u this...when I click on your link, i see 4 hyperlinks. The second one is HelloWorld.
I can also see the WSDL with element name "HelloWorld".

When I click on HellpWorld, i see the SOAP info.

Now, you have a sample code to call this web service..correct?

I open VS.Net IDE, type that in. I know I need to import webservices namespace.
You have "Dim Dtr As New DataTimeReportingServices".
1.How do I reference DataTimeReportingServices? when I look at WSDL...i dont see "datatimereportingservices".
2.When I open VS.Net IDE, I need to open a new project and choose "web services" to create asmx file?

*** I guess I need a simple step by step to call your HelloWorld and then my light bulb will be bright!


0
 
PamelaFluenteCommented:

Ok. Here it is:


1. Open Visual studio 2005

2. File > New Project > WindowsApplication (it could also be a web application or whatever)

3. Project > Add Web Reference  
      In the Add Web Reference dialog paste URL: http://151.100.3.84/DataTimeReportPortal/DataTimeReportingServices.asmx
      Click "Go"
      in the "Web Reference Name" paste DataTimeReportingServices
      Click "AddReference"

4. Click on the toolbox button (top right)
      Drag a button on the form

5. Click On "properties button" (top right)
      set the "text" properties equal to "Say Hello" or whatever you wish

6. Double Click on the button you placed on the form to open the code window

7. In the "Private Sub Button1_Click" paste the code, as shown below:

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim Dtr As New WebReferences.DataTimeReportingServices
        With Dtr
            MsgBox(.HelloWorld)
        End With

    End Sub

8.Click on Debug to start the program

9. CLick on you button to call the service and get the response



 That's it you are calling my little test service which is responding you by sending the string "hello world"


PS
The Report Portal source code is downloadable here:
http://www.datatime.eu/download.aspx
0
 
PamelaFluenteCommented:
Sorry remove the line from the post above :
->  in the "Web Reference Name" paste DataTimeReportingServices  

  [and leave "WebReferences" there]

Because in the later step I used the default "WebReferences":
        Dim Dtr As New WebReferences.DataTimeReportingServices

Cheers,

-P
0
 
CamilliaAuthor Commented:
Thanks. Let me try . I'm also reading other tutorials. Need to get something done for my manager soon..he just dropped a web services project on my lap...so thanks for your help.
0
 
PamelaFluenteCommented:
Don't worry it will be easier than you think.

Let me know how it goes .

cheers,

-P
0
 
PamelaFluenteCommented:
And be sure you understand the difference between the

  -  web service [will be on the SERVER]
  - CLIENT application [which uses it]
    as the one I just sent you.

They are 2 different things. One is server side the other one is client side.
Making the web service is indeed trivial as it's just a standard FUNCTION exposed on the web.
If you know how to program under .NET that's enough. Later you can dig on more tech details about the procotol which at this time you do not need to know.
(for instance the info at . http://www.w3schools.com/wsdl/wsdl_documents.asp
you mentioned will probably of no practical use to u at this time )

-P

 
0
 
CamilliaAuthor Commented:
Yep, it worked :D happiness.

Let me ask you this: our client's wsdl ...in the location..it doesnt have "asmx".

For example, it's like  http://151.100.3.84/DataTimeReportPortal/DataTimeReportingServices
 *** no .asmx.  I cant add a web reference to theirs. I'm guessing they have an error and the url must have .asmx. Is this correct?
0
 
PamelaFluenteCommented:
Glad to hear that!   See wasn't easy ?

Perhaps they are taking for granted the extension. What URL did they provide ?

See also:
http://msdn2.microsoft.com/en-us/library/ms972326.aspx

-P
0
 
CamilliaAuthor Commented:
it really was easy. This is the URL they gave me:

The URL for the web service is
http://www.dialtek.com:8090/DialTek/services/test

0
 
CamilliaAuthor Commented:
they say i should be able to call that webservice but where's the asmx extention??
0
 
CamilliaAuthor Commented:
this is what they're saying:

You are communicating with my test web service but you are not correctly formatting the request which is causing the Invalid SOAP Request error that you are seeing.  Are you required to connect to my web service before you write your client?  That is not going to be possible.  I am not familiar with MS tools, but there should be a way to create a client based on the wsdl alone.
0
 
CamilliaAuthor Commented:
ok , i think i got it. in the web reference, I added the URL and added ?wsdl

I guess they dont use asmx .
0
 
PamelaFluenteCommented:
Good. Compliments!

See?  You are already better than me :-))

Cheers

-P
http://www.datatime.eu/DataTimeUniversal.htm
0
 
CamilliaAuthor Commented:
Thanks for your help
0
 
CamilliaAuthor Commented:
Pamela - i have another question. I will open another question and post the link here. Doesnt seem difficult but they asked me to do one thing and not sure if I need to write a "client" or a "web service" for it.

Thanks

Kamila (farzadw is my brother :))
0
 
PamelaFluenteCommented:
ok Kamila . Post the link.

Cheers

-P
http://www.datatime.eu/DataTimeUniversal.htm

0
 
CamilliaAuthor Commented:
0
 
CamilliaAuthor Commented:
New question URL. I think I had the question in the wrong zone:

http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/WSDL/Q_22880979.html

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.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 14
  • 10
Tackle projects and never again get stuck behind a technical roadblock.
Join Now