PDA

View Full Version : استفاده از وب سرویس یک وب سایت



sara_aryanfar
دوشنبه 25 مهر 1390, 20:17 عصر
با سلام من ابتدا کد ها رو قرار میدم بعد سوال خودمو مطرح می کنم
<definitions targetNamespace="urn:WebServices"><types><xsd:schema targetNamespace="urn:WebServices"><xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/><xsd:import namespace="http://schemas.xmlsoap.org/wsdl/"/></xsd:schema></types><message name="PaymentRequestRequest"><part name="merchantID" type="xsd:string"/><part name="amount" type="xsd:int"/><part name="redirectUrl" type="xsd:string"/><part name="desc" type="xsd:string"/></message><message name="PaymentRequestResponse"><part name="au" type="xsd:string"/></message><message name="PaymentVerificationRequest"><part name="merchantID" type="xsd:string"/><part name="au" type="xsd:string"/><part name="amount" type="xsd:int"/></message><message name="PaymentVerificationResponse"><part name="status" type="xsd:int"/></message><portType name="WebServicesPortType"><operation name="PaymentRequest"><documentation>Payment Request Session Creation</documentation><input message="tns:PaymentRequestRequest"/><output message="tns:PaymentRequestResponse"/></operation><operation name="PaymentVerification"><documentation>Payment Verification Method</documentation><input message="tns:PaymentVerificationRequest"/><output message="tns:PaymentVerificationResponse"/></operation></portType><binding name="WebServicesBinding" type="tns:WebServicesPortType"><soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/><operation name="PaymentRequest"><soap:operation soapAction="urn:WebServices#PaymentRequest" style="rpc"/><input><soap:body use="encoded" namespace="urn:WebServices" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input><output><soap:body use="encoded" namespace="urn:WebServices" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output></operation><operation name="PaymentVerification"><soap:operation soapAction="urn:WebServices#PaymentVerification" style="rpc"/><input><soap:body use="encoded" namespace="urn:WebServices" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input><output><soap:body use="encoded" namespace="urn:WebServices" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output></operation></binding><service name="WebServices"><port name="WebServicesPort" binding="tns:WebServicesBinding"><soap:address location="http://www.zarinpal.com/WebserviceGateway/"/></port></service></definitions>


کد شماره 2


<?php

$merchantID = '4e8acb6f-7890-4783-9ce3-xxxxxxx';
$amount = 20000; //Amount will be based on Toman
$callBackUrl = 'http://www.site.com/verify.php';

$client = new SoapClient('https://www.zarinpal.com/WebserviceGateway/wsdl', array('encoding'=>'UTF-8'));
$res = $client->PaymentRequest(merchantID, amount, callBackUrl, urlencode('تراکنش تستی') );


//Redirect to URL You can do it also by creating a form
Header('Location: https://www.zarinpal.com/users/pay_invoice/'.$res);

?>


ببینید کد اول کد وب سرویس هست و من کد دوم رو می خوام استفاده کنم اما عمل نمی کنه مشکل کد دوم من چیه ممنون