473,756 Members | 2,383 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accessing web service -- passing parameters..

Our vender provided us a web service:

1xyztest.xsd file...
------------------------------------
postEvent PostEventReques t
-------------------------------------
authetication authentication
eventname string
source string
ID string
date datetime
name string
parameters NameParameterVa lue
---------------------------------------

2authetication further nested into:
---------------------------------------
authentication authentication
--------------------------------------
principal string
credential string
---------------------------------------

3parameters further nested into
--------------------------------------
parameter namePrameterVal ue
name string
(grp1) choice
-------------------------------------
(grp1) choice
---------------------------------
stringvalue string
numericvalue numericvalue
booleanvalue boolean

---------------------------------------------------------------
I am trying to pass some parameters to this web service from test.aspx
webform....
The out it is expecting is something like this

HTML Code:
<authentication >
<principal>test </principal>
<creditial>test 123</credential>
<autheticatio n>
<parameters>
<name>text<name >
<value>testtext </value>
</parameters>
<name>numeric </name>
<value>56</value>
</parameters>Now I added a web referece to this webservice

Code:
dim xref as new xyztext.if I do sref.postevent
it is expecting 1st parameter as authetication as xyztest.authent ication

same for parameters..

Code:
parameter() as xyztest.namepar ameterValuePair------------------------------
I am not sure how to pass these parameters to web service.. to trigger a
webservice..
I would appreciate if someone could help me with this....

Thanks

Nov 1 '06 #1
10 3932
"amazon" <am****@discuss ions.microsoft. comwrote in message
news:15******** *************** ***********@mic rosoft.com...
Our vender provided us a web service:

1xyztest.xsd file...
If this is a standard SOAP web service, then the vendor should have supplied
you with a WSDL file, perhaps in addition to the XSD files. You should use
Add Web Reference in Visual Studio.NET to add a web reference to your
ASP.NET project. You will then be able to make calls to this web service
using standard code.

John
Nov 3 '06 #2
Thnaks John for answer....

Yes I do have wsdl file and added web reference to web service like normal
web service..

What I do not understand is:
How do I pass parameter of type authentication to a web service..
I know how to pass parameters as type string, integer etc...

"John Saunders" wrote:
"amazon" <am****@discuss ions.microsoft. comwrote in message
news:15******** *************** ***********@mic rosoft.com...
Our vender provided us a web service:

1xyztest.xsd file...

If this is a standard SOAP web service, then the vendor should have supplied
you with a WSDL file, perhaps in addition to the XSD files. You should use
Add Web Reference in Visual Studio.NET to add a web reference to your
ASP.NET project. You will then be able to make calls to this web service
using standard code.

John
Nov 3 '06 #3
"amazon" <am****@discuss ions.microsoft. comwrote in message
news:36******** *************** ***********@mic rosoft.com...
Thnaks John for answer....

Yes I do have wsdl file and added web reference to web service like normal
web service..

What I do not understand is:
How do I pass parameter of type authentication to a web service..
I know how to pass parameters as type string, integer etc...
In your Visual Studio project with the web reference, use Project->Show All
Files. If you expand the web reference, you'll find a file called
Reference.cs or Reference.vb. Take a look in that file, and see if VS hasn't
generated you an Authentication class you can use. Also, look to see what
the types are of the parameters to the proxy methods it has generated.

John
Nov 3 '06 #4
Thanks John again..

I am using visual studio 2005.. it doesn't seem to have that option..

There are three classes, I want to use:
1Authentication
2Post event(Imp class)
3name parameter value

I can do

Dim auth As ws.Authenticati on = New ws.Authenticati on()
Dim parameter As ws.NameParamete rValuePair() = New
ws.NameParamete rValuePair(2) {} (I am not sure how to declare this one?)
Dim postev As New ws.postevent

then I can assign:
auth.prinipal = "abc"
auth.credential = "xyz123"

Also, I want to pass two pair of parameters (not sure about how to asdsign
values to this also)
parameterWF(0). name = "string"
parameterWF(0). ItemElementName = "testX"

parameterWF(1). name = "string"
parameterWF(1). ItemElementName = "te**@email.com "

