how connect SOAP API only using WSDL file

I am having wsdl file which contains the xml structure also ..

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions name="Signup" targetNamespace="https://ClickAndPledge.com/ApplicationService/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:i0="https://ClickAndPledge.com/Signup/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="https://ClickAndPledge.com/ApplicationService/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
    <wsdl:types>
        <xs:schema elementFormDefault="qualified" targetNamespace="https://ClickAndPledge.com/ApplicationService/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
            <xs:import namespace="http://schemas.datacontract.org/2004/07/ApplicationService" />
            <xs:element name="AccountSignUp">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element minOccurs="0" name="key1" nillable="true" type="xs:string" />
                        <xs:element minOccurs="0" name="key2" nillable="true" type="xs:string" />
                        <xs:element minOccurs="0" name="signUpInformation" nillable="true" type="q1:SignUpInformation" xmlns:q1="http://schemas.datacontract.org/2004/07/ApplicationService" />
                        <xs:element minOccurs="0" name="primaryAccount" nillable="true" type="q2:PrimaryBankAccountInformation" xmlns:q2="http://schemas.datacontract.org/2004/07/ApplicationService" />
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="AccountSignUpResponse">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element minOccurs="0" name="AccountSignUpResult" nillable="true" type="q3:SignupResult" xmlns:q3="http://schemas.datacontract.org/2004/07/ApplicationService" />
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:schema>
        <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/">
            <xs:element name="anyType" nillable="true" type="xs:anyType" />
            <xs:element name="anyURI" nillable="true" type="xs:anyURI" />
            <xs:element name="base64Binary" nillable="true" type="xs:base64Binary" />
            <xs:element name="boolean" nillable="true" type="xs:boolean" />
            <xs:element name="byte" nillable="true" type="xs:byte" />
            <xs:element name="dateTime" nillable="true" type="xs:dateTime" />
            <xs:element name="decimal" nillable="true" type="xs:decimal" />
            <xs:element name="double" nillable="true" type="xs:double" />
            <xs:element name="float" nillable="true" type="xs:float" />
            <xs:element name="int" nillable="true" type="xs:int" />
            <xs:element name="long" nillable="true" type="xs:long" />
            <xs:element name="QName" nillable="true" type="xs:QName" />
            <xs:element name="short" nillable="true" type="xs:short" />
            <xs:element name="string" nillable="true" type="xs:string" />
            <xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte" />
            <xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt" />
            <xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong" />
            <xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort" />
            <xs:element name="char" nillable="true" type="tns:char" />
            <xs:simpleType name="char">
                <xs:restriction base="xs:int" />
            </xs:simpleType>
            <xs:element name="duration" nillable="true" type="tns:duration" />
            <xs:simpleType name="duration">
                <xs:restriction base="xs:duration">
                    <xs:pattern value="-?P(d*D)?(T(d*H)?(d*M)?(d*(.d*)?S)?)?" />
                    <xs:minInclusive value="-P10675199DT2H48M5.4775808S" />
                    <xs:maxInclusive value="P10675199DT2H48M5.4775807S" />
                </xs:restriction>
            </xs:simpleType>
            <xs:element name="guid" nillable="true" type="tns:guid" />
            <xs:simpleType name="guid">
                <xs:restriction base="xs:string">
                    <xs:pattern value="[da-fA-F]{8}-[da-fA-F]{4}-[da-fA-F]{4}-[da-fA-F]{4}-[da-fA-F]{12}" />
                </xs:restriction>
            </xs:simpleType>
            <xs:attribute name="FactoryType" type="xs:QName" />
            <xs:attribute name="Id" type="xs:ID" />
            <xs:attribute name="Ref" type="xs:IDREF" />
        </xs:schema>
        <xs:schema elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/ApplicationService" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.datacontract.org/2004/07/ApplicationService">
            <xs:complexType name="SignUpInformation">
                <xs:sequence>
                    <xs:element minOccurs="0" name="AccountName" nillable="true" type="xs:string" />
                    <xs:element minOccurs="0" name="AffiliateID" type="xs:long" />
                    <xs:element minOccurs="0" name="Comment" nillable="true" type="xs:string" />
                    <xs:element minOccurs="0" name="CurrencyCode" type="xs:int" />
                    <xs:element minOccurs="0" name="DBA" nillable="true" type="xs:string" />
                    <xs:element minOccurs="0" name="GiveBigCampaignID" type="xs:long" />
                    <xs:element minOccurs="0" name="MailingAddress" nillable="true" type="tns:Address" />
                    <xs:element minOccurs="0" name="PhysicalAddress" nillable="true" type="tns:Address" />
                    <xs:element minOccurs="0" name="PlanID" type="xs:long" />
                    <xs:element minOccurs="0" name="ReferalID" type="xs:long" />
                    <xs:element minOccurs="0" name="TaxID" nillable="true" type="xs:string" />
                    <xs:element minOccurs="0" name="TimeZone" nillable="true" type="xs:string" />
                    <xs:element minOccurs="0" name="User1" nillable="true" type="tns:User" />
                    <xs:element minOccurs="0" name="User2" nillable="true" type="tns:User" />
                    <xs:element minOccurs="0" name="WebsiteURL" nillable="true" type="xs:string" />
                </xs:sequence>
            </xs:complexType>
            <xs:element name="SignUpInformation" nillable="true" type="tns:SignUpInformation" />
            <xs:complexType name="Address">
                <xs:sequence>
                    <xs:element minOccurs="0" name="Address1" nillable="true" type="xs:string" />
                    <xs:element minOccurs="0" name="Address2" nillable="true" type="xs:string" />
                    <xs:element minOccurs="0" name="City" nillable="true" type="xs:string" />
                    <xs:element minOccurs="0" name="Country" nillable="true" type="xs:string" />
                    <xs:element minOccurs="0" name="State" nillable="true" type="xs:string" />
                    <xs:element minOccurs="0" name="ZipCode" nillable="true" type="xs:string" />
                </xs:sequence>
            </xs:complexType>
            <xs:element name="Address" nillable="true" type="tns:Address" />
            <xs:complexType name="User">
                <xs:sequence>
                    <xs:element minOccurs="0" name="Email" nillable="true" type="xs:string" />
                    <xs:element minOccurs="0" name="FirstName" nillable="true" type="xs:string" />
                    <xs:element minOccurs="0" name="LastName" nillable="true" type="xs:string" />
                    <xs:element minOccurs="0" name="Phone" nillable="true" type="xs:string" />
                </xs:sequence>
            </xs:complexType>
            <xs:element name="User" nillable="true" type="tns:User" />
            <xs:complexType name="PrimaryBankAccountInformation">
                <xs:sequence>
                    <xs:element minOccurs="0" name="AccountName" nillable="true" type="xs:string" />
                    <xs:element minOccurs="0" name="AccountNumber" nillable="true" type="xs:string" />
                    <xs:element minOccurs="0" name="AccountOwnershipType" nillable="true" type="xs:string" />
                    <xs:element minOccurs="0" name="AccountType" nillable="true" type="xs:string" />
                    <xs:element minOccurs="0" name="BankName" nillable="true" type="xs:string" />
                    <xs:element minOccurs="0" name="CountryCode" nillable="true" type="xs:string" />
                    <xs:element minOccurs="0" name="RoutingNumber" nillable="true" type="xs:string" />
                </xs:sequence>
            </xs:complexType>
            <xs:element name="PrimaryBankAccountInformation" nillable="true" type="tns:PrimaryBankAccountInformation" />
            <xs:complexType name="SignupResult">
                <xs:sequence>
                    <xs:element minOccurs="0" name="AccountID" type="xs:long" />
                    <xs:element minOccurs="0" name="Code" nillable="true" type="xs:string" />
                    <xs:element minOccurs="0" name="Description" nillable="true" type="xs:string" />
                </xs:sequence>
            </xs:complexType>
            <xs:element name="SignupResult" nillable="true" type="tns:SignupResult" />
        </xs:schema>
    </wsdl:types>
    <wsdl:message name="ISignup_AccountSignUp_InputMessage">
        <wsdl:part name="parameters" element="tns:AccountSignUp" />
    </wsdl:message>
    <wsdl:message name="ISignup_AccountSignUp_OutputMessage">
        <wsdl:part name="parameters" element="tns:AccountSignUpResponse" />
    </wsdl:message>
    <wsdl:portType name="ISignup">
        <wsdl:operation name="AccountSignUp">
            <wsdl:input wsaw:Action="https://ClickAndPledge.com/ApplicationService/ISignup/AccountSignUp" message="tns:ISignup_AccountSignUp_InputMessage" />
            <wsdl:output wsaw:Action="https://ClickAndPledge.com/ApplicationService/ISignup/AccountSignUpResponse" message="tns:ISignup_AccountSignUp_OutputMessage" />
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="basicHttpEndpoint" type="tns:ISignup">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
        <wsdl:operation name="AccountSignUp">
            <soap:operation soapAction="https://ClickAndPledge.com/ApplicationService/ISignup/AccountSignUp" style="document" />
            <wsdl:input>
                <soap:body use="literal" />
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal" />
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="Signup">
        <wsdl:port name="basicHttpEndpoint" binding="tns:basicHttpEndpoint">
            <soap:address location="https://application.cloud.clickandpledge.com/Signup.svc" />
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

