我目前正在与 WSDL 进行集成,因此决定使用 Zeep 库与 Python 一起使用。
我正在尝试使用 对响应进行建模mypy
,以便它可以与 VSCode 的 Intellisense 配合使用,并且在我进行粗心的分配或修改时也会给我一些提示。但是,当 WSDL 响应位于嵌套对象中时,我遇到了障碍,而且我无法找到对其进行类型提示的方法。
来自 WSDL 的示例响应:
{
'result': {
'code': '1',
'description': 'Success',
'errorUUID': None
},
'accounts': {
'accounts': [
{
'accountId': 1,
'accountName': 'Ming',
'availableCredit': 1
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
我正在使用以下代码段进行类型提示:
{
'result': {
'code': '1',
'description': 'Success',
'errorUUID': None
},
'accounts': {
'accounts': [
{
'accountId': 1,
'accountName': 'Ming',
'availableCredit': 1
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
对于尝试 1,原因很明显。但是在尝试了尝试 2 之后,我不知道如何继续了。我在这里缺少什么?
更新:按照@Avi Kaminetzky 的回答,我尝试了以下( …
我遇到过这个问题:[Flags]枚举属性在C#中意味着什么?
有一点我一直想知道,使用接受的答案的例子,如果我宣布会发生什么:
[Flags]
public enum MyColors
{
Yellow = 1,
Green = 2,
Red = 3,
Blue = 4
}
Run Code Online (Sandbox Code Playgroud)
该示例中的以下步骤是否会导致错误?如果不是,我怎样才能进入MyColors.Red?
是什么让我想知道是[ServiceContractAttribute]
.我[ServiceContract]
在文章中看到没有Namespace,但教程中有一个.
所以,我继续改[ServiceContract(Namespace="SandwichServices")]
进[ServiceContract]
,但是当我运行应用程序,并单击按钮,我得到一个异常:Uncaught ReferenceError: SandwichServices is not defined
.
所以我想知道,
[ServiceContractAttribute]
什么区别?从我的角度来看,Namespace
界面看起来不是必需的,但我是对的吗?Web.config文件内容:
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="SandwichServices.CostServiceAspNetAjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment
aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
<services>
<service name="SandwichServices.CostService">
<endpoint address=""
behaviorConfiguration="SandwichServices.CostServiceAspNetAjaxBehavior"
binding="webHttpBinding"
contract="SandwichServices.CostService" />
</service>
</services>
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud) 我有以下场景:
对于1和4,必须在WebView内部执行。我面临的问题是,使用此https://code.google.com/p/zxing/wiki/ScanningFromWebPages,我将在默认浏览器中打开网页。我应该使用 Intent 来解决这个问题吗?或者有什么更好的解决方法吗?
c# ×2
android ×1
asp.net ×1
enum-flags ×1
mypy ×1
python ×1
python-3.x ×1
type-hinting ×1
wcf ×1
zeep ×1