简体   繁体   中英

Web Service using SOAP WDSL with PHP

I've been trying to use a Web Service which has the WSDL file below. The bit I'm not sure about is what I am supposed to pass or do with the first part of it. It asks for a personaldetails object with a tns type to be passed to it but I don't understand what that means? The actual method I am trying to use is called PersonalDetails_Update and I am passing all of the relevant values to it but it keeps failing and I suspect it's to do with this personadetails object it asks for before it?

<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>

Have a look at Zend_Soap and the native Soap extension . Both have information about how to write a Soap Client.

The structure of the information to send is something like this:

<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 is the service you'll be using personaldetails is the object that will hold the details PersonalDetails defines the details

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM