相关疑难解决方法(0)

带有CURL的PHP​​中的SOAP请求

由于php.net上的SOAP手册不是很友好,我找不到任何好的例子,我会在这里发布我的问题.

如何创建PHP SOAP请求看起来像这样?

POST /MySERVER/myWSDLservice.asmx HTTP/1.1
Host: connection.mywebsite.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://connection.mywebsite.com/MySERVER/GetCarType"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
 <soap:Body>
  <GetCarType xmlns="http://connection.mywebsite.com/MySERVER/">
    <IDNumber>string</IDNumber>
  </GetCarType>
 </soap:Body>
</soap:Envelope>
Run Code Online (Sandbox Code Playgroud)

请注意:

  • 有用户/通过身份验证
  • SSL连接

任何建议/链接/示例非常感谢.

php curl soap

64
推荐指数
1
解决办法
14万
查看次数

SoapClient尝试获取模式文件时出现401身份验证错误

我的应用程序通常连接到第三方服务器以通过SOAP/WSDL获取数据:

$this->soap_client = new SoapClient("https://[the-domain]:443/[path]?wsdl", array(
    'trace'=>1,
    'login'=>$this->username,
    'password'=>$this->password,
    'exceptions' => true,
    'cache_wsdl' => WSDL_CACHE_NONE
)
Run Code Online (Sandbox Code Playgroud)

去年一切都很好,但他们最近更新了他们的WSDL文件,现在当应用程序尝试连接时,我收到以下两个错误:

SoapClient::SoapClient(http://[the-domain]:80/[path]?xsd=1): failed to open stream: HTTP request failed! HTTP/1.1 401 Unauthorized

SoapClient::SoapClient(): I/O warning : failed to load external entity "http://[the-domain]:80/[path]?xsd=1"

当我查看WSDL XML文件时,看起来违规的可卸载文件是它试图导入的文档模式文件(schemaLocation):( 来自WSDL :)

<types>
<xsd:schema>
<xsd:import namespace="[irrelevant]" schemaLocation="http://[the-domain]:80/[path]?xsd=1"/>
</xsd:schema>
</types>
Run Code Online (Sandbox Code Playgroud)

我已经打了一会儿反对这一点,据我所知,问题是两件事之一:

  1. 当我在浏览器中(在浏览器身份验证之后)将该架构URL加载302 redirectshttpsURL(并删除端口声明)时.尝试导入架构时,SOAP调用是否可能不遵循重定向?
  2. 鉴于错误消息是401错误 - 在尝试导入架构时SOAP调用是否可能没有传递凭据?模式文件需要与WSDL文件相同的身份验证,但是在尝试导入时服务器可能没有将身份验证扩展到模式?

假设这是第二个问题,有没有办法可以强制系统使用不同的架构URL而无需下载WSDL文件,编辑它,并在本地存储/引用它?如果是这样,我可以尝试传递URL(http://username:password@domain....)中的凭据?

如果我唯一的目的是创建WSDL和XSD模式文件的修改副本,那么就这样吧,但是我很想知道是否有人有任何想法可以让我避免这种情况(因为模式确实从时间变化 - 到时间).

php xsd soap soap-client

7
推荐指数
1
解决办法
3299
查看次数

Soap客户端复杂类型PHP请求

我有一个带有以下链接的web服务 我正在尝试访问函数名称,SubmitRequestType但似乎函数不存在而不是submitAnsiSingle这是我到目前为止尝试的正确的函数名称,

$wsdl = 'https://ww3.navicure.com:7000/webservices/NavicureSubmissionService?WSDL';

class SecurityHeaderType {
        private $submitterIdentifier;
        private $originatingIdentifier;
        private $submitterPassword;
        private $submissionId;
        function SecurityHeaderType() {
            $this->submitterIdentifier = '***';
            $this->originatingIdentifier = '****';
            $this->submitterPassword = '****';
            $this->submissionId = '';

        }           
}

class SubmitRequestType {

        private $submitterIdentifier;
        private $originatingIdentifier;
        private $submitterPassword;
        private $submissionId;
        private $timeout;
        private $transactionType;
        private $submittedAnsiVersion;
        private $resultAnsiVersion;
        private $submitterSubmissionId;
        private $processingOption;
        private $payload;
        private $exceptions;

        function SubmitRequestType() {

        $this->submitterIdentifier = '***';
        $this->originatingIdentifier = '***';
        $this->submitterPassword = '**';
        $this->submissionId = …
Run Code Online (Sandbox Code Playgroud)

php soap wsdl web-services soap-client

5
推荐指数
1
解决办法
698
查看次数

标签 统计

php ×3

soap ×3

soap-client ×2

curl ×1

web-services ×1

wsdl ×1

xsd ×1