访问Web服务 - 传递参数.. [英] Accessing web service -- passing parameters..

查看:91
本文介绍了访问Web服务 - 传递参数..的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的供应商为我们提供了一项网络服务:


1xyztest.xsd文件......

------------ ------------------------

postEvent PostEventRequest

-------- -----------------------------

认证认证

eventname string

源字符串

ID字符串

日期日期时间

名称字符串

参数NameParameterValue

---------------------------------------


2 selfhetication进一步嵌入:

----------------------------- ----------

身份验证身份验证

---------------------- ----------------

主要字符串

凭证字符串

------ ---------------------------------


3参数进一步嵌套到

--------------------------------------

参数namePrameterValue

名称字符串

(grp1)选择

--------------- -------------- --------

(grp1)选择

---------------------- -----------

stringvalue string

numericvalue numericvalue

booleanvalue boolean


----------------------------------------------- ----------------

我试图从test.aspx传递一些参数到这个web服务

webform .. ..

预计会出现这样的情况


HTML代码:

< authentication>

< principal> test< / principal>

< creditial> test123< / credential>

< authentictication>

< parameters>

< name> text< name>

< value> testtext< / value>

< / parameters>

< name> numeric< / name>

< value> 56< / value>

< / parameters>现在我添加了这个网络服务的网络参考


代码:

dim xref为新的xyztext.if我做的sref.postevent

它期待第一个参数作为认证xyztest.authentication


参数相同..


代码:

参数()as xyztest.nameparameterValuePair ------------------------------

我不知道如何将这些参数传递给Web服务..触发一个

webservice ..

如果有人可以帮助我,我将不胜感激用这个....


谢谢

解决方案

" amazon" < am **** @ discussion.microsoft.com写信息

news:15 ************************ ********** @ microsof t.com ...


我们的供应商为我们提供了一项网络服务:


1xyztest.xsd文件...



如果这是标准的SOAP Web服务,那么供应商应该提供

你有一个WSDL文件,也许除了XSD文件。您应该使用

在Visual Studio.NET中添加Web引用以向您的

ASP.NET项目添加Web引用。然后,您就可以使用标准代码拨打此网络服务




John


< blockquote> Thnaks John的答案....


是的我确实有wsdl文件并添加了网络服务的web引用,就像正常

web服务..


我不明白的是:

如何将类型认证的参数传递给Web服务..

我知道如何将参数作为类型字符串,整数等传递...


" John Saunders"写道:


" amazon" < am **** @ discussion.microsoft.com写信息

news:15 ************************ ********** @ microsof t.com ...


我们的供应商为我们提供了一项网络服务:


1xyztest.xsd文件...



如果这是标准的SOAP Web服务,那么供应商应该提供

你有一个WSDL文件,也许除了XSD文件。您应该使用

在Visual Studio.NET中添加Web引用以向您的

ASP.NET项目添加Web引用。然后,您就可以使用标准代码拨打此网络服务




John


"亚马逊" < am **** @ discussion.microsoft.com写在留言中

news:36 ************************ ********** @ microsof t.com ...


Thnaks John回答......


是的我确实有wsdl文件并添加了对网络服务的网络引用,比如正常

网络服务..


我不明白的是:

如何将类型认证的参数传递给Web服务..

我知道如何将参数传递为类型字符串,整数等...



在带有Web引用的Visual Studio项目中,使用Project-> Show All

Files。如果您展开Web引用,您将找到一个名为

Reference.cs或Reference.vb的文件。看看那个文件,看看VS是否已经生成了你可以使用的身份验证类的
。另外,看看

类型是它生成的代理方法的参数。


John


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

解决方案

"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


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


"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


这篇关于访问Web服务 - 传递参数..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