Now, if I want to pass parameters to the main class of the webservice:
I do:
postev.PostEven t(authenticatio n as ws.authenticati on (I nned help in
passignn this), name as string,type as string,id as string, exdate as date,
parameter() as ws.nameparamete rvaluepair (I neeed help in passing this))

Now if everythingis string
I can do: postev.PostEven t("esfd", "abc", "asd" ,etc)

But How do I pass parameters, authentication values to a web service
"amazon" wrote:
Thnaks John for answer....

Yes I do have wsdl file and added web reference to web service like normal
web service..

What I do not understand is:
How do I pass parameter of type authentication to a web service..
I know how to pass parameters as type string, integer etc...

"John Saunders" wrote:
"amazon" <am****@discuss ions.microsoft. comwrote in message
news:15******** *************** ***********@mic rosoft.com...
Our vender provided us a web service:
>
1xyztest.xsd file...
If this is a standard SOAP web service, then the vendor should have supplied
you with a WSDL file, perhaps in addition to the XSD files. You should use
Add Web Reference in Visual Studio.NET to add a web reference to your
ASP.NET project. You will then be able to make calls to this web service
using standard code.

John

Nov 3 '06 #5
"amazon" <am****@discuss ions.microsoft. comwrote in message
news:5E******** *************** ***********@mic rosoft.com...
Thanks John again..

I am using visual studio 2005.. it doesn't seem to have that option..
Which version of VS2005 are you using? I'm using the Professional Edition,
and it _does_ have that option. It's the first menu item on the Project
menu.

I'm using C#, which might be the difference.
If you can't look at the file directly (there's some neat stuff in there),
then take a look at your proxy class with Object Browser or the Class View.
John
Nov 3 '06 #6
I am using visual studio professional edition too..
I have five options at the top of the solution explorer:
1properties
2refresh
3Nest related files
4view designer
5copy website
6asp.net configuration

Could you please also help me with this:
There are three classes, I want to use:
1Authentication
2Post event(Imp class)
3name parameter value

I can do

Dim auth As ws.Authenticati on = New ws.Authenticati on()
Dim parameter As ws.NameParamete rValuePair() = New
ws.NameParamete rValuePair(2) {} (I am not sure how to declare this one?)
Dim postev As New ws.postevent

then I can assign:
auth.prinipal = "abc"
auth.credential = "xyz123"

Also, I want to pass two pair of parameters (not sure about how to asdsign
values to this also)
parameterWF(0). name = "string"
parameterWF(0). ItemElementName = "testX"

parameterWF(1). name = "string"
parameterWF(1). ItemElementName = "te**@email.com "

Now, if I want to pass parameters to the main class of the webservice:
I do:
postev.PostEven t(authenticatio n as ws.authenticati on (I nned help in
passignn this), name as string,type as string,id as string, exdate as date,
parameter() as ws.nameparamete rvaluepair (I neeed help in passing this))

Now if everythingis string
I can do: postev.PostEven t("esfd", "abc", "asd" ,etc)

But How do I pass parameters, authentication values to a web service

Thank you so much and I really appreciate your help...


"John Saunders" wrote:
"amazon" <am****@discuss ions.microsoft. comwrote in message
news:5E******** *************** ***********@mic rosoft.com...
Thanks John again..

I am using visual studio 2005.. it doesn't seem to have that option..

Which version of VS2005 are you using? I'm using the Professional Edition,
and it _does_ have that option. It's the first menu item on the Project
menu.

I'm using C#, which might be the difference.
If you can't look at the file directly (there's some neat stuff in there),
then take a look at your proxy class with Object Browser or the Class View.
John
Nov 3 '06 #7
"amazon" <am****@discuss ions.microsoft. comwrote in message
news:2D******** *************** ***********@mic rosoft.com...
>I am using visual studio professional edition too..
I have five options at the top of the solution explorer:
1properties
2refresh
3Nest related files
4view designer
5copy website
6asp.net configuration
What is in your Project menu? That's where I said that Show All Files was.

Also, have you looked at Class View or Object Browser?
postev.PostEven t(authenticatio n as ws.authenticati on (I nned help in
passignn this), name as string,type as string,id as string, exdate as
date,
parameter() as ws.nameparamete rvaluepair (I neeed help in passing this))

Now if everythingis string
I can do: postev.PostEven t("esfd", "abc", "asd" ,etc)
Are you actually entering "as ws.authenticati on" in the web service call?
You don't do that. Just specify:

