私は完全に夢中になり、おそらく最悪の方法で解決しましたが、Web クライアントで cultureinfo を設定したり、requestencoding を設定したりしても役に立たなかったため、タスクを達成するのに役立ちました: カスタム SoapExtension:
Public Class MySoapExtension
Inherits SoapExtension
Private oldStream As Stream
Private newStream As Stream
Public Overrides Function ChainStream(stream As Stream) As Stream
oldStream = stream
newStream = New MemoryStream()
Return newStream
End Function
Public Overloads Overrides Function GetInitializer(methodInfo As _
LogicalMethodInfo, _
attribute As SoapExtensionAttribute) As Object
End Function
Public Overloads Overrides Function GetInitializer(WebServiceType As _
Type) As Object
End Function
Public Overrides Sub Initialize(initializer As Object)
End Sub
Public Overrides Sub ProcessMessage(message As SoapMessage)
Select Case message.Stage
Case SoapMessageStage.BeforeSerialize
Case SoapMessageStage.AfterSerialize
WriteOutput(message)
Case SoapMessageStage.BeforeDeserialize
WriteInput(message)
Case SoapMessageStage.AfterDeserialize
Case Else
Throw New Exception("invalid stage")
End Select
End Sub
' Write the SOAP message out to a file.
Public Sub WriteOutput(message As SoapMessage)
newStream.Position = 0
Copy(newStream, oldStream)
End Sub
' Write the SOAP message out to a file.
Public Sub WriteInput(message As SoapMessage)
Copy(oldStream, newStream)
newStream.Position = 0
End Sub
Sub Copy(fromStream As Stream, toStream As Stream)
Dim reader As New StreamReader(fromStream)
Dim writer As New StreamWriter(toStream)
writer.WriteLine(ReplaceInvalidChars(reader.ReadToEnd()))
writer.Flush()
End Sub
Private Function ReplaceInvalidChars(ByVal content As String) As String
If content.Contains("salesOrderInfo") Then
Return MagentoHackHelper.Encode(content)
Else
Return content
End If
End Function
End Class
Public Class MagentoHackHelper
Public Shared Function Encode(content As String) As String
content = content.Replace("Å", "##Aaring##")
content = content.Replace("Ä", "##Auml##")
content = content.Replace("Ö", "##Ouml##")
content = content.Replace("å", "##aaring##")
content = content.Replace("ä", "##auml##")
content = content.Replace("ö", "##ouml##")
Return content
End Function
Public Shared Function Decode(content As String) As String
content = content.Replace("##Aaring##", "Å")
content = content.Replace("##Auml##", "Ä")
content = content.Replace("##Ouml##", "Ö")
content = content.Replace("##aaring##", "Å")
content = content.Replace("##auml##", "Ä")
content = content.Replace("##ouml##", "Ö")
Return content
End Function
End Class