动态调用WebService 的问题~~ 不知道为什么 本帖最后由 ahwwmb 于 2009-12-30 11:39:57 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 参数不同呗,可以自己先用vs自动生成一个,然后修改.cs文件就OK了 有添加这个namespace + "." + classname类所在的程序集的引用吗? Mark 这会儿比较忙了! web reference problem?up 从上面看出动态Webservice调用主要使用动态编译以及C#的反射,如果发布的WebService不支持反射或者不是用C#发布,则C#的反射机制可能取不到类,从而报错; 其实代码没问题,是我没看好,之前拿到代码没看就试,所以没试出来,后来看了看代码才发现,“InvokeWebService”是个重载函数,如果webserver没有申明类名,就不传类名,代码就自动获取默认的类名,如果有申明类名,就必须要传,否则就找不到类,我就是这个原因导致出错的 其实代码没问题,是我没看好,之前拿到代码没看就试,所以没试出来,后来看了看代码才发现,“InvokeWebService”是个重载函数,如果webserver没有申明类名,就不传类名,代码就自动获取默认的类名,如果有申明类名,就必须要传,否则就找不到类,我就是这个原因导致出错的 当你打开webserver的时候,左上角蓝底的字就是类名,比如“http://www.webservicex.net/globalweather.asmx”这个webserver上显示的“GlobalWeather”就是类名 对方的webservice是JAVA写的,没有看到类名,只有页面报文如下: <?xml version="1.0" encoding="UTF-8" ?> - <wsdl:definitions targetNamespace="http://sms.ccit.com" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://sms.ccit.com" xmlns:intf="http://sms.ccit.com" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">- <!-- WSDL created by Apache Axis version: 1.2.1Built on Aug 08, 2005 (11:49:10 PDT) --> - <wsdl:types>- <schema targetNamespace="http://sms.ccit.com" xmlns="http://www.w3.org/2001/XMLSchema"> <import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> - <complexType name="ArrayOf_xsd_string">- <complexContent>- <restriction base="soapenc:Array"> <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]" /> </restriction> </complexContent> </complexType>- <complexType name="ResponseInfo">- <sequence> <element name="p_IResult" type="xsd:int" /> <element name="p_SMsg" nillable="true" type="xsd:string" /> </sequence> </complexType> </schema> </wsdl:types> 怎么取java webservice的类名呀? 其实只要在vs里面导入web引用输入就可以看见类名。还有一种方法就是通过代码动态获得类名。 怎么将一年中的某天,转换成DateTime? 100分献上 如何将DataGird中的某列固定到第一列 急呼!!数据库远程连接问题 财务中datagrid的样式 如何实现. 100分 关于 C# 2005 看不到解决方案 关于水晶报表用crystalreportviewer预览时的居中问题? 发邮件问题! 请高手帮忙:如何把数据缓冲区指针中的数据放到结构中并读出来 【求助】大虾请进,c#中调用oracle的存储过程问题 有关dev grid的问题 飞信二次开发和连接移动短信网关问题(在线等)? 类型转换问题?
up
如下:
<?xml version="1.0" encoding="UTF-8" ?>
- <wsdl:definitions targetNamespace="http://sms.ccit.com" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://sms.ccit.com" xmlns:intf="http://sms.ccit.com" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <!-- WSDL created by Apache Axis version: 1.2.1
Built on Aug 08, 2005 (11:49:10 PDT)
-->
- <wsdl:types>
- <schema targetNamespace="http://sms.ccit.com" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
- <complexType name="ArrayOf_xsd_string">
- <complexContent>
- <restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]" />
</restriction>
</complexContent>
</complexType>
- <complexType name="ResponseInfo">
- <sequence>
<element name="p_IResult" type="xsd:int" />
<element name="p_SMsg" nillable="true" type="xsd:string" />
</sequence>
</complexType>
</schema>
</wsdl:types>
还有一种方法就是通过代码动态获得类名。