[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

My first web service

Posted on 2007-09-27
24
Medium Priority
?
200 Views
Last Modified: 2013-11-19
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
Comment
Question by:Camillia
  • 14
  • 10
24 Comments
 
LVL 1

Expert Comment

by:PamelaFluente
ID: 19975728
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
 
LVL 7

Author Comment

by:Camillia
ID: 19975741
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
 
LVL 1

Expert Comment

by:PamelaFluente
ID: 19975763
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Author Comment

by:Camillia
ID: 19975812
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
 
LVL 1

Expert Comment

by:PamelaFluente
ID: 19975840
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
 
LVL 7

Author Comment

by:Camillia
ID: 19975851
Thanks. I will try and probably post back tomorrow. Thanks for your help tonight. Will let u know.
0
 
LVL 7

Author Comment

by:Camillia
ID: 19982836
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
 
LVL 1

Accepted Solution

by:
PamelaFluente earned 2000 total points
ID: 19983998

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
 
LVL 1

Expert Comment

by:PamelaFluente
ID: 19984012
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
 
LVL 7

Author Comment

by:Camillia
ID: 19984039
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
 
LVL 1

Expert Comment

by:PamelaFluente
ID: 19984054
Don't worry it will be easier than you think.

Let me know how it goes .

cheers,

-P
0
 
LVL 1

Expert Comment

by:PamelaFluente
ID: 19984100
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
 
LVL 7

Author Comment

by:Camillia
ID: 19991835
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
 
LVL 1

Expert Comment

by:PamelaFluente
ID: 19994472
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
 
LVL 7

Author Comment

by:Camillia
ID: 19994520
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
 
LVL 7

Author Comment

by:Camillia
ID: 19995321
they say i should be able to call that webservice but where's the asmx extention??
0
 
LVL 7

Author Comment

by:Camillia
ID: 19995405
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
 
LVL 7

Author Comment

by:Camillia
ID: 19995529
ok , i think i got it. in the web reference, I added the URL and added ?wsdl

I guess they dont use asmx .
0
 
LVL 1

Expert Comment

by:PamelaFluente
ID: 19998980
Good. Compliments!

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

Cheers

-P
http://www.datatime.eu/DataTimeUniversal.htm
0
 
LVL 7

Author Comment

by:Camillia
ID: 19999087
Thanks for your help
0
 
LVL 7

Author Comment

by:Camillia
ID: 20021823
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
 
LVL 1

Expert Comment

by:PamelaFluente
ID: 20023134
ok Kamila . Post the link.

Cheers

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

0
 
LVL 7

Author Comment

by:Camillia
ID: 20038156
0
 
LVL 7

Author Comment

by:Camillia
ID: 20039974
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

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
The viewer will learn how to dynamically set the form action using jQuery.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question