本文介绍了访问Web服务 - 传递参数..的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我们的供应商为我们提供了一项网络服务: 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 .. 如果有人可以帮助我,我将不胜感激用这个.... 谢谢 解决方案 如果这是标准的SOAP Web服务,那么供应商应该提供 你有一个WSDL文件,也许除了XSD文件。您应该使用 在Visual Studio.NET中添加Web引用以向您的 ASP.NET项目添加Web引用。然后,您就可以使用标准代码拨打此网络服务 。 John Thnaks John的答案.... 是的我确实有wsdl文件并添加了网络服务的web引用,就像正常 web服务.. 我不明白的是: 如何将类型认证的参数传递给Web服务.. 我知道如何将参数作为类型字符串,整数等传递... " John Saunders"写道: 如果这是标准的SOAP Web服务,那么供应商应该提供 你有一个WSDL文件,也许除了XSD文件。您应该使用 在Visual Studio.NET中添加Web引用以向您的 ASP.NET项目添加Web引用。然后,您就可以使用标准代码拨打此网络服务 。 John 在带有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 authenticationeventname stringsource stringID stringdate datetimename stringparameters NameParameterValue---------------------------------------2authetication further nested into:---------------------------------------authentication authentication--------------------------------------principal stringcredential string---------------------------------------3parameters further nested into--------------------------------------parameter namePrameterValuename string(grp1) choice-------------------------------------(grp1) choice---------------------------------stringvalue stringnumericvalue numericvaluebooleanvalue boolean---------------------------------------------------------------I am trying to pass some parameters to this web service from test.aspxwebform....The out it is expecting is something like thisHTML 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 webserviceCode:dim xref as new xyztext.if I do sref.posteventit is expecting 1st parameter as authetication as xyztest.authenticationsame for parameters..Code:parameter() as xyztest.nameparameterValuePair------------------------------I am not sure how to pass these parameters to web service.. to trigger awebservice..I would appreciate if someone could help me with this....Thanks 解决方案If this is a standard SOAP web service, then the vendor should have suppliedyou with a WSDL file, perhaps in addition to the XSD files. You should useAdd Web Reference in Visual Studio.NET to add a web reference to yourASP.NET project. You will then be able to make calls to this web serviceusing standard code.JohnIf this is a standard SOAP web service, then the vendor should have suppliedyou with a WSDL file, perhaps in addition to the XSD files. You should useAdd Web Reference in Visual Studio.NET to add a web reference to yourASP.NET project. You will then be able to make calls to this web serviceusing standard code.JohnIn your Visual Studio project with the web reference, use Project->Show AllFiles. If you expand the web reference, you''ll find a file calledReference.cs or Reference.vb. Take a look in that file, and see if VS hasn''tgenerated you an Authentication class you can use. Also, look to see whatthe types are of the parameters to the proxy methods it has generated.John 这篇关于访问Web服务 - 传递参数..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 07-25 00:06