473,406 Members | 2,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Accessing web service -- passing parameters..

Our vender provided us a web service:

1xyztest.xsd file...
------------------------------------
postEvent PostEventRequest
-------------------------------------
authetication authentication
eventname string
source string
ID string
date datetime
name string
parameters NameParameterValue
---------------------------------------

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

3parameters further nested into
--------------------------------------
parameter namePrameterValue
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>test123</credential>
<authetication>
<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.authentication

same for parameters..

Code:
parameter() as xyztest.nameparameterValuePair------------------------------
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 3896
"amazon" <am****@discussions.microsoft.comwrote in message
news:15**********************************@microsof t.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****@discussions.microsoft.comwrote in message
news:15**********************************@microsof t.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****@discussions.microsoft.comwrote in message
news:36**********************************@microsof t.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.Authentication = New ws.Authentication()
Dim parameter As ws.NameParameterValuePair() = New
ws.NameParameterValuePair(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.PostEvent(authentication as ws.authentication (I nned help in
passignn this), name as string,type as string,id as string, exdate as date,
parameter() as ws.nameparametervaluepair (I neeed help in passing this))

Now if everythingis string
I can do: postev.PostEvent("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****@discussions.microsoft.comwrote in message
news:15**********************************@microsof t.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****@discussions.microsoft.comwrote in message
news:5E**********************************@microsof t.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.Authentication = New ws.Authentication()
Dim parameter As ws.NameParameterValuePair() = New
ws.NameParameterValuePair(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.PostEvent(authentication as ws.authentication (I nned help in
passignn this), name as string,type as string,id as string, exdate as date,
parameter() as ws.nameparametervaluepair (I neeed help in passing this))

Now if everythingis string
I can do: postev.PostEvent("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****@discussions.microsoft.comwrote in message
news:5E**********************************@microsof t.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****@discussions.microsoft.comwrote in message
news:2D**********************************@microsof t.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.PostEvent(authentication as ws.authentication (I nned help in
passignn this), name as string,type as string,id as string, exdate as
date,
parameter() as ws.nameparametervaluepair (I neeed help in passing this))

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

postev.PostEvent(authentication, 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.PostEvent(authentication as ws.authentication (I nned help in
passignn this), name as string,type as string,id as string, exdate as
date,
parameter() as ws.nameparametervaluepair (I neeed help in passing this))

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

Are you actually entering "as ws.authentication" in the web service call?
You don't do that. Just specify:
No.. I wasn't sure about how to pass type ws.authentication.. 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.PostEvent(auth(), .............)

and setting authentication parameters.

Private Function auth() As ws.Authentication
Dim authWF As ws_sghe_WF.Authentication = New ws.Authentication()
authWF.principal = "test"
authWF.credential = "testpwd"
Return auth
End Function

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

postev.PostEvent(authentication, 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.nameparametervaluepair ..
If I do the same thing above that I did for authentication

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

parameter(0).name = "string"
parameter(0).ItemElementName = "my*****@email.com"

parameter(1).name = "string"
parameter(1).ItemElementName = "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****@discussions.microsoft.comwrote in message
news:F2**********************************@microsof t.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.NameParameterValuePair()
Dim parameter As ws.NameParameterValuePair()
parameter = New ws.NameParameterValuePair(2) {}

parameter(0).name = "string"
parameter(0).ItemElementName = "my*****@email.com"

parameter(1).name = "string"
parameter(1).ItemElementName = "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.NameParameterValuePair 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).Length

' Then you will get the same NullReferenceException
' The solution:

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

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

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

parameter(0) = New ws.NameParameterValuePair ' Allocate
first
parameter(0).name = "string"
parameter(0).ItemElementName = "my*****@email.com"

parameter(1) = New ws.NameParameterValuePair ' Allocate
first
parameter(1).name = "string"
parameter(1).ItemElementName = "my name"

Return parameter
End Function
John
Nov 5 '06 #10
Thnaks John..Thats exactly what I needed.. .

That solved my most of the problems..

I really appreciate the interst and efforts you took in helping me with
this..

"John Saunders" wrote:
"amazon" <am****@discussions.microsoft.comwrote in message
news:F2**********************************@microsof t.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.NameParameterValuePair()
Dim parameter As ws.NameParameterValuePair()
parameter = New ws.NameParameterValuePair(2) {}

parameter(0).name = "string"
parameter(0).ItemElementName = "my*****@email.com"

parameter(1).name = "string"
parameter(1).ItemElementName = "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.NameParameterValuePair 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).Length

' Then you will get the same NullReferenceException
' The solution:

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

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

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

parameter(0) = New ws.NameParameterValuePair ' Allocate
first
parameter(0).name = "string"
parameter(0).ItemElementName = "my*****@email.com"

parameter(1) = New ws.NameParameterValuePair ' Allocate
first
parameter(1).name = "string"
parameter(1).ItemElementName = "my name"

Return parameter
End Function
John
Nov 6 '06 #11

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

Similar topics

0
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...
1
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...
5
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...
5
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...
1
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...
2
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...
5
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...
4
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...
0
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.