【问题标题】:Soap Response Namespace issue肥皂响应命名空间问题
【发布时间】:2011-03-20 08:53:13
【问题描述】:

我使用 php 创建了简单的肥皂服务器,使用的 WSDL 位于:http://fromyourdesign.com/webapp/wsdl/fromyourdesign.wsdl

我得到的响应与 LoginResponse 标签的命名空间不匹配:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="http://roomplanner.icovia.com/pci">
  <SOAP-ENV:Body>
    <ns1:LoginResponse xsi:type="http://roomplanner.icovia.com/pci">   <<<==== This shoud be <LoginResponse xmlns="http://roomplanner.icovia.com/pci">
      <LoginResult>
        <register>
          <customer>Rajat Teotia</customer>
        </register>
      </LoginResult>
    </ns1:LoginResponse>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

简单的soap服务器的代码是:

<?php

class Login {
 public function Login($username, $password) {
  $ns = 'http://roomplanner.icovia.com/pci';
  $LoginResponse = new StdClass();
  $LoginResponse->LoginResult->register->customer = 'Rajat Teotia';
  return new SoapVar ( $LoginResponse, SOAP_ENC_OBJECT, $ns);
 }
}
$fydWsdl = "http://www.fromyourdesign.com/webapp/wsdl/fromyourdesign.wsdl";
ini_set ( "soap.wsdl_cache_enabled", "0" ); // disabling WSDL cache
$server = new SoapServer ( $fydWsdl );
$server->setClass ( "Login" );
$server->handle ();
?> 

可以做些什么来解决这个问题。提前致谢。

拉贾特

【问题讨论】:

  • 命名空间是第 4 个参数,而不是第 3 个

标签: php soap namespaces


【解决方案1】:

您的代码中的参数列表似乎有误。命名空间应该是第四个参数,而不是第三个。

SoapVar::SoapVar ( 字符串 $data , string $encoding [, string $type_name [, string $type_namespace [, string $node_name [, string $node_namespace ]]]])

问候 朱利安

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-07-03
    • 2020-01-11
    • 1970-01-01
    • 2014-11-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多