使用Zend_Soap_Client和stdObject创建具有element属性的SOAP请求 [英] Create SOAP request with element attribute using Zend_Soap_Client and stdObject

查看:91
本文介绍了使用Zend_Soap_Client和stdObject创建具有element属性的SOAP请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在调用服务巫婆,其中包括许多其他参数,要求输入诸如(从soapUI提取):

I'm calling a service witch among many other parameters demands an entry like (Taken from soapUI):

  <v110:ReadWorkerRequest>
     <v111:Key v111:type="INITIALS">RKM</v111:Key>
  </v110:ReadWorkerRequest>

如何获取Zend_Soap_Client发送Key元素中的类型属性?

How do I get the Zend_Soap_Client to send the type-attribute in the Key element?

由于这只是一项相当大的服务的一部分,所以我一直在创建类来创建数据结构,例如:

As this is just part of a rather big service, I've been creating classes to create the datastructure, like:

class Key {
  public $_ = 'RKM;
  public $type = 'INITIALS';
}

class Body {
  public $ReadWorkerRequest;

  public function __construct() {
    $this->ReadWorkerRequest = new Key();
  }
}

但是,由于PHP失败,我什至没有发送请求,告诉我:"SOAP错误:编码:对象没有'Key'属性"

However, I do not even get to sending the request as PHP fails, telling me: "SOAP-ERROR: Encoding: object hasn't 'Key' property"

所以我的问题是,如何创建对象结构,可能将其子部分创建为Array?

So my question is, how do I create an object structure, possibly with a subpart created as an Array which will honor this?

对象结构是否正确,我需要使用classmap或SoapVar(我尝试了一些组合,但没有成功)

Or is the object structure correct, and I need to use classmap or SoapVar (I tried some combinations, but not with any success)

节日快乐,对于那些拥有节日的人们! :-)

Happy holidays, for those of you who has them! :-)

推荐答案

我花了很多时间试图解决这个问题,但是我能想到的最好的办法是使用XSD_ANYXML hack,例如:

I have spent many hours myself trying to solve this problem but the best I could come up with was to use the XSD_ANYXML hack, eg:

$this->ReadWorkerRequest = new SoapVar( '<v111:Key v111:type="INITIALS">RKM</v111:Key>', XSD_ANYXML );

这是一个非常讨厌的黑客.希望其他人可以提供更好的解决方案.

Its a pretty nasty hack though. Hopefully somebody else can provide a better solution.

这篇关于使用Zend_Soap_Client和stdObject创建具有element属性的SOAP请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