[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How can i use PHP to submit a SOAP request

Posted on 2007-09-30
3
Medium Priority
?
3,814 Views
Last Modified: 2013-11-18
I am trying to setup a donation fom that submits into an API. What i need to know, is how to do this using PHP and SOAP.

This is an example SOAP request for the API I am using

POST /services/Sphere.asmx HTTP/1.1
Host: www.kintera.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "https://www.kintera.com/services/MakeSupporterDonation"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <KinteraSoapHeader xmlns="https://www.kintera.com/services/">
      <AccountID>int</AccountID>
      <SecurityToken>string</SecurityToken>
    </KinteraSoapHeader>
  </soap:Header>
  <soap:Body>
    <MakeSupporterDonation xmlns="https://www.kintera.com/services/">
      <request>
        <SupporterID>string</SupporterID>
        <EventID>int</EventID>
        <DonationAmount>decimal</DonationAmount>
        <PaymentType>CreditCard or OnlineCheck</PaymentType>
        <CreditCardInfo>
          <CardNumber>string</CardNumber>
          <CardType>string</CardType>
          <HolderName>string</HolderName>
          <ExpireYear>string</ExpireYear>
          <ExpireMonth>string</ExpireMonth>
          <CVV>string</CVV>
        </CreditCardInfo>
        <OnlineCheckInfo>
          <BankAccountNumber>string</BankAccountNumber>
          <BankID>string</BankID>
          <BankAccountType>string</BankAccountType>
          <BankCustomerName>string</BankCustomerName>
        </OnlineCheckInfo>
        <DonationGift>
          <ID>int</ID>
          <Message>string</Message>
          <Receiver>string</Receiver>
          <ShippingAddress>
            <AddressLine1>string</AddressLine1>
            <AddressLine2>string</AddressLine2>
            <City>string</City>
            <State>string</State>
            <Zip>string</Zip>
            <Country>string</Country>
            <Province>string</Province>
          </ShippingAddress>
        </DonationGift>
        <DonationFrequency>int</DonationFrequency>
        <DonationTimes>int</DonationTimes>
        <VisitorSource>
          <TypeID>int</TypeID>
          <SourceID>string</SourceID>
          <SourceTitle>string</SourceTitle>
          <SourceUrl>string</SourceUrl>
          <PromotionCode>string</PromotionCode>
        </VisitorSource>
        <SupporterActionID>int</SupporterActionID>
        <IsTest>boolean</IsTest>
      </request>
    </MakeSupporterDonation>
  </soap:Body>
</soap:Envelope>
0
Comment
Question by:edgardoburgos
2 Comments
 
LVL 3

Accepted Solution

by:
theevilworm earned 1000 total points
ID: 19988439
You should use already existing soap client implementations.
php5 has a native soap implementation: http://php.net/soap
nusoap: http://sourceforge.net/projects/nusoap/
pear soap: http://pear.php.net/package/soap/

there are a lot of php soap tutorials when searching google for any implementation you choose and it's likely you'll find one that fits your programming style:
http://www.google.com/search?hl=en&q=php+soap+client+example&btnG=Google+Search

I would suggest you use nusoap if your application needs to run on both php4 and php5 or the native php5 soap extension if only php5 will be used.

If the service you are building a client for provides a WSDL document, it's extremly easy to write a client for it. Any php soap implementation can generate an object from the WSDL and you're left with only implementing the functionality into your already existing script.
0
 
LVL 23

Assisted Solution

by:rama_krishna580
rama_krishna580 earned 1000 total points
ID: 20068839
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to count occurrences of each item in an array.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses
Course of the Month18 days, 8 hours left to enroll

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question