如何使用savon创建一个对象来访问WSDL中的复杂类型名称

时间:2013-02-15 10:17:07

标签: ruby wsdl savon

我是SAVON和ruby的新手,这是我从我的客户那里的第一份任务。所以非常感谢任何帮助。

<complexType name="CEvent">
 <annotation>
  <documentation>The base used for all events. All events extend this structure.</documentation> 
  </annotation>
 <complexContent>
 <extension base="ttns:CItemWithDBRecordId">
 <sequence>
  <element name="user" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true" /> 
  <element name="date" type="xsd:dateTime" minOccurs="1" maxOccurs="1" nillable="false" /> 
  <element name="notes" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true" /> 
  <element name="eventaddorder" type="xsd:short" minOccurs="1" maxOccurs="1" /> 
  <element name="name" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true" /> 
  <element name="parenteventid" type="xsd:long" minOccurs="0" maxOccurs="1" /> 
  <element name="attachmentlist" type="ttns:ArrayOfCFileAttachment" minOccurs="0" maxOccurs="1" nillable="true" /> 
  <element name="fieldlist" type="ttns:ArrayOfCField" minOccurs="0" maxOccurs="1" nillable="true" /> 
  <element name="resultingstate" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true" /> 
  <element name="hours" type="xsd:double" minOccurs="0" maxOccurs="1" /> 
  <element name="assigntolist" type="ttns:ArrayOfstring" minOccurs="0" maxOccurs="1" nillable="true" /> 
  <element name="releasenotesversion" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true" /> 
  <element name="generatedeventtype" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true" /> 
  <element name="generatedbyname" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true" /> 
  <element name="totaltimespent" type="xsd:double" minOccurs="0" maxOccurs="1" /> 
  <element name="overrideuser" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true" /> 
  <element name="marksuspect" type="xsd:boolean" minOccurs="0" maxOccurs="1" /> 
  </sequence>
  </extension>
  </complexContent>
  </complexType>

我不知道怎么做,还需要用输入数据更新元素的字段。

我以这种方式访问​​复杂名称。

response = @ client.request'CEvent'

我得到的回应是

(SOAP-ENV:Client)方法'ins0:CEvent'未实现:方法名称或namespac  不承认

我确定这不是方法,因为它不是方法名称,所以我仍然摸不着头来解决这个问题。!!

1 个答案:

答案 0 :(得分:0)

我刚刚完成了一个使用SAVON访问Microsoft SharePoint上的SOAP服务的项目。您应该能够使用Savon请求返回的哈希值来访问响应数据。

response.hash [:注释] [:复杂内容] [:序列]

查看下面我网站上的文章。它并非特定于您的要求,但可能有所帮助。

http://mark.stratmann.me/content_items/using-savon-to-connect-to-microsoft-sharepoint-soap-services-in-rails-3-2