使用SOAP WSDL和PHP的Web服务

时间:2010-07-22 09:23:41

标签: php web-services wsdl soap-client

我一直在尝试使用下面有WSDL文件的Web服务。我不确定的是我应该通过或做的第一部分。它要求一个带有tns类型的personaldetails对象传递给它但我不明白这意味着什么?我尝试使用的实际方法称为PersonalDetails_Update,我将所有相关值传递给它但它仍然失败,我怀疑它是否与它之前要求的personadetails对象有关?

<s:element name="PersonalDetails_Update">
−
<s:complexType>
−
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="personaldetails" type="tns:PersonalDetails"/>
</s:sequence>
</s:complexType>
</s:element>
−
<s:complexType name="PersonalDetails">
−
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="ContactId" nillable="true" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="GenderId" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="EthnicityId" type="s:int"/>
<s:element minOccurs="0" maxOccurs="1" name="Title" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Initials" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Honours" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="FirstName" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Surname" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Salutation" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Position" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Department" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Organisation" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="AccessRequirements" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="DietaryNeeds" type="s:string"/>
<s:element minOccurs="1" maxOccurs="1" name="BirthDate" nillable="true" type="s:dateTime"/>
<s:element minOccurs="1" maxOccurs="1" name="IsNewContact" type="s:boolean"/>
<s:element minOccurs="1" maxOccurs="1" name="HoldingId" nillable="true" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="WebId" nillable="true" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="RecruitedId" type="s:int"/>
</s:sequence>
</s:complexType>
−
<s:element name="PersonalDetails_UpdateResponse">
−
<s:complexType>
−
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="PersonalDetails_UpdateResult" type="s:int"/>
</s:sequence>
</s:complexType>
</s:element>

2 个答案:

答案 0 :(得分:0)

查看Zend_Soapnative Soap extension。两者都有关于如何编写Soap客户端的信息。

答案 1 :(得分:0)

要发送的信息的结构如下:

<Envelope>
  <Header/>
  <Body>
    <PersonalDetails_Update>
      <personaldetails>
        <ContactId>[some value]</ContactId>
        <GenderId>[some value]</GenderId>
        <EthnicityId>[some value]</EthnicityId>
        <Title>[some value]</Title>
        <Initials>[some value]</Initials>
        <Honours>[some value]</Honours>
        <FirstName>[some value]</FirstName>
        <Surname>[some value]</Surname>
        <Salutation>[some value]</Salutation>
        <Position>[some value]</Position>
        <Department>[some value]</Department>
        <Organisation>[some value]</Organisation>
        <AccessRequirements>[some value]</AccessRequirements>
        <DietaryNeeds>[some value]</DietaryNeeds>
        <BirthDate>[some value]</BirthDate>
        <IsNewContact>[some value]</IsNewContact>
        <HoldingId>[some value]</HoldingId>
        <WebId>[some value]</WebId>
        <RecruitedId>[some value]</RecruitedId>
      </personaldetails>
    </PersonalDetails_Update>
  </Body>
</Envelope>

PersonalDetails_Update是您将使用的服务 personaldetails是保存细节的对象 PersonalDetails定义细节