簡體   English   中英

如何在php中使用SOAP WSDL進行SOAP調用

[英]How to make SOAP call using SOAP WSDL in php

如何使用下面的WSDL文件進行SOAP調用..

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

我正在使用上面的WSDL文件來連接SOAP API,讓我知道如何使用這個WSDL調用PHP soap ..我想生成XML然后將它傳遞給TargetURL,我怎樣才能創建XML文件並使用那個xml怎么能我傳遞給SOAP調用

您需要說明PHP應用程序所在的位置。 您可以使用SoapClient()來引用WSDL,然后調用服務中的一個方法。 請注意,您需要在php.ini文件中啟用SOAP dll。 通常你可以使用以下:

$serviceData= new SoapClient('http://xxx.xxx.xxx.xx:xx/WebService/WebService.svc?wsdl');
$response = $serviceData->SignUpInformation();
var_dump($response);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM