我對此很陌生,在創建調用Web服務的應用程序時偶然發現了牆壁。我已經添加了wsdl作爲服務參考,沒有問題。我正在嘗試調用的方法需要通過用戶密鑰和登錄進行身份驗證,但我需要在表單中傳遞的唯一方法是登錄(未經身份驗證,它使我登錄失敗)。我用ClientCredentials傳遞的用戶名,但後來我收到這樣的:打電話給未定義的方法,肥皂
[CommunicationException: Server returned an invalid SOAP Fault. Please see InnerException for more details.]
而且內部異常:
[XmlException: Required xml:lang attribute value is missing.]
我查了日誌和響應給了我一個奇怪的消息(大部分代碼是由提供在文檔中的示例):
Call to undefined method X::Action()
我真的不知道如何解決這個問題。文檔是錯誤的,這是值得懷疑的,所以它應該在我的盡頭,但不知道在哪裏。另外,這個應用程序應該是一個能夠部署在每個站點的小部件,因此它應該儘可能簡單。 你能指出我如何處理這個錯誤的正確方向嗎? 我的web.config文件:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.diagnostics>
<system.web>
<compilation debug="true" targetFramework="4.5.2"/>
<httpRuntime targetFramework="4.5.2"/>
</system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+"/>
</compilers>
</system.codedom>
<system.serviceModel>
<diagnostics>
<messageLogging logEntireMessage="true" logMalformedMessages="true"
logMessagesAtTransportLevel="true" />
</diagnostics>
<bindings>
<wsHttpBinding>
<binding name="ApiClientsBinding">
<security mode="Transport">
<transport clientCredentialType="Basic" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://X/edi/api-clients.php"
binding="wsHttpBinding" bindingConfiguration="ApiClientsBinding"
contract="ServiceClient.ApiClientsPortType" name="ApiClientsPort" />
</client>
</system.serviceModel>
</configuration>
更新: 我查心血來潮一些東西,這似乎是一個SOAP版本問題。改變的wsHttpBinding到basicBinding的XML後:郎消失的錯誤,但給我留下了這一點:
<SOAP-ENV:Fault>
<faultcode xmlns="">SOAP-ENV:Server</faultcode>
<faultstring xmlns="">Call to undefined method X::ActivityId()</faultstring>
</SOAP-ENV:Fault>
任何想法?
謝謝。