将 PHP 生成的 WSDL 导入 Visual Studio 2017

穆勒特的里昂

我目前正在尝试通过 SOAP(不幸的是他们提供的唯一接口/协议)与 Web 服务交互。为了更轻松地使用他们的 Web 服务,他们提供了一个 WSDL,可以在这里查看:http : //demo.coveto.de/soap?wsdl(它被标记为内容类型 text/html 而不是 application/soap+xml,让它看起来很奇怪,VS 不会接受它,所以它必须保存到本地文件)。

我在将上述 WSDL 导入 Visual Studio 2017 时遇到问题。据我所知,推荐的方法是将 WSDL(URL 或本地文件)添加为服务引用,我就是这样做的。这会在 VS17 中弹出以下错误,我不清楚:

Warning     Custom tool warning: Cannot import wsdl:binding
Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.
XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='https://demo.coveto.de/soap']/wsdl:portType[@name='coveto_soapWebservicePort']
XPath to Error Source: //wsdl:definitions[@targetNamespace='https://demo.coveto.de/soap']/wsdl:binding[@name='coveto_soapWebserviceBinding']    

Warning     Custom tool warning: Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on.
XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='https://demo.coveto.de/soap']/wsdl:binding[@name='coveto_soapWebserviceBinding']
XPath to Error Source: //wsdl:definitions[@targetNamespace='https://demo.coveto.de/soap']/wsdl:service[@name='coveto_soapWebserviceService']/wsdl:port[@name='coveto_soapWebservicePort']

Warning     Custom tool warning: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter
Error: The datatype 'http://schemas.xmlsoap.org/soap/encoding/:Array' is missing.
XPath to Error Source: //wsdl:definitions[@targetNamespace='https://demo.coveto.de/soap']/wsdl:portType[@name='coveto_soapWebservicePort']  

(请注意,虽然它说的是警告,而不是错误,但有一个实际的错误只是为了检查其他警告而已)

我认为只有最后一个实际上是一个问题,其他两个只是由它引起的。

我对 SOAP 或 WSDL 不太了解,所以我无法确定问题到底是什么。我已经尝试下载警告中提到的架构,但是在使用文件名(与 wsdl 文件相同的目录)替换各个位置或所有位置的 URL 后,我收到了很多新错误,例如:type X is already已定义或找不到目标命名空间的架构。我将此归因于我对 WSDL 文件结构的一般不理解。

非常感谢帮助。

忠诚

我尝试将 WSDL 文件导入 Visual Studio 2017。

  1. 指向 WSDL 文件的链接http://demo.coveto.de/soap?wsdl无效,因为响应是Content-Type:text/html; charset=UTF-8. 内容类型必须是Content-Type:text/xml;charset=UTF-8.

  2. PHP 内部的 SoapClient 不是很好。尝试改用Zend SoapClient

这对我有用:

<?php

// composer require zendframework/zend-soap

require_once __DIR__ . '/vendor/autoload.php';

$client = new Zend\Soap\Client("http://demo.coveto.de/soap?wsdl");
$result1 = $client->getFunctions();
var_dump($result1);

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

将Visual Studio 2017与.Net Core SDK 3.0结合使用

Visual Studio 2017 bin \ roslyn文件在生成期间被锁定

由于无法找到Visual Studio版本15.0,Visual Studio 2017联机生成代理失败

Visual Studio 2017崩溃

更改生成配置时Visual Studio 2017挂起

使用TypeScript转译的Visual Studio 2017生成错误

TFS 2017-生成服务器无法生成Visual Studio 2017

从门户将Azure函数导入Visual Studio

Visual Studio 2017社区将无法在Windows 10上启动

无法将现有密钥库导入到Visual Studio 2017

始终在Visual Studio 2017中运行生成后事件命令

如何更改远程生成机Visual Studio 2017

在Windows 10l中编译后,如何将openjdk9源代码导入Visual Studio 2017?

Visual Studio(2017)生成工具150

Visual Studio 2017社区使用WSDL

Visual Studio 2017 MSBuild无法生成Azure函数

将Visual Studio 2017更新为预览版

Visual Studio 2017将packages.config迁移到PackageReference

在Visual Studio Enterprise 2017中禁用自动生成的注释

将SSIS功能添加到Visual Studio Enterprise 2017

将Visual Studio 2019降级到Visual Studio 2017

Visual Studio 2017 c#将数据导出到Excel

无法将Apple帐户添加到Visual Studio 2017

Visual Studio 2017和CMake-如何设置生成目录

Visual Studio 2017:规则集将无法执行

将 Visual Studio 2017 多项目 VSIX 发布到市场

Visual Studio 2017 在生成属性时避免使用 Lambda

android.apk 文件未在 Visual Studio 2017 中生成

将 Visual Studio 2017 从移动开发改回 Web 开发