I have form in wordpress and i am able to submit and able to $_POST data when i print out..whatever posting all the data i am getting..

Now i am tried to build the XML to connect SOAP API..
I have written following code for XML build

 $dom = new DOMDocument('1.0', 'UTF-8');
        $root = $dom->createElement('AccountSignUp', '');
     //$root->setAttribute("xmlns","urn:APISchema.xsd");
     $root = $dom->appendChild($root);
     $version=$dom->createElement("AccountSignUpResponse","");
     $version=$root->appendChild($version);
     $engine = $dom->createElement('SignUpInformation', "");
     $engine = $root->appendChild($engine);
     $AccountName = $dom->createElement('AccountName', $company_name);
     $AccountName = $engine->appendChild($AccountName);
     $dataParams =$dom->saveXML();

this method not able to build XML..
And also tried below method as well ,in this method in response i getting wsdl file print

$connect = array('soap_version' => SOAP_1_1, 'trace' => 1, 'exceptions' => 0);
        $soapclient = new SoapClient(include(plugin_dir_path( __FILE__ ) . 'Signup.wsdl'), $connect);

        $params = array('AccountName' => $company_name, 
                        'DBA' => $DBA, 
                        'AffiliateID' => 'test', 
                        'CurrencyCode' => 'USD', 
                        'Comment' => $comments,
                        //'MailingAddress' => 'USD', 
                        //'PhysicalAddress' => 'USD', 
                        //'PlanID' => 'USD',
                        'ReferalID' => $referred, 
                        'TaxID' => $fed_taxid, 
                        'TimeZone' => $Timezone, 
                        'Address1' => $address_one, 
                        'Address2' => $address_two, 
                        'WebsiteURL' => $website_url, 
                        //'CurrencyCode' => 'USD' 
                        );

        $soapParams = array('instruction'=>$params);
        $response = $soapclient->AccountSignUpResponse($soapParams);
        print_r($response);
        var_dump($response);

Read more here: how connect SOAP API only using WSDL file

Leave a Reply

Your email address will not be published. Required fields are marked *