【发布时间】:2011-11-19 12:02:30
【问题描述】:
我尝试访问此 SOAP Web 服务 (http://iberius.scjn.gob.mx:8080/Mobile/Tematica.svc),并且我还提供了它的 WSDL 文件
http://iberius.scjn.gob.mx:8080/Mobile/Tematica.svc?wsdl
http://iberius.scjn.gob.mx:8080/Mobile/Tematica.svc?wsdl=wsdl0
http://iberius.scjn.gob.mx:8080/Mobile/Tematica.svc?xsd=xsd0
http://iberius.scjn.gob.mx:8080/Mobile/Tematica.svc?xsd=xsd1
http://iberius.scjn.gob.mx:8080/Mobile/Tematica.svc?xsd=xsd2
http://iberius.scjn.gob.mx:8080/Mobile/Tematica.svc?xsd=xsd3
但我从未使用过肥皂,而且我发现 WSDL 文件不够清晰。 我要做的是查询服务以获取可用的不同操作,例如 ListaMinistros 操作采用参数 actualizacion,该参数是格式为 yyyymmdd 的日期。 我已经尝试了所有可能的组合来联系该服务,但它的响应是 Endpoint not found 响应。 如果你能给我提供一个 SOAP XML 的例子,那就太好了,因为几乎所有其他可用的操作都是一样的,所以我不知道自己该怎么做。
提前致谢
========
编辑
我已经在 Visual Studio 的 C# 项目中设置了 WSDL 引用,以查看它发出什么样的请求
它提供的配置文件如下:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="Rest">
<textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
messageVersion="Soap12" writeEncoding="utf-8">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</textMessageEncoding>
<httpTransport />
</binding>
</customBinding>
</bindings>
<client>
<endpoint
binding="customBinding" bindingConfiguration="Rest" contract="SCJN.Tematica"
name="Rest" />
</client>
</system.serviceModel>
但它不包含端点的地址,所以我将端点修改为如下所示:
<endpoint address="http://iberius.scjn.gob.mx:8080/Mobile/Tematica.svc"
binding="customBinding" bindingConfiguration="Rest" contract="SCJN.Tematica"
name="Rest" />
但是服务响应了一个未找到的端点。
那么有没有办法找出要调用的地址。 此外,WSDL 没有列出 SOAPAction 属性,而是列出支持的操作中的 wsaw:Action,在我的 .NET 代码中将其转换为以下内容
[System.ServiceModel.OperationContractAttribute(Action="urn:Tematica/ListaMinistros", ReplyAction="urn:Tematica/ListaMinistrosResponse")]
ConsoleApplication2.SCJN.Ministro[] ListaMinistros(string actualizacion);
【问题讨论】:
-
您无需了解 WSDL 文件!只需使用“添加服务参考”。如果提示不够大,请参阅 How to consume a web service。
-
问题是客户端不在 .net 中,而是用于 iOS 设备的应用程序,所以我不能使用该选项。
-
我很惊讶iOS没有这样的等价物。你确定没有像“wsdl2java”这样的东西吗?
-
感谢您的回复,这里有一个wsdl2objc,所以我试试看。
标签: asp.net xml web-services soap wsdl