php - How to connect SOAP API only using WSDL file? -
from below question expected result form data submit soap api based on wsdl structure only, here getting form data $_post have follow below 2 methods didn't response now..i want post data using soap api... having wsdl file below wsdl file ..
<?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 , able submit , able $_post data when print out..whatever posting data getting..
now tried build xml connect soap api.. have written following code 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 build xml.. , tried below method ,in method in response 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);
Comments
Post a Comment