postev.PostEven t(authenticatio n, name, type, id, exdate, parameter)

Are you saying that your problem has nothing in particular to do with the
fact that you're calling a web service, and instead has to do with the fact
that you don't know how to pass non-primmitive values to a method?

If this is so, you should have said so, and should have posted on one of the
VB.NET newsgroups.
John
Nov 4 '06 #8
Hi John,

First of all, I appologize for all the confusion created by my question..
and appreciate your responses....
What is in your Project menu? That's where I said that Show All Files was.
I am looking in solution explorer and I don't see it in there... I also have
vs 2003 and I see show all files option there but not in visual studio 2005..
Also, have you looked at Class View or Object Browser?
Oh!! I didn't know you can see classes for web services in above view..
Thank you very much.. .I see the classes I want to use.. .
>
postev.PostEven t(authenticatio n as ws.authenticati on (I nned help in
passignn this), name as string,type as string,id as string, exdate as
date,
parameter() as ws.nameparamete rvaluepair (I neeed help in passing this))

Now if everythingis string
I can do: postev.PostEven t("esfd", "abc", "asd" ,etc)

Are you actually entering "as ws.authenticati on" in the web service call?
You don't do that. Just specify:
No.. I wasn't sure about how to pass type ws.authenticati on.. But now with
your help.. I created a function as type authentication( that I found it under
class view)
so I am passing just calling that class from web serive like
postev.PostEven t(auth(), .............)

and setting authentication parameters.

Private Function auth() As ws.Authenticati on
Dim authWF As ws_sghe_WF.Auth entication = New ws.Authenticati on()
authWF.principa l = "test"
authWF.credenti al = "testpwd"
Return auth
End Function

It is working fine and I am connecting to web service (Thanks to you)

postev.PostEven t(authenticatio n, name, type, id, exdate, parameter)

Are you saying that your problem has nothing in particular to do with the
fact that you're calling a web service, and instead has to do with the fact
that you don't know how to pass non-primmitive values to a method?

If this is so, you should have said so, and should have posted on one of the
VB.NET newsgroups.
Actually I wasn't sure about what my problem was since I have absolutely no
documentation from our vendor.. but now I solve accessing problem with your
help and now having passing non-primitive data array type parameter() as
ws.nameparamete rvaluepair ..
If I do the same thing above that I did for authentication

Private Function parameter() As ws.NameParamete rValuePair()
Dim parameter As ws.NameParamete rValuePair()
parameter = New ws.NameParamete rValuePair(2) {}

parameter(0).na me = "string"
parameter(0).It emElementName = "my*****@email. com"

parameter(1).na me = "string"
parameter(1).It emElementName = "my name"

Return parameter
End Function

I get following error:
Object reference not set to an instance of an object.

But as you said this is vb .net question.. I will post that in that forum

again, thanks for help..
>
John
Nov 5 '06 #9
"amazon" <am****@discuss ions.microsoft. comwrote in message
news:F2******** *************** ***********@mic rosoft.com...
Hi John,

First of all, I appologize for all the confusion created by my question..
and appreciate your responses....
>What is in your Project menu? That's where I said that Show All Files
was.

I am looking in solution explorer and I don't see it in there... I also
have
vs 2003 and I see show all files option there but not in visual studio
2005..

Why are you looking in Solution Explorer when I ask you to look in your
Project menu???

Private Function parameter() As ws.NameParamete rValuePair()
Dim parameter As ws.NameParamete rValuePair()
parameter = New ws.NameParamete rValuePair(2) {}

parameter(0).na me = "string"
parameter(0).It emElementName = "my*****@email. com"

parameter(1).na me = "string"
parameter(1).It emElementName = "my name"

Return parameter
End Function

I get following error:
Object reference not set to an instance of an object.

But as you said this is vb .net question.. I will post that in that forum
And the VB.NET answer is that you have created an array of
ws.NameParamete rValuePair with dimension 2. You have not done anything to
set the values of the elements of the array.

Consider what it would mean if you did the exact same thing with an array of
Integer:

Dim parameter As Integer()
parameter = New Integer(2){}

' At this point, parameter(0) = 0 and parameter(1) = 0 because you
haven't set them to anything

If you did the same thing with an array of string, you'd see a similar
result:

