Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
VB.net和Web服务异常_.net_Vb.net_Web Services_Visual Studio_Encoding - Fatal编程技术网

VB.net和Web服务异常

VB.net和Web服务异常,.net,vb.net,web-services,visual-studio,encoding,.net,Vb.net,Web Services,Visual Studio,Encoding,我正在通过VB.NET调用一个Web服务。我已经做了AddWebReference来创建绑定 当WS-call抛出异常时,我能够将其作为通用异常对象捕获catch ex as exception。 但是,我不知道如何捕获实际抛出的异常类型 从我的wsdl <wsdl:message name="FException"> <wsdl:part name="fault" type="tns2:FException"/> </wsdl:message> &l

我正在通过VB.NET调用一个Web服务。我已经做了AddWebReference来创建绑定

当WS-call抛出异常时,我能够将其作为通用异常对象捕获
catch ex as exception
。 但是,我不知道如何捕获实际抛出的异常类型

从我的wsdl

<wsdl:message name="FException">
    <wsdl:part name="fault" type="tns2:FException"/>
</wsdl:message>
<wsdl:message name="MyException">
    <wsdl:part name="fault" type="impl:MyException"/>
</wsdl:message>

<complexType name="FException">
    <sequence>
        <element name="errcode" type="xsd:int"/>
        <element name="errmessage" nillable="true" type="soapenc:string"/>
    </sequence>
</complexType>


<complexType name="MyException">
    <complexContent>
        <extension base="tns2:FException"><sequence/>
        </extension>
    </complexContent>
</complexType>
给我

Type 'MyException' is not defined.
我能够用Axis捕获Java中正确的异常


我在VB.NET中缺少什么?Add WebReference似乎没有生成异常对象,因此我无法使用它们。

找到了答案


webservice是一个相当古老的实现,它使用“RPC/Encoded”而不是像“Document/Literal”或“RPC/Literal”这样更为流行的编码。dotnet存根生成器不支持RPC/Encoded。因此出现了问题。

您是否尝试过使用完整的命名空间?MyService.MyException forexample@James-是,同样的错误。如果你在服务上使用对象资源管理器,你能在那里看到MyException类型吗?@James-不,我看不到。如果它不在那里,你就不能使用它。服务引用或服务本身可能有问题?我无法从WSDL中分辨。
Type 'MyException' is not defined.