2016-10-03 11 views
0

Visual Studio 2015コミュニティでvb.netのsoapクライアントを使用する際に問題があります。私はクライアントのライブラリを石鹸するために使用したいが、私はそれを見つけることができません。Visual Basic。メソッドが反映されない

したがって、Visual Studio 2015コミュニティでwsdl.exeコマンドが見つかりました。私はwsdl.exeを試しました。私はプロジェクトを追加し、正常にコンパイル

https://github.com/yahoojp-marketing/sponsored-search-api-documents/blob/master/wsdl/LocationService.wsdl

C:\Program Files\Microsoft Visual Studio 14.0>wsdl /l:VB https://ss.yahooapis.jp/services/V6.0/LocationService?wsdl /out:C:\Users\user_name\Desktop\ 

:それは次のリンクでコードを生成しました。ただし、この行でオブジェクトをインスタンス化するときに例外が発生します。

Dim LocationServiceWsdl As New LocationService() 

以下はエラーメッセージです。

メッセージ:LocationService.getは
InnnerException反映することができない。SoapHeaderはを反映しているときにエラーが発生しました。で

System.Web.Services.Protocols.SoapReflector.ReflectMethod(LogicalMethodInfo METHODINFO、ブールクライアント、XmlReflectionImporter xmlImporter、SoapReflectionImporter soapImporter、文字列defaultNs)
System.Web.Services.Protocols.SoapClientType.GenerateXmlMappings(タイプtype、 ArrayListにsoapMethodList、文字列serviceNamespace、ブールserviceDefaultIsEncoded、ArrayListのマッピング)
System.Web.Services.Protocols.SoapClientType..ctor(タイプtype)
System.Web.Services.Protocols.SoapHttpClientProtocol..ctor()

場所rvice.vb

<System.Web.Services.Protocols.SoapHeaderAttribute("RequestHeader"), 
System.Web.Services.Protocols.SoapHeaderAttribute("ResponseHeader", Direction:=System.Web.Services.Protocols.SoapHeaderDirection.Out), 
System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace:="http://ss.yahooapis.jp/V6", ResponseNamespace:="http://ss.yahooapis.jp/V6", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)> 
Public Function [get](ByVal accountId As Long, <System.Xml.Serialization.XmlElementAttribute("error")> ByRef [error]() As [Error]) As <System.Xml.Serialization.XmlElementAttribute("rval")> LocationReturnValue 
    Dim results() As Object = Me.Invoke("get", New Object() {accountId}) ' <- maybe error occurs here. 
    [error] = CType(results(1), [Error]()) 
    Return CType(results(0), LocationReturnValue) 
End Function 

エラーを解決するにはどうすればよいですか?

答えて

1

innerexceptionを調べると、実際のエラーはwsdl.exeによって生成されたSoapHeaderクラスに関連していることがわかります。あなたが何か他のものにLocationService.vbファイル内のSOAPHeaderクラスの名前を変更したり、交互にXmlTypeAttribute以内にあなたのクラスに完全な名前空間を追加することができますいずれか

Types 'System.Web.Services.Protocols.SoapHeader' and 'FullNamespaceToYourClass.SoapHeader' both use the XML type name, 'SoapHeader', from namespace 'http://ss.yahooapis.jp/V6'. Use XML attributes to specify a unique XML name and/or namespace for the type. 

'''<remarks/> 
<System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0"), 
System.SerializableAttribute(), 
System.Diagnostics.DebuggerStepThroughAttribute(), 
System.ComponentModel.DesignerCategoryAttribute("code"), 
    System.Xml.Serialization.XmlTypeAttribute(TypeName:="FullNamespaceToYourClass.SoapHeader", [Namespace]:="http://ss.yahooapis.jp/V6"), 
System.Xml.Serialization.XmlRootAttribute("RequestHeader", [Namespace]:="http://ss.yahooapis.jp/V6", IsNullable:=False)> 

Partial Public Class SoapHeader 
    Inherits System.Web.Services.Protocols.SoapHeader 
+0

それが働いています!どうもありがとうございました! – aipa

関連する問題