Dim parameter As String()
parameter = New String(2){}

' At this point, parameter(0) = Nothing and parameter(1) = Nothing
' If you try:

Dim pl As Integer = parameter(0).Le ngth

' Then you will get the same NullReferenceEx ception
' The solution:

parameter(0) = "String"
Dim pl As Integer = parameter(0).Le ngth
' pl is now 6

So, what you want to do in your function is:

Private Function parameter() As ws.NameParamete rValuePair()
Dim parameter As ws.NameParamete rValuePair()
parameter = New ws.NameParamete rValuePair(2) {}

parameter(0) = New ws.NameParamete rValuePair ' Allocate
first
parameter(0).na me = "string"
parameter(0).It emElementName = "my*****@email. com"

parameter(1) = New ws.NameParamete rValuePair ' Allocate
first
parameter(1).na me = "string"
parameter(1).It emElementName = "my name"

Return parameter
End Function
John
Nov 5 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
5601
by: Kookymon1 | last post by:
This is an attempt to respond to an older question (several months). Date: 2002-03-07 13:10:23 PST Subject: On the Common DOM API and Applets. The original message was: >LiveConnect and the JSObject technique are Netscape technologies (or >related to). I want an alternate way of accessing the HTML DOM from >Java Applets and to call Methods on the Applets from JavaScript.
1
1450
by: pronto | last post by:
Hi guys. I made Web Service (C#) and running it on my localhost (Win2000). It does work from IE and from C# client application. Now I'm trying to create application with Visual C++ 6 and get access to the same WebService. What VC++ application does is : get HTML page from the URL and print it out to stdout. It does work with regular sites (like www.cnn.com), but when I specify URL to get access to my Web Service, I've got 401 error...
5
1574
by: OpticTygre | last post by:
What is the best way that anyone has found to capture errors inside a windows service? It's pointless to use compilation constants, as you can't "debug" a service very easily, and you can't pass in a command line arguement (can you?) to tell it to do something special like capture errors to a file while it's running. Has anyone figured out any good ways to do this type of run-time error capturing? Basically, if I were building a...
5
3410
by: clsmith66 | last post by:
I've been asked to find out if a project is possible, but I'm not having much luck finding the information I need, I hope some one can help. I need to see if I can build a windows service on the fly customized to a specific client. Is it possible to run the VS command line tool through another application (VB.NET)? I'm thinking I can run the tools as a process and pass the necessary parameters to the process, but I'm not sure how to go...
1
2274
by: hinsbr | last post by:
Hello, I am trying to learn about web services. I was able to get a working VS 2005 web service and VS 2005 web service consumer application to communicate. The service would return the passed in string parameter and "Hello World", thus printing "myteststring Hello Word" When I tried to use a Delphi 2006 win32 web service consumer for the same service, the parameters were lost and it just returned "Hello World". I first thought...
2
5056
by: Hakan Örnek | last post by:
Hi , I want to parameter passing to my windows sevice. I call service commands like this ; '------------------------------------------------------------ Dim sc As ServiceController sc = New ServiceController("ProsetLogServices") sc.MachineName = "." If sc.Status = ServiceControllerStatus.Stopped Then sc.Start() End If
5
1453
by: shotokan99 | last post by:
hi, i was given a query string : http://mywebservice.com?url=<xurl where xurl=is a valid url. now what the query string does it will display an xml on the page. like this one: <?xml version="1.0" encoding="UTF-8" ?> <response...> .. ..
4
4468
by: Jon | last post by:
I wrote a VS 2005 C# express programme that accesses a web service. It works fine when there's a direct connection to the internet, but on two different PCs with internet access via a proxy, I get this exception: System.Net.WebException: The request failed with HTTP status 407: Proxy Authentication Required. at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream...
0
1499
by: =?Utf-8?B?RGF2ZSBIZXJybWFubg==?= | last post by:
I have a web service (.NET 2.0) that defines a method with two input parameters. Both of these input parameters are defined as "int". This web service is running on a 32-bit machine. There is a client that is calling this web service method. The client is running on a 64-bit machine (written in VB). It declares the two input parameters to be LONGs (64-bit) and is passing these LONG values into the web service that defines these as int....
0
9456
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9872
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9843
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9713
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8713
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5142
